cmdline-parser.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. #include <linux/blkdev.h>
  10. /* partition flags */
  11. #define PF_RDONLY 0x01 /* Device is read only */
  12. #define PF_POWERUP_LOCK 0x02 /* Always locked after reset */
  13. struct cmdline_subpart {
  14. char name[BDEVNAME_SIZE]; /* partition name, such as 'rootfs' */
  15. sector_t from;
  16. sector_t size;
  17. int flags;
  18. struct cmdline_subpart *next_subpart;
  19. };
  20. struct cmdline_parts {
  21. char name[BDEVNAME_SIZE]; /* block device, such as 'mmcblk0' */
  22. unsigned int nr_subparts;
  23. struct cmdline_subpart *subpart;
  24. struct cmdline_parts *next_parts;
  25. };
  26. void cmdline_parts_free(struct cmdline_parts **parts);
  27. int cmdline_parts_parse(struct cmdline_parts **parts, const char *cmdline);
  28. struct cmdline_parts *cmdline_parts_find(struct cmdline_parts *parts,
  29. const char *bdev);
  30. void cmdline_parts_set(struct cmdline_parts *parts, sector_t disk_size,
  31. int slot,
  32. int (*add_part)(int, struct cmdline_subpart *, void *),
  33. void *param);
  34. #endif /* CMDLINEPARSEH */