mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/8] cdev: rename partuuid to uuid
@ 2022-02-07  9:49 Sascha Hauer
  2022-02-07  9:49 ` [PATCH 2/8] cdev: add diskuuid support Sascha Hauer
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Sascha Hauer @ 2022-02-07  9:49 UTC (permalink / raw)
  To: Barebox List; +Cc: Michael Olbrich, Michael Olbrich

From: Michael Olbrich <m.olbrich@pengutronix.de>

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@pengutronix.de>
Link: https://lore.barebox.org/20220124100458.2924679-2-m.olbrich@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2022-02-08 12:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07  9:49 [PATCH 1/8] cdev: rename partuuid to uuid Sascha Hauer
2022-02-07  9:49 ` [PATCH 2/8] cdev: add diskuuid support Sascha Hauer
2022-02-07  9:49 ` [PATCH 3/8] rename cdev_open() -> cdev_open_name() Sascha Hauer
2022-02-07 10:43   ` Ahmad Fatoum
2022-02-07  9:49 ` [PATCH 4/8] cdev: implement cdev_open() Sascha Hauer
2022-02-07 10:46   ` Ahmad Fatoum
2022-02-07  9:49 ` [PATCH 5/8] driver: Add functions to free devices Sascha Hauer
2022-02-07  9:49 ` [PATCH 6/8] cdev: Create missing cdev_* functions Sascha Hauer
2022-02-07  9:49 ` [PATCH 7/8] cdev: create iterator for cdev list Sascha Hauer
2022-02-07  9:49 ` [PATCH 8/8] misc: Add storage-by-uuid driver Sascha Hauer
2022-02-07  9:52   ` Sascha Hauer
2022-02-07 10:59   ` [PATCH] efi: probe devices from the device-tree Michael Olbrich
2022-02-08  9:29   ` [PATCH 8/8] misc: Add storage-by-uuid driver Michael Olbrich
2022-02-08 12:27     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox