[PATCH 3/5] partitons: add framework

Sascha Hauer s.hauer at pengutronix.de
Fri Feb 15 12:37:28 EST 2013


On Fri, Feb 15, 2013 at 02:35:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> +#include "partitions/parser.h"
>  
> -on_error:
> -	dma_free(buffer);
> -}
> +LIST_HEAD(partition_parser_list);

static

>  
>  /**
>   * Register one partition on the given block device
> @@ -135,6 +55,33 @@ static int register_one_partition(struct block_device *blk,
>  				0, partition_name);
>  }
>  
> +static struct partition_parser *partition_parser_get_by_filetype(uint8_t *buf)
> +{
> +	enum filetype type;
> +	struct partition_parser *parser;
> +
> +	/* first new partition table as EFI GPT */
> +	type = file_detect_type(buf, SECTOR_SIZE * 2);
> +
> +	list_for_each_entry(parser, &partition_parser_list, list) {
> +		if (parser->type == type)
> +			return parser;
> +	}
> +
> +	/* if not parser found search for old one
> +	 * so if EFI GPT not enable take it as MBR
> +	 * usefull for compatibility

1 Cent for each time you write useful with double l...



> +
> +struct partition_parser dos = {
> +	.parse = dos_partition,
> +	.type = filetype_mbr,
> +};

static

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 |



More information about the barebox mailing list