--- zzzz-none-000/linux-4.4.271/include/linux/mtd/partitions.h 2021-06-03 06:22:09.000000000 +0000 +++ hawkeye-5590-750/linux-4.4.271/include/linux/mtd/partitions.h 2023-04-19 10:22:30.000000000 +0000 @@ -35,6 +35,7 @@ * Note: writeable partitions require their size and offset be * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). */ +struct mtd_info; struct mtd_partition { const char *name; /* identifier string */ @@ -50,7 +51,6 @@ #define MTDPART_SIZ_FULL (0) -struct mtd_info; struct device_node; /** @@ -68,12 +68,19 @@ * Functions dealing with the various ways of partitioning the space */ +enum mtd_parser_type { + MTD_PARSER_TYPE_DEVICE = 0, + MTD_PARSER_TYPE_ROOTFS, + MTD_PARSER_TYPE_FIRMWARE, +}; + struct mtd_part_parser { struct list_head list; struct module *owner; const char *name; int (*parse_fn)(struct mtd_info *, struct mtd_partition **, struct mtd_part_parser_data *); + enum mtd_parser_type type; }; extern void register_mtd_parser(struct mtd_part_parser *parser); @@ -83,6 +90,15 @@ int mtd_add_partition(struct mtd_info *master, const char *name, long long offset, long long length); int mtd_del_partition(struct mtd_info *master, int partno); +struct mtd_info *mtdpart_get_master(const struct mtd_info *mtd); +uint64_t mtdpart_get_offset(const struct mtd_info *mtd); uint64_t mtd_get_device_size(const struct mtd_info *mtd); +extern void __weak arch_split_mtd_part(struct mtd_info *master, + const char *name, int offset, int size); + +int parse_mtd_partitions_by_type(struct mtd_info *master, + enum mtd_parser_type type, + struct mtd_partition **pparts, + struct mtd_part_parser_data *data); #endif