From: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx> Partitions are not the only devices that can have UUIDs. Change the name to something more generic to prepare for other users. Signed-off-by: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx> Link: https://lore.barebox.org/20220124100458.2924679-2-m.olbrich@xxxxxxxxxxxxxx Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/bootm.c | 6 +++--- common/partitions.c | 2 +- common/partitions/parser.h | 2 +- fs/devfs-core.c | 2 +- fs/fs.c | 4 ++-- include/driver.h | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index 89e3e93f2c..4652467448 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -709,15 +709,15 @@ int bootm_boot(struct bootm_data *bootm_data) const char *root_dev_name = devpath_to_name(bootm_data->root_dev); const struct cdev *root_cdev = cdev_by_name(root_dev_name); - if (root_cdev && root_cdev->partuuid[0] != 0) { - rootarg = basprintf("root=PARTUUID=%s", root_cdev->partuuid); + if (root_cdev && root_cdev->uuid[0] != 0) { + rootarg = basprintf("root=PARTUUID=%s", root_cdev->uuid); } else { rootarg = ERR_PTR(-EINVAL); if (!root_cdev) pr_err("no cdev found for %s, cannot set root= option\n", root_dev_name); - else if (!root_cdev->partuuid[0]) + else if (!root_cdev->uuid[0]) pr_err("%s doesn't have a PARTUUID, cannot set root= option\n", root_dev_name); } diff --git a/common/partitions.c b/common/partitions.c index b579559672..9cca5c4a15 100644 --- a/common/partitions.c +++ b/common/partitions.c @@ -51,7 +51,7 @@ static int register_one_partition(struct block_device *blk, cdev->flags |= DEVFS_PARTITION_FROM_TABLE; cdev->dos_partition_type = part->dos_partition_type; - strcpy(cdev->partuuid, part->partuuid); + strcpy(cdev->uuid, part->partuuid); free(partition_name); diff --git a/common/partitions/parser.h b/common/partitions/parser.h index 69508932b3..d67f8e1d6a 100644 --- a/common/partitions/parser.h +++ b/common/partitions/parser.h @@ -17,7 +17,7 @@ struct partition { char name[MAX_PARTITION_NAME]; u8 dos_partition_type; - char partuuid[MAX_PARTUUID_STR]; + char partuuid[MAX_UUID_STR]; uint64_t first_sec; uint64_t size; }; diff --git a/fs/devfs-core.c b/fs/devfs-core.c index 2d016e0e48..82e4811b38 100644 --- a/fs/devfs-core.c +++ b/fs/devfs-core.c @@ -101,7 +101,7 @@ struct cdev *cdev_by_partuuid(const char *partuuid) return NULL; list_for_each_entry(cdev, &cdev_list, list) { - if (!strcasecmp(cdev->partuuid, partuuid)) + if (cdev->master && !strcasecmp(cdev->uuid, partuuid)) return cdev; } return NULL; diff --git a/fs/fs.c b/fs/fs.c index 60fdb29078..968e77b808 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -2999,8 +2999,8 @@ int mount(const char *device, const char *fsname, const char *pathname, cdev_is_mci_main_part_dev(fsdev->cdev->master)) str = get_linux_mmcblkdev(fsdev); - if (!str && fsdev->cdev->partuuid[0] != 0) - str = basprintf("root=PARTUUID=%s", fsdev->cdev->partuuid); + if (!str && fsdev->cdev->uuid[0] != 0) + str = basprintf("root=PARTUUID=%s", fsdev->cdev->uuid); if (str) fsdev_set_linux_rootarg(fsdev, str); diff --git a/include/driver.h b/include/driver.h index 1215a2d57a..62a1782847 100644 --- a/include/driver.h +++ b/include/driver.h @@ -451,7 +451,7 @@ struct cdev_operations { int (*truncate)(struct cdev*, size_t size); }; -#define MAX_PARTUUID_STR sizeof("00112233-4455-6677-8899-AABBCCDDEEFF") +#define MAX_UUID_STR sizeof("00112233-4455-6677-8899-AABBCCDDEEFF") struct cdev { const struct cdev_operations *ops; @@ -464,7 +464,7 @@ struct cdev { char *partname; /* the partition name, usually the above without the * device part, i.e. name = "nand0.barebox" -> partname = "barebox" */ - char partuuid[MAX_PARTUUID_STR]; + char uuid[MAX_UUID_STR]; loff_t offset; loff_t size; unsigned int flags; -- 2.30.2 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox