qnx6_fs.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Name : qnx6_fs.h
  4. * Author : Kai Bankett
  5. * Function : qnx6 global filesystem definitions
  6. * History : 17-01-2012 created
  7. */
  8. #ifndef _LINUX_QNX6_FS_H
  9. #define _LINUX_QNX6_FS_H
  10. #include <linux/types.h>
  11. #include <linux/magic.h>
  12. #define QNX6_ROOT_INO 1
  13. /* for di_status */
  14. #define QNX6_FILE_DIRECTORY 0x01
  15. #define QNX6_FILE_DELETED 0x02
  16. #define QNX6_FILE_NORMAL 0x03
  17. #define QNX6_SUPERBLOCK_SIZE 0x200 /* superblock always is 512 bytes */
  18. #define QNX6_SUPERBLOCK_AREA 0x1000 /* area reserved for superblock */
  19. #define QNX6_BOOTBLOCK_SIZE 0x2000 /* heading bootblock area */
  20. #define QNX6_DIR_ENTRY_SIZE 0x20 /* dir entry size of 32 bytes */
  21. #define QNX6_INODE_SIZE 0x80 /* each inode is 128 bytes */
  22. #define QNX6_INODE_SIZE_BITS 7 /* inode entry size shift */
  23. #define QNX6_NO_DIRECT_POINTERS 16 /* 16 blockptrs in sbl/inode */
  24. #define QNX6_PTR_MAX_LEVELS 5 /* maximum indirect levels */
  25. /* for filenames */
  26. #define QNX6_SHORT_NAME_MAX 27
  27. #define QNX6_LONG_NAME_MAX 510
  28. /* list of mount options */
  29. #define QNX6_MOUNT_MMI_FS 0x010000 /* mount as Audi MMI 3G fs */
  30. /*
  31. * This is the original qnx6 inode layout on disk.
  32. * Each inode is 128 byte long.
  33. */
  34. struct qnx6_inode_entry {
  35. __fs64 di_size;
  36. __fs32 di_uid;
  37. __fs32 di_gid;
  38. __fs32 di_ftime;
  39. __fs32 di_mtime;
  40. __fs32 di_atime;
  41. __fs32 di_ctime;
  42. __fs16 di_mode;
  43. __fs16 di_ext_mode;
  44. __fs32 di_block_ptr[QNX6_NO_DIRECT_POINTERS];
  45. __u8 di_filelevels;
  46. __u8 di_status;
  47. __u8 di_unknown2[2];
  48. __fs32 di_zero2[6];
  49. };
  50. /*
  51. * Each directory entry is maximum 32 bytes long.
  52. * If more characters or special characters required it is stored
  53. * in the longfilenames structure.
  54. */
  55. struct qnx6_dir_entry {
  56. __fs32 de_inode;
  57. __u8 de_size;
  58. char de_fname[QNX6_SHORT_NAME_MAX];
  59. };
  60. /*
  61. * Longfilename direntries have a different structure
  62. */
  63. struct qnx6_long_dir_entry {
  64. __fs32 de_inode;
  65. __u8 de_size;
  66. __u8 de_unknown[3];
  67. __fs32 de_long_inode;
  68. __fs32 de_checksum;
  69. };
  70. struct qnx6_long_filename {
  71. __fs16 lf_size;
  72. __u8 lf_fname[QNX6_LONG_NAME_MAX];
  73. };
  74. struct qnx6_root_node {
  75. __fs64 size;
  76. __fs32 ptr[QNX6_NO_DIRECT_POINTERS];
  77. __u8 levels;
  78. __u8 mode;
  79. __u8 spare[6];
  80. };
  81. struct qnx6_super_block {
  82. __fs32 sb_magic;
  83. __fs32 sb_checksum;
  84. __fs64 sb_serial;
  85. __fs32 sb_ctime; /* time the fs was created */
  86. __fs32 sb_atime; /* last access time */
  87. __fs32 sb_flags;
  88. __fs16 sb_version1; /* filesystem version information */
  89. __fs16 sb_version2; /* filesystem version information */
  90. __u8 sb_volumeid[16];
  91. __fs32 sb_blocksize;
  92. __fs32 sb_num_inodes;
  93. __fs32 sb_free_inodes;
  94. __fs32 sb_num_blocks;
  95. __fs32 sb_free_blocks;
  96. __fs32 sb_allocgroup;
  97. struct qnx6_root_node Inode;
  98. struct qnx6_root_node Bitmap;
  99. struct qnx6_root_node Longfile;
  100. struct qnx6_root_node Unknown;
  101. };
  102. /* Audi MMI 3G superblock layout is different to plain qnx6 */
  103. struct qnx6_mmi_super_block {
  104. __fs32 sb_magic;
  105. __fs32 sb_checksum;
  106. __fs64 sb_serial;
  107. __u8 sb_spare0[12];
  108. __u8 sb_id[12];
  109. __fs32 sb_blocksize;
  110. __fs32 sb_num_inodes;
  111. __fs32 sb_free_inodes;
  112. __fs32 sb_num_blocks;
  113. __fs32 sb_free_blocks;
  114. __u8 sb_spare1[4];
  115. struct qnx6_root_node Inode;
  116. struct qnx6_root_node Bitmap;
  117. struct qnx6_root_node Longfile;
  118. struct qnx6_root_node Unknown;
  119. };
  120. #endif