Extract files from a YAFFS2 file system image http://bernhard-ehlers.de/projects/unyaffs.html

unyaffs.h 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * definition copied from yaffs project
  3. */
  4. #ifndef __UNYAFFS_H__
  5. #define __UNYAFFS_H__
  6. #define YAFFS_MAX_NAME_LENGTH 255
  7. #define YAFFS_MAX_ALIAS_LENGTH 159
  8. /* Definition of types */
  9. typedef unsigned char __u8;
  10. typedef unsigned short __u16;
  11. typedef unsigned __u32;
  12. typedef struct {
  13. unsigned sequenceNumber;
  14. unsigned objectId;
  15. unsigned chunkId;
  16. unsigned byteCount;
  17. } yaffs_PackedTags2TagsPart;
  18. typedef struct {
  19. unsigned char colParity;
  20. unsigned lineParity;
  21. unsigned lineParityPrime;
  22. } yaffs_ECCOther;
  23. typedef struct {
  24. yaffs_PackedTags2TagsPart t;
  25. yaffs_ECCOther ecc;
  26. } yaffs_PackedTags2;
  27. typedef enum {
  28. YAFFS_OBJECT_TYPE_UNKNOWN,
  29. YAFFS_OBJECT_TYPE_FILE,
  30. YAFFS_OBJECT_TYPE_SYMLINK,
  31. YAFFS_OBJECT_TYPE_DIRECTORY,
  32. YAFFS_OBJECT_TYPE_HARDLINK,
  33. YAFFS_OBJECT_TYPE_SPECIAL
  34. } yaffs_ObjectType;
  35. /* -------------------------- Object structure -------------------------------*/
  36. /* This is the object structure as stored on NAND */
  37. typedef struct {
  38. yaffs_ObjectType type;
  39. /* Apply to everything */
  40. int parentObjectId;
  41. __u16 sum__NoLongerUsed; /* checksum of name. No longer used */
  42. char name[YAFFS_MAX_NAME_LENGTH + 1];
  43. /* The following apply to directories, files, symlinks - not hard links */
  44. __u32 yst_mode; /* protection */
  45. #ifdef CONFIG_YAFFS_WINCE
  46. __u32 notForWinCE[5];
  47. #else
  48. __u32 yst_uid;
  49. __u32 yst_gid;
  50. __u32 yst_atime;
  51. __u32 yst_mtime;
  52. __u32 yst_ctime;
  53. #endif
  54. /* File size applies to files only */
  55. int fileSize;
  56. /* Equivalent object id applies to hard links only. */
  57. int equivalentObjectId;
  58. /* Alias is for symlinks only. */
  59. char alias[YAFFS_MAX_ALIAS_LENGTH + 1];
  60. __u32 yst_rdev; /* device stuff for block and char devices (major/min) */
  61. #ifdef CONFIG_YAFFS_WINCE
  62. __u32 win_ctime[2];
  63. __u32 win_atime[2];
  64. __u32 win_mtime[2];
  65. #else
  66. __u32 roomToGrow[6];
  67. #endif
  68. __u32 inbandShadowsObject;
  69. __u32 inbandIsShrink;
  70. __u32 reservedSpace[2];
  71. int shadowsObject; /* This object header shadows the specified object if > 0 */
  72. /* isShrink applies to object headers written when we shrink the file (ie resize) */
  73. __u32 isShrink;
  74. } yaffs_ObjectHeader;
  75. #endif