summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVaradarajan Narayanan <[email protected]>2025-05-13 14:47:06 +0530
committerTom Rini <[email protected]>2025-05-29 18:35:43 -0600
commit43fd4bcefd4ea5e586e201a0908018d1e8395c82 (patch)
treecbab621399f961aec7eacb801315fb1e3bcebafe /include
parent48db49b0977cc1c9c9abf82c0fb704238fcef4fd (diff)
disk: part: implement generic function part_get_info_by_uuid()
Add function to search for a partition by UUID as partition names may not be unique. Signed-off-by: Varadarajan Narayanan <[email protected]> Acked-by: Casey Connolly <[email protected]>
Diffstat (limited to 'include')
-rw-r--r--include/part.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/part.h b/include/part.h
index fcb3c13dea4..3e6eb0ec33f 100644
--- a/include/part.h
+++ b/include/part.h
@@ -316,6 +316,20 @@ int part_get_info_by_name(struct blk_desc *desc, const char *name,
struct disk_partition *info);
/**
+ * part_get_info_by_uuid() - Search for a partition by uuid
+ * among all available registered partitions
+ *
+ * @desc: block device descriptor
+ * @uuid: the specified table entry uuid
+ * @info: the disk partition info
+ *
+ * Return: the partition number on match (starting on 1), -ENOENT on no match,
+ * otherwise error
+ */
+int part_get_info_by_uuid(struct blk_desc *desc, const char *uuid,
+ struct disk_partition *info);
+
+/**
* part_get_info_by_dev_and_name_or_num() - Get partition info from dev number
* and part name, or dev number and
* part number.
@@ -386,6 +400,12 @@ static inline int part_get_info_by_name(struct blk_desc *desc, const char *name,
return -ENOENT;
}
+static inline int part_get_info_by_uuid(struct blk_desc *desc, const char *uuid,
+ struct disk_partition *info)
+{
+ return -ENOENT;
+}
+
static inline int
part_get_info_by_dev_and_name_or_num(const char *dev_iface,
const char *dev_part_str,