From 28c341ca07169ac8caf9895667938d74bc0119ae Mon Sep 17 00:00:00 2001 From: Javier Tia Date: Thu, 9 Oct 2025 07:17:46 -0600 Subject: part: Export part_driver_lookup_type for external use Make part_driver_lookup_type non-static so it can be used outside part.c. This allows external callers to determine the appropriate partition driver for a block device, enabling more flexible handling of partition types. Add a prototype and kernel-doc comment in part.h to document the function contract. Provide a stub inline implementation returning NULL when partition support is disabled, ensuring build consistency across configurations. Signed-off-by: Javier Tia Reviewed-by: Ilias Apalodimas Signed-off-by: Ilias Apalodimas --- include/part.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'include') diff --git a/include/part.h b/include/part.h index b772fb34c8a..6caaa6526aa 100644 --- a/include/part.h +++ b/include/part.h @@ -727,6 +727,24 @@ int part_get_type_by_name(const char *name); */ int part_get_bootable(struct blk_desc *desc); +/** + * part_driver_lookup_type() - Look up the partition driver for a blk device + * + * If @desc->part_type is PART_TYPE_UNKNOWN, this checks each partition driver + * against the blk device to see if there is a valid partition table acceptable + * to that driver. + * + * If @desc->part_type is already set, it just returns the driver for that + * type, without testing if the driver can find a valid partition on the + * descriptor. + * + * On success it updates @desc->part_type if set to PART_TYPE_UNKNOWN on entry + * + * @desc: Device descriptor + * Return: Driver found, or NULL if none + */ +struct part_driver *part_driver_lookup_type(struct blk_desc *desc); + #else static inline int part_driver_get_count(void) { return 0; } @@ -737,6 +755,9 @@ static inline struct part_driver *part_driver_get_first(void) static inline bool part_get_bootable(struct blk_desc *desc) { return false; } +static inline struct part_driver *part_driver_lookup_type(struct blk_desc *desc) +{ return NULL; } + #endif /* CONFIG_PARTITIONS */ #endif /* _PART_H */ -- cgit v1.2.3