iso.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. #ifndef _ISOFS_FS_H
  2. #define _ISOFS_FS_H
  3. #include <linux/types.h>
  4. /*
  5. * The isofs filesystem constants/structures
  6. */
  7. /* This part borrowed from the bsd386 isofs */
  8. #define ISODCL(from, to) (to - from + 1)
  9. struct iso_volume_descriptor {
  10. char type[ISODCL(1,1)]; /* 711 */
  11. char id[ISODCL(2,6)];
  12. char version[ISODCL(7,7)];
  13. char data[ISODCL(8,2048)];
  14. };
  15. /* volume descriptor types */
  16. #define ISO_VD_PRIMARY 1
  17. #define ISO_VD_END 255
  18. #define ISO_STANDARD_ID "CD001"
  19. struct iso_primary_descriptor {
  20. char type [ISODCL ( 1, 1)]; /* 711 */
  21. char id [ISODCL ( 2, 6)];
  22. char version [ISODCL ( 7, 7)]; /* 711 */
  23. char unused1 [ISODCL ( 8, 8)];
  24. char system_id [ISODCL ( 9, 40)]; /* achars */
  25. char volume_id [ISODCL ( 41, 72)]; /* dchars */
  26. char unused2 [ISODCL ( 73, 80)];
  27. char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
  28. char unused3 [ISODCL ( 89, 120)];
  29. char volume_set_size [ISODCL (121, 124)]; /* 723 */
  30. char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
  31. char logical_block_size [ISODCL (129, 132)]; /* 723 */
  32. char path_table_size [ISODCL (133, 140)]; /* 733 */
  33. char type_l_path_table [ISODCL (141, 144)]; /* 731 */
  34. char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
  35. char type_m_path_table [ISODCL (149, 152)]; /* 732 */
  36. char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
  37. char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
  38. char volume_set_id [ISODCL (191, 318)]; /* dchars */
  39. char publisher_id [ISODCL (319, 446)]; /* achars */
  40. char preparer_id [ISODCL (447, 574)]; /* achars */
  41. char application_id [ISODCL (575, 702)]; /* achars */
  42. char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
  43. char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
  44. char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
  45. char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
  46. char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
  47. char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
  48. char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
  49. char file_structure_version [ISODCL (882, 882)]; /* 711 */
  50. char unused4 [ISODCL (883, 883)];
  51. char application_data [ISODCL (884, 1395)];
  52. char unused5 [ISODCL (1396, 2048)];
  53. };
  54. #define HS_STANDARD_ID "CDROM"
  55. struct hs_volume_descriptor {
  56. char foo [ISODCL ( 1, 8)]; /* 733 */
  57. char type [ISODCL ( 9, 9)]; /* 711 */
  58. char id [ISODCL ( 10, 14)];
  59. char version [ISODCL ( 15, 15)]; /* 711 */
  60. char data[ISODCL(16,2048)];
  61. };
  62. struct hs_primary_descriptor {
  63. char foo [ISODCL ( 1, 8)]; /* 733 */
  64. char type [ISODCL ( 9, 9)]; /* 711 */
  65. char id [ISODCL ( 10, 14)];
  66. char version [ISODCL ( 15, 15)]; /* 711 */
  67. char unused1 [ISODCL ( 16, 16)]; /* 711 */
  68. char system_id [ISODCL ( 17, 48)]; /* achars */
  69. char volume_id [ISODCL ( 49, 80)]; /* dchars */
  70. char unused2 [ISODCL ( 81, 88)]; /* 733 */
  71. char volume_space_size [ISODCL ( 89, 96)]; /* 733 */
  72. char unused3 [ISODCL ( 97, 128)]; /* 733 */
  73. char volume_set_size [ISODCL (129, 132)]; /* 723 */
  74. char volume_sequence_number [ISODCL (133, 136)]; /* 723 */
  75. char logical_block_size [ISODCL (137, 140)]; /* 723 */
  76. char path_table_size [ISODCL (141, 148)]; /* 733 */
  77. char type_l_path_table [ISODCL (149, 152)]; /* 731 */
  78. char unused4 [ISODCL (153, 180)]; /* 733 */
  79. char root_directory_record [ISODCL (181, 214)]; /* 9.1 */
  80. };
  81. /* We use this to help us look up the parent inode numbers. */
  82. struct iso_path_table{
  83. unsigned char name_len[2]; /* 721 */
  84. char extent[4]; /* 731 */
  85. char parent[2]; /* 721 */
  86. char name[0];
  87. };
  88. /* high sierra is identical to iso, except that the date is only 6 bytes, and
  89. there is an extra reserved byte after the flags */
  90. struct iso_directory_record {
  91. char length [ISODCL (1, 1)]; /* 711 */
  92. char ext_attr_length [ISODCL (2, 2)]; /* 711 */
  93. char extent [ISODCL (3, 10)]; /* 733 */
  94. char size [ISODCL (11, 18)]; /* 733 */
  95. char date [ISODCL (19, 25)]; /* 7 by 711 */
  96. char flags [ISODCL (26, 26)];
  97. char file_unit_size [ISODCL (27, 27)]; /* 711 */
  98. char interleave [ISODCL (28, 28)]; /* 711 */
  99. char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
  100. unsigned char name_len [ISODCL (33, 33)]; /* 711 */
  101. char name [0];
  102. };
  103. #define ISOFS_BLOCK_BITS 11
  104. #define ISOFS_BLOCK_SIZE 2048
  105. #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
  106. #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
  107. #if 0
  108. #ifdef ISOFS_FIXED_BLOCKSIZE
  109. /* We use these until the buffer cache supports 2048 */
  110. #define ISOFS_BUFFER_BITS 10
  111. #define ISOFS_BUFFER_SIZE 1024
  112. #define ISOFS_BLOCK_NUMBER(X) (X<<1)
  113. #else
  114. #define ISOFS_BUFFER_BITS 11
  115. #define ISOFS_BUFFER_SIZE 2048
  116. #define ISOFS_BLOCK_NUMBER(X) (X)
  117. #endif
  118. #endif
  119. #define ISOFS_SUPER_MAGIC 0x9660
  120. #define ISOFS_FILE_UNKNOWN 0
  121. #define ISOFS_FILE_TEXT 1
  122. #define ISOFS_FILE_BINARY 2
  123. #define ISOFS_FILE_TEXT_M 3
  124. struct isofs_super_block {
  125. unsigned long s_ninodes;
  126. unsigned long s_nzones;
  127. unsigned long s_firstdatazone;
  128. unsigned long s_log_zone_size;
  129. unsigned long s_max_size;
  130. unsigned char s_high_sierra; /* A simple flag */
  131. unsigned char s_mapping;
  132. unsigned char s_conversion;
  133. unsigned char s_rock;
  134. unsigned char s_cruft; /* Broken disks with high
  135. byte of length containing
  136. junk */
  137. unsigned int s_blocksize;
  138. unsigned int s_blocksize_bits;
  139. unsigned int s_mounted;
  140. unsigned char s_unhide;
  141. unsigned char s_nosuid;
  142. unsigned char s_nodev;
  143. mode_t s_mode;
  144. };
  145. /*
  146. * iso fs inode data in memory
  147. */
  148. struct iso_inode {
  149. unsigned int i_first_extent;
  150. unsigned int i_backlink;
  151. unsigned char i_file_format;
  152. };
  153. /* From fs/isofs/rock.h in Linux, (c) 1995, 1996 Eric Youngdale */
  154. /* These structs are used by the system-use-sharing protocol, in which the
  155. Rock Ridge extensions are embedded. It is quite possible that other
  156. extensions are present on the disk, and this is fine as long as they
  157. all use SUSP */
  158. struct SU_SP{
  159. unsigned char magic[2];
  160. unsigned char skip;
  161. };
  162. struct SU_CE{
  163. char extent[8];
  164. char offset[8];
  165. char size[8];
  166. };
  167. struct SU_ER{
  168. unsigned char len_id;
  169. unsigned char len_des;
  170. unsigned char len_src;
  171. unsigned char ext_ver;
  172. char data[0];
  173. };
  174. struct RR_RR{
  175. char flags[1];
  176. };
  177. struct RR_PX{
  178. char mode[8];
  179. char n_links[8];
  180. char uid[8];
  181. char gid[8];
  182. };
  183. struct RR_PN{
  184. char dev_high[8];
  185. char dev_low[8];
  186. };
  187. struct SL_component{
  188. unsigned char flags;
  189. unsigned char len;
  190. char text[0];
  191. };
  192. struct RR_SL{
  193. unsigned char flags;
  194. struct SL_component link;
  195. };
  196. struct RR_NM{
  197. unsigned char flags;
  198. char name[0];
  199. };
  200. struct RR_CL{
  201. char location[8];
  202. };
  203. struct RR_PL{
  204. char location[8];
  205. };
  206. struct stamp{
  207. char time[7];
  208. };
  209. struct RR_TF{
  210. char flags;
  211. struct stamp times[0]; /* Variable number of these beasts */
  212. };
  213. /* These are the bits and their meanings for flags in the TF structure. */
  214. #define TF_CREATE 1
  215. #define TF_MODIFY 2
  216. #define TF_ACCESS 4
  217. #define TF_ATTRIBUTES 8
  218. #define TF_BACKUP 16
  219. #define TF_EXPIRATION 32
  220. #define TF_EFFECTIVE 64
  221. #define TF_LONG_FORM 128
  222. struct rock_ridge{
  223. char signature[2];
  224. unsigned char len;
  225. unsigned char version;
  226. union{
  227. struct SU_SP SP;
  228. struct SU_CE CE;
  229. struct SU_ER ER;
  230. struct RR_RR RR;
  231. struct RR_PX PX;
  232. struct RR_PN PN;
  233. struct RR_SL SL;
  234. struct RR_NM NM;
  235. struct RR_CL CL;
  236. struct RR_PL PL;
  237. struct RR_TF TF;
  238. } u;
  239. };
  240. #define RR_PX 1 /* POSIX attributes */
  241. #define RR_PN 2 /* POSIX devices */
  242. #define RR_SL 4 /* Symbolic link */
  243. #define RR_NM 8 /* Alternate Name */
  244. #define RR_CL 16 /* Child link */
  245. #define RR_PL 32 /* Parent link */
  246. #define RR_RE 64 /* Relocation directory */
  247. #define RR_TF 128 /* Timestamps */
  248. #endif