mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 22:24:09 +08:00
bab55417b1
Read block device partition table from command line. The partition used for fixed block device (eMMC) embedded device. It is no MBR, save storage space. Bootloader can be easily accessed by absolute address of data on the block device. Users can easily change the partition. This code reference MTD partition, source "drivers/mtd/cmdlinepart.c" About the partition verbose reference "Documentation/block/cmdline-partition.txt" [akpm@linux-foundation.org: fix printk text] [yongjun_wei@trendmicro.com.cn: fix error return code in parse_parts()] Signed-off-by: Cai Zhiyong <caizhiyong@huawei.com> Cc: Karel Zak <kzak@redhat.com> Cc: "Wanglin (Albert)" <albert.wanglin@huawei.com> Cc: Marius Groeger <mag@sysgo.de> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Brian Norris <computersforpeace@gmail.com> Cc: Artem Bityutskiy <dedekind@infradead.org> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
44 lines
1.1 KiB
C
44 lines
1.1 KiB
C
/*
|
|
* Parsing command line, get the partitions information.
|
|
*
|
|
* Written by Cai Zhiyong <caizhiyong@huawei.com>
|
|
*
|
|
*/
|
|
#ifndef CMDLINEPARSEH
|
|
#define CMDLINEPARSEH
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
/* partition flags */
|
|
#define PF_RDONLY 0x01 /* Device is read only */
|
|
#define PF_POWERUP_LOCK 0x02 /* Always locked after reset */
|
|
|
|
struct cmdline_subpart {
|
|
char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
|
|
sector_t from;
|
|
sector_t size;
|
|
int flags;
|
|
struct cmdline_subpart *next_subpart;
|
|
};
|
|
|
|
struct cmdline_parts {
|
|
char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */
|
|
unsigned int nr_subparts;
|
|
struct cmdline_subpart *subpart;
|
|
struct cmdline_parts *next_parts;
|
|
};
|
|
|
|
void cmdline_parts_free(struct cmdline_parts **parts);
|
|
|
|
int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
|
|
|
|
struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
|
|
const char *bdev);
|
|
|
|
void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
|
|
int slot,
|
|
int (*add_part)(int, struct cmdline_subpart *, void *),
|
|
void *param);
|
|
|
|
#endif /* CMDLINEPARSEH */
|