On Thu, Feb 14, 2013 at 04:52:25PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote: > so we can support multiple format > > use filetpye to detect the parser to use > > Cc: Rob Herring <rob.herring@xxxxxxxxxxx> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@xxxxxxxxxxxx> > --- > common/Kconfig | 14 +---- > common/Makefile | 2 +- > common/partitions.c | 132 +++++++++++++++----------------------------- > common/partitions/Makefile | 1 + > common/partitions/dos.c | 87 +++++++++++++++++++++++++++++ > common/partitions/parser.h | 35 ++++++++++++ common/partitions/Kconfig is missing in this patch. > +int partition_parser_register(struct partition_parser *p) > +{ > + if (!p || !p->parse) > + return -EINVAL; Please drop these stupid checks. Everyone calling this with a NULL pointer really deserves a stack dump. > + > +#ifndef __PARTITIONS_PARSER_H__ > +#define __PARTITIONS_PARSER_H__ > + > +#include <block.h> > +#include <filetype.h> > +#include <linux/list.h> > + > +#define MAX_PARTITION 8 > + > +struct partition { > + uint64_t first_sec; > + uint64_t size; > +}; > + > +struct partition_desc { > + int used_entries; > + struct partition parts[MAX_PARTITION]; > +}; > + > +struct partition_parser { > + void (*parse)(uint8_t *buf, struct block_device *blk, struct partition_desc *pd); use void * for passing buffers please. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox