--- zzzz-none-000/linux-3.10.107/include/linux/mtd/partitions.h 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/include/linux/mtd/partitions.h 2021-02-04 17:41:59.000000000 +0000 @@ -35,9 +35,10 @@ * Note: writeable partitions require their size and offset be * erasesize aligned (e.g. use MTDPART_OFS_NEXTBLK). */ +struct mtd_info; struct mtd_partition { - char *name; /* identifier string */ + const char *name; /* identifier string */ uint64_t size; /* partition size */ uint64_t offset; /* offset within the master MTD space */ uint32_t mask_flags; /* master MTD flags to mask out for this partition */ @@ -50,7 +51,6 @@ #define MTDPART_SIZ_FULL (0) -struct mtd_info; struct device_node; /** @@ -68,21 +68,37 @@ * 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 int register_mtd_parser(struct mtd_part_parser *parser); -extern int deregister_mtd_parser(struct mtd_part_parser *parser); +extern void register_mtd_parser(struct mtd_part_parser *parser); +extern void deregister_mtd_parser(struct mtd_part_parser *parser); int mtd_is_partition(const struct mtd_info *mtd); -int mtd_add_partition(struct mtd_info *master, char *name, +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