File indexing completed on 2024-05-12 04:51:15
0001 /* From the linux kernel */ 0002 0003 #ifndef _ISO_FS_H 0004 #define _ISO_FS_H 1 0005 0006 #include "bswap.h" 0007 0008 /* 0009 * The isofs filesystem constants/structures 0010 */ 0011 0012 /* This part borrowed from the bsd386 isofs */ 0013 #define ISODCL(from, to) (to - from + 1) 0014 0015 struct iso_volume_descriptor { 0016 char type[ISODCL(1,1)]; /* 711 */ 0017 char id[ISODCL(2,6)]; 0018 char version[ISODCL(7,7)]; 0019 char data[ISODCL(8,2048)]; 0020 }; 0021 0022 /* volume descriptor types */ 0023 #define ISO_VD_BOOT 0 0024 #define ISO_VD_PRIMARY 1 0025 #define ISO_VD_SUPPLEMENTARY 2 0026 #define ISO_VD_END 255 0027 0028 #define ISO_STANDARD_ID "CD001" 0029 0030 struct iso_primary_descriptor { 0031 char type [ISODCL ( 1, 1)]; /* 711 */ 0032 char id [ISODCL ( 2, 6)]; 0033 char version [ISODCL ( 7, 7)]; /* 711 */ 0034 char unused1 [ISODCL ( 8, 8)]; 0035 char system_id [ISODCL ( 9, 40)]; /* achars */ 0036 char volume_id [ISODCL ( 41, 72)]; /* dchars */ 0037 char unused2 [ISODCL ( 73, 80)]; 0038 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 0039 char unused3 [ISODCL ( 89, 120)]; 0040 char volume_set_size [ISODCL (121, 124)]; /* 723 */ 0041 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 0042 char logical_block_size [ISODCL (129, 132)]; /* 723 */ 0043 char path_table_size [ISODCL (133, 140)]; /* 733 */ 0044 char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 0045 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 0046 char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 0047 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 0048 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 0049 char volume_set_id [ISODCL (191, 318)]; /* dchars */ 0050 char publisher_id [ISODCL (319, 446)]; /* achars */ 0051 char preparer_id [ISODCL (447, 574)]; /* achars */ 0052 char application_id [ISODCL (575, 702)]; /* achars */ 0053 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 0054 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 0055 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 0056 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 0057 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 0058 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 0059 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 0060 char file_structure_version [ISODCL (882, 882)]; /* 711 */ 0061 char unused4 [ISODCL (883, 883)]; 0062 char application_data [ISODCL (884, 1395)]; 0063 char unused5 [ISODCL (1396, 2048)]; 0064 }; 0065 0066 /* Almost the same as the primary descriptor but two fields are specified */ 0067 struct iso_supplementary_descriptor { 0068 char type [ISODCL ( 1, 1)]; /* 711 */ 0069 char id [ISODCL ( 2, 6)]; 0070 char version [ISODCL ( 7, 7)]; /* 711 */ 0071 char flags [ISODCL ( 8, 8)]; /* 853 */ 0072 char system_id [ISODCL ( 9, 40)]; /* achars */ 0073 char volume_id [ISODCL ( 41, 72)]; /* dchars */ 0074 char unused2 [ISODCL ( 73, 80)]; 0075 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 0076 char escape [ISODCL ( 89, 120)]; /* 856 */ 0077 char volume_set_size [ISODCL (121, 124)]; /* 723 */ 0078 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 0079 char logical_block_size [ISODCL (129, 132)]; /* 723 */ 0080 char path_table_size [ISODCL (133, 140)]; /* 733 */ 0081 char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 0082 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 0083 char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 0084 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 0085 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 0086 char volume_set_id [ISODCL (191, 318)]; /* dchars */ 0087 char publisher_id [ISODCL (319, 446)]; /* achars */ 0088 char preparer_id [ISODCL (447, 574)]; /* achars */ 0089 char application_id [ISODCL (575, 702)]; /* achars */ 0090 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 0091 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 0092 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 0093 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 0094 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 0095 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 0096 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 0097 char file_structure_version [ISODCL (882, 882)]; /* 711 */ 0098 char unused4 [ISODCL (883, 883)]; 0099 char application_data [ISODCL (884, 1395)]; 0100 char unused5 [ISODCL (1396, 2048)]; 0101 }; 0102 0103 #define HS_STANDARD_ID "CDROM" 0104 0105 struct hs_volume_descriptor { 0106 char foo [ISODCL ( 1, 8)]; /* 733 */ 0107 char type [ISODCL ( 9, 9)]; /* 711 */ 0108 char id [ISODCL ( 10, 14)]; 0109 char version [ISODCL ( 15, 15)]; /* 711 */ 0110 char data[ISODCL(16,2048)]; 0111 }; 0112 0113 0114 struct hs_primary_descriptor { 0115 char foo [ISODCL ( 1, 8)]; /* 733 */ 0116 char type [ISODCL ( 9, 9)]; /* 711 */ 0117 char id [ISODCL ( 10, 14)]; 0118 char version [ISODCL ( 15, 15)]; /* 711 */ 0119 char unused1 [ISODCL ( 16, 16)]; /* 711 */ 0120 char system_id [ISODCL ( 17, 48)]; /* achars */ 0121 char volume_id [ISODCL ( 49, 80)]; /* dchars */ 0122 char unused2 [ISODCL ( 81, 88)]; /* 733 */ 0123 char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ 0124 char unused3 [ISODCL ( 97, 128)]; /* 733 */ 0125 char volume_set_size [ISODCL (129, 132)]; /* 723 */ 0126 char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ 0127 char logical_block_size [ISODCL (137, 140)]; /* 723 */ 0128 char path_table_size [ISODCL (141, 148)]; /* 733 */ 0129 char type_l_path_table [ISODCL (149, 152)]; /* 731 */ 0130 char unused4 [ISODCL (153, 180)]; /* 733 */ 0131 char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ 0132 }; 0133 0134 /* We use this to help us look up the parent inode numbers. */ 0135 0136 struct iso_path_table{ 0137 char name_len[1]; /* 711 */ 0138 char ext_attr_length[1]; /* 711 */ 0139 char extent[4]; /* 731 */ 0140 char parent[2]; /* 721 */ 0141 char name[1]; 0142 }; 0143 0144 /* high sierra is identical to iso, except that the date is only 6 bytes, and 0145 there is an extra reserved byte after the flags */ 0146 0147 struct iso_directory_record { 0148 char length [ISODCL (1, 1)]; /* 711 */ 0149 char ext_attr_length [ISODCL (2, 2)]; /* 711 */ 0150 char extent [ISODCL (3, 10)]; /* 733 */ 0151 char size [ISODCL (11, 18)]; /* 733 */ 0152 char date [ISODCL (19, 25)]; /* 7 by 711 */ 0153 char flags [ISODCL (26, 26)]; 0154 char file_unit_size [ISODCL (27, 27)]; /* 711 */ 0155 char interleave [ISODCL (28, 28)]; /* 711 */ 0156 char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ 0157 char name_len [ISODCL (33, 33)]; /* 711 */ 0158 char name [1]; 0159 }; 0160 0161 /* 8 bit numbers */ 0162 __inline unsigned char isonum_711(char *p); 0163 __inline char isonum_712(char *p); 0164 0165 /* 16 bit numbers */ 0166 __inline unsigned short isonum_721(char *p); 0167 __inline unsigned short isonum_722(char *p); 0168 __inline unsigned short isonum_723(char *p); 0169 0170 /* 32 bit numbers */ 0171 __inline unsigned int isonum_731(char *p); 0172 __inline unsigned int isonum_732(char *p); 0173 __inline unsigned int isonum_733(char *p); 0174 0175 0176 /* 8 bit numbers */ 0177 __inline unsigned char isonum_711(char *p) 0178 { 0179 return *(unsigned char *)p; 0180 } 0181 __inline char isonum_712(char *p) 0182 { 0183 return *p; 0184 } 0185 0186 /* 16 bit numbers */ 0187 __inline unsigned short isonum_721(char *p) 0188 { 0189 return le2me_16(*(unsigned short *)p); 0190 } 0191 __inline unsigned short isonum_722(char *p) 0192 { 0193 return be2me_16(*(unsigned short *)p); 0194 } 0195 __inline unsigned short isonum_723(char *p) 0196 { 0197 /* Ignore bigendian datum due to broken mastering programs */ 0198 return le2me_16(*(unsigned short *)p); 0199 } 0200 0201 /* 32 bit numbers */ 0202 __inline unsigned int isonum_731(char *p) 0203 { 0204 return le2me_32(*(unsigned int *)p); 0205 } 0206 0207 __inline unsigned int isonum_732(char *p) 0208 { 0209 return be2me_32(*(unsigned int *)p); 0210 } 0211 0212 __inline unsigned int isonum_733(char *p) 0213 { 0214 /* Ignore bigendian datum due to broken mastering programs */ 0215 return le2me_32(*(unsigned int *)p); 0216 } 0217 0218 #endif /*_ISOFS_H*/ 0219