iso_fs.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #ifndef _ISOFS_FS_H
  2. #define _ISOFS_FS_H
  3. #include <linux/types.h>
  4. #include <linux/magic.h>
  5. /*
  6. * The isofs filesystem constants/structures
  7. */
  8. /* This part borrowed from the bsd386 isofs */
  9. #define ISODCL(from, to) (to - from + 1)
  10. struct iso_volume_descriptor {
  11. char type[ISODCL(1,1)]; /* 711 */
  12. char id[ISODCL(2,6)];
  13. char version[ISODCL(7,7)];
  14. char data[ISODCL(8,2048)];
  15. };
  16. /* volume descriptor types */
  17. #define ISO_VD_PRIMARY 1
  18. #define ISO_VD_SUPPLEMENTARY 2
  19. #define ISO_VD_END 255
  20. #define ISO_STANDARD_ID "CD001"
  21. struct iso_primary_descriptor {
  22. char type [ISODCL ( 1, 1)]; /* 711 */
  23. char id [ISODCL ( 2, 6)];
  24. char version [ISODCL ( 7, 7)]; /* 711 */
  25. char unused1 [ISODCL ( 8, 8)];
  26. char system_id [ISODCL ( 9, 40)]; /* achars */
  27. char volume_id [ISODCL ( 41, 72)]; /* dchars */
  28. char unused2 [ISODCL ( 73, 80)];
  29. char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
  30. char unused3 [ISODCL ( 89, 120)];
  31. char volume_set_size [ISODCL (121, 124)]; /* 723 */
  32. char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
  33. char logical_block_size [ISODCL (129, 132)]; /* 723 */
  34. char path_table_size [ISODCL (133, 140)]; /* 733 */
  35. char type_l_path_table [ISODCL (141, 144)]; /* 731 */
  36. char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
  37. char type_m_path_table [ISODCL (149, 152)]; /* 732 */
  38. char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
  39. char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
  40. char volume_set_id [ISODCL (191, 318)]; /* dchars */
  41. char publisher_id [ISODCL (319, 446)]; /* achars */
  42. char preparer_id [ISODCL (447, 574)]; /* achars */
  43. char application_id [ISODCL (575, 702)]; /* achars */
  44. char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
  45. char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
  46. char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
  47. char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
  48. char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
  49. char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
  50. char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
  51. char file_structure_version [ISODCL (882, 882)]; /* 711 */
  52. char unused4 [ISODCL (883, 883)];
  53. char application_data [ISODCL (884, 1395)];
  54. char unused5 [ISODCL (1396, 2048)];
  55. };
  56. /* Almost the same as the primary descriptor but two fields are specified */
  57. struct iso_supplementary_descriptor {
  58. char type [ISODCL ( 1, 1)]; /* 711 */
  59. char id [ISODCL ( 2, 6)];
  60. char version [ISODCL ( 7, 7)]; /* 711 */
  61. char flags [ISODCL ( 8, 8)]; /* 853 */
  62. char system_id [ISODCL ( 9, 40)]; /* achars */
  63. char volume_id [ISODCL ( 41, 72)]; /* dchars */
  64. char unused2 [ISODCL ( 73, 80)];
  65. char volume_space_size [ISODCL ( 81, 88)]; /* 733 */
  66. char escape [ISODCL ( 89, 120)]; /* 856 */
  67. char volume_set_size [ISODCL (121, 124)]; /* 723 */
  68. char volume_sequence_number [ISODCL (125, 128)]; /* 723 */
  69. char logical_block_size [ISODCL (129, 132)]; /* 723 */
  70. char path_table_size [ISODCL (133, 140)]; /* 733 */
  71. char type_l_path_table [ISODCL (141, 144)]; /* 731 */
  72. char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */
  73. char type_m_path_table [ISODCL (149, 152)]; /* 732 */
  74. char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */
  75. char root_directory_record [ISODCL (157, 190)]; /* 9.1 */
  76. char volume_set_id [ISODCL (191, 318)]; /* dchars */
  77. char publisher_id [ISODCL (319, 446)]; /* achars */
  78. char preparer_id [ISODCL (447, 574)]; /* achars */
  79. char application_id [ISODCL (575, 702)]; /* achars */
  80. char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */
  81. char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */
  82. char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */
  83. char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */
  84. char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */
  85. char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */
  86. char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */
  87. char file_structure_version [ISODCL (882, 882)]; /* 711 */
  88. char unused4 [ISODCL (883, 883)];
  89. char application_data [ISODCL (884, 1395)];
  90. char unused5 [ISODCL (1396, 2048)];
  91. };
  92. #define HS_STANDARD_ID "CDROM"
  93. struct hs_volume_descriptor {
  94. char foo [ISODCL ( 1, 8)]; /* 733 */
  95. char type [ISODCL ( 9, 9)]; /* 711 */
  96. char id [ISODCL ( 10, 14)];
  97. char version [ISODCL ( 15, 15)]; /* 711 */
  98. char data[ISODCL(16,2048)];
  99. };
  100. struct hs_primary_descriptor {
  101. char foo [ISODCL ( 1, 8)]; /* 733 */
  102. char type [ISODCL ( 9, 9)]; /* 711 */
  103. char id [ISODCL ( 10, 14)];
  104. char version [ISODCL ( 15, 15)]; /* 711 */
  105. char unused1 [ISODCL ( 16, 16)]; /* 711 */
  106. char system_id [ISODCL ( 17, 48)]; /* achars */
  107. char volume_id [ISODCL ( 49, 80)]; /* dchars */
  108. char unused2 [ISODCL ( 81, 88)]; /* 733 */
  109. char volume_space_size [ISODCL ( 89, 96)]; /* 733 */
  110. char unused3 [ISODCL ( 97, 128)]; /* 733 */
  111. char volume_set_size [ISODCL (129, 132)]; /* 723 */
  112. char volume_sequence_number [ISODCL (133, 136)]; /* 723 */
  113. char logical_block_size [ISODCL (137, 140)]; /* 723 */
  114. char path_table_size [ISODCL (141, 148)]; /* 733 */
  115. char type_l_path_table [ISODCL (149, 152)]; /* 731 */
  116. char unused4 [ISODCL (153, 180)]; /* 733 */
  117. char root_directory_record [ISODCL (181, 214)]; /* 9.1 */
  118. };
  119. /* We use this to help us look up the parent inode numbers. */
  120. struct iso_path_table{
  121. unsigned char name_len[2]; /* 721 */
  122. char extent[4]; /* 731 */
  123. char parent[2]; /* 721 */
  124. char name[0];
  125. } __attribute__((packed));
  126. /* high sierra is identical to iso, except that the date is only 6 bytes, and
  127. there is an extra reserved byte after the flags */
  128. struct iso_directory_record {
  129. char length [ISODCL (1, 1)]; /* 711 */
  130. char ext_attr_length [ISODCL (2, 2)]; /* 711 */
  131. char extent [ISODCL (3, 10)]; /* 733 */
  132. char size [ISODCL (11, 18)]; /* 733 */
  133. char date [ISODCL (19, 25)]; /* 7 by 711 */
  134. char flags [ISODCL (26, 26)];
  135. char file_unit_size [ISODCL (27, 27)]; /* 711 */
  136. char interleave [ISODCL (28, 28)]; /* 711 */
  137. char volume_sequence_number [ISODCL (29, 32)]; /* 723 */
  138. unsigned char name_len [ISODCL (33, 33)]; /* 711 */
  139. char name [0];
  140. } __attribute__((packed));
  141. #define ISOFS_BLOCK_BITS 11
  142. #define ISOFS_BLOCK_SIZE 2048
  143. #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize)
  144. #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits)
  145. #endif /* _ISOFS_FS_H */