|
@@ -743,7 +743,7 @@ static const char * const default_mtd_part_types[] = {
|
|
* parse_mtd_partitions - parse MTD partitions
|
|
* parse_mtd_partitions - parse MTD partitions
|
|
* @master: the master partition (describes whole MTD device)
|
|
* @master: the master partition (describes whole MTD device)
|
|
* @types: names of partition parsers to try or %NULL
|
|
* @types: names of partition parsers to try or %NULL
|
|
- * @pparts: array of partitions found is returned here
|
|
|
|
|
|
+ * @pparts: info about partitions found is returned here
|
|
* @data: MTD partition parser-specific data
|
|
* @data: MTD partition parser-specific data
|
|
*
|
|
*
|
|
* This function tries to find partition on MTD device @master. It uses MTD
|
|
* This function tries to find partition on MTD device @master. It uses MTD
|
|
@@ -755,12 +755,11 @@ static const char * const default_mtd_part_types[] = {
|
|
*
|
|
*
|
|
* This function may return:
|
|
* This function may return:
|
|
* o a negative error code in case of failure
|
|
* o a negative error code in case of failure
|
|
- * o zero if no partitions were found
|
|
|
|
- * o a positive number of found partitions, in which case on exit @pparts will
|
|
|
|
- * point to an array containing this number of &struct mtd_info objects.
|
|
|
|
|
|
+ * o zero otherwise, and @pparts will describe the partitions, number of
|
|
|
|
+ * partitions, and the parser which parsed them
|
|
*/
|
|
*/
|
|
int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
|
|
int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
|
|
- const struct mtd_partition **pparts,
|
|
|
|
|
|
+ struct mtd_partitions *pparts,
|
|
struct mtd_part_parser_data *data)
|
|
struct mtd_part_parser_data *data)
|
|
{
|
|
{
|
|
struct mtd_part_parser *parser;
|
|
struct mtd_part_parser *parser;
|
|
@@ -778,14 +777,16 @@ int parse_mtd_partitions(struct mtd_info *master, const char *const *types,
|
|
parser ? parser->name : NULL);
|
|
parser ? parser->name : NULL);
|
|
if (!parser)
|
|
if (!parser)
|
|
continue;
|
|
continue;
|
|
- ret = (*parser->parse_fn)(master, pparts, data);
|
|
|
|
|
|
+ ret = (*parser->parse_fn)(master, &pparts->parts, data);
|
|
pr_debug("%s: parser %s: %i\n",
|
|
pr_debug("%s: parser %s: %i\n",
|
|
master->name, parser->name, ret);
|
|
master->name, parser->name, ret);
|
|
mtd_part_parser_put(parser);
|
|
mtd_part_parser_put(parser);
|
|
if (ret > 0) {
|
|
if (ret > 0) {
|
|
printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n",
|
|
printk(KERN_NOTICE "%d %s partitions found on MTD device %s\n",
|
|
ret, parser->name, master->name);
|
|
ret, parser->name, master->name);
|
|
- return ret;
|
|
|
|
|
|
+ pparts->nr_parts = ret;
|
|
|
|
+ pparts->parser = parser;
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
/*
|
|
/*
|
|
* Stash the first error we see; only report it if no parser
|
|
* Stash the first error we see; only report it if no parser
|