cmdline-parser.h 1.2 KB

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