2
0

mtdsplit.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2009-2013 Felix Fietkau <nbd@nbd.name>
  3. * Copyright (C) 2009-2013 Gabor Juhos <juhosg@openwrt.org>
  4. * Copyright (C) 2012 Jonas Gorski <jogo@openwrt.org>
  5. * Copyright (C) 2013 Hauke Mehrtens <hauke@hauke-m.de>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License version 2 as published
  9. * by the Free Software Foundation.
  10. *
  11. */
  12. #ifndef _MTDSPLIT_H
  13. #define _MTDSPLIT_H
  14. #define KERNEL_PART_NAME "kernel"
  15. #define ROOTFS_PART_NAME "rootfs"
  16. #define UBI_PART_NAME "ubi"
  17. #define ROOTFS_SPLIT_NAME "rootfs_data"
  18. enum mtdsplit_part_type {
  19. MTDSPLIT_PART_TYPE_UNK = 0,
  20. MTDSPLIT_PART_TYPE_SQUASHFS,
  21. MTDSPLIT_PART_TYPE_JFFS2,
  22. MTDSPLIT_PART_TYPE_UBI,
  23. };
  24. #ifdef CONFIG_MTD_SPLIT
  25. int mtd_get_squashfs_len(struct mtd_info *master,
  26. size_t offset,
  27. size_t *squashfs_len);
  28. int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
  29. enum mtdsplit_part_type *type);
  30. int mtd_find_rootfs_from(struct mtd_info *mtd,
  31. size_t from,
  32. size_t limit,
  33. size_t *ret_offset,
  34. enum mtdsplit_part_type *type);
  35. #else
  36. static inline int mtd_get_squashfs_len(struct mtd_info *master,
  37. size_t offset,
  38. size_t *squashfs_len)
  39. {
  40. return -ENODEV;
  41. }
  42. static inline int mtd_check_rootfs_magic(struct mtd_info *mtd, size_t offset,
  43. enum mtdsplit_part_type *type)
  44. {
  45. return -EINVAL;
  46. }
  47. static inline int mtd_find_rootfs_from(struct mtd_info *mtd,
  48. size_t from,
  49. size_t limit,
  50. size_t *ret_offset,
  51. enum mtdsplit_part_type *type)
  52. {
  53. return -ENODEV;
  54. }
  55. #endif /* CONFIG_MTD_SPLIT */
  56. #endif /* _MTDSPLIT_H */