From 4031a17fa01902363929c818dcab4aed3881e7ad Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 30 Mar 2017 16:08:15 +0200 Subject: fs: devfs-core: replace DEVFS_IS_PARTITION flag with pointer to the master cdev Instead of having a flag indicating a cdev is a partition on some master cdev, just add a master pointer to the cdev, so that we can also find out who the master is. Signed-off-by: Sascha Hauer --- fs/devfs-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'fs') diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 170d463baa..382606f1cf 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -37,7 +37,7 @@ int devfs_partition_complete(struct string_list *sl, char *instr) len = strlen(instr); list_for_each_entry(cdev, &cdev_list, list) { - if (cdev->flags & DEVFS_IS_PARTITION && + if (cdev->master && !strncmp(instr, cdev->name, len)) { string_list_add_asprintf(sl, "%s ", cdev->name); } @@ -259,7 +259,7 @@ int devfs_remove(struct cdev *cdev) list_for_each_entry_safe(c, tmp, &cdev->links, link_entry) devfs_remove(c); - if (cdev->flags & DEVFS_IS_PARTITION) + if (cdev->master) list_del(&cdev->partition_entry); if (cdev->link) @@ -326,7 +326,7 @@ static struct cdev *__devfs_add_partition(struct cdev *cdev, new->offset = cdev->offset + offset; new->dev = cdev->dev; - new->flags = partinfo->flags | DEVFS_IS_PARTITION; + new->master = cdev; list_add_tail(&new->partition_entry, &cdev->partitions); @@ -368,7 +368,7 @@ int devfs_del_partition(const char *name) return ret; } - if (!(cdev->flags & DEVFS_IS_PARTITION)) + if (!cdev->master) return -EINVAL; if (cdev->flags & DEVFS_PARTITION_FIXED) return -EPERM; -- cgit v1.2.3