Cai Zhiyong | bab5541 | 2013-09-11 14:20:09 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Parsing command line, get the partitions information. |
| 3 | * |
| 4 | * Written by Cai Zhiyong <caizhiyong@huawei.com> |
| 5 | * |
| 6 | */ |
| 7 | #ifndef CMDLINEPARSEH |
| 8 | #define CMDLINEPARSEH |
| 9 | |
| 10 | #include <linux/blkdev.h> |
| 11 | |
| 12 | /* partition flags */ |
| 13 | #define PF_RDONLY 0x01 /* Device is read only */ |
| 14 | #define PF_POWERUP_LOCK 0x02 /* Always locked after reset */ |
| 15 | |
| 16 | struct cmdline_subpart { |
| 17 | char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */ |
| 18 | sector_t from; |
| 19 | sector_t size; |
| 20 | int flags; |
| 21 | struct cmdline_subpart *next_subpart; |
| 22 | }; |
| 23 | |
| 24 | struct cmdline_parts { |
| 25 | char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */ |
| 26 | unsigned int nr_subparts; |
| 27 | struct cmdline_subpart *subpart; |
| 28 | struct cmdline_parts *next_parts; |
| 29 | }; |
| 30 | |
| 31 | void cmdline_parts_free(struct cmdline_parts **parts); |
| 32 | |
| 33 | int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline); |
| 34 | |
| 35 | struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts, |
| 36 | const char *bdev); |
| 37 | |
| 38 | void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size, |
| 39 | int slot, |
| 40 | int (*add_part)(int, struct cmdline_subpart *, void *), |
| 41 | void *param); |
| 42 | |
| 43 | #endif /* CMDLINEPARSEH */ |