iso_fs.h 6.3 KB

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