iso_fs.h 6.3 KB

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