1 #ifndef UAE_ISOFS_H 2 #define UAE_ISOFS_H 3 4 #ifdef FSUAE 5 #include "config.h" 6 #endif 7 #include "uae/types.h" 8 9 typedef int isofs_gid_t; 10 typedef int isofs_uid_t; 11 typedef int isofs_mode_t; 12 typedef uae_s64 isofs_off_t; 13 14 #define ISO_SYSTEM_ID_CDTV "CDTV" 15 16 /* 17 * The isofs filesystem constants/structures 18 */ 19 20 /* This part borrowed from the bsd386 isofs */ 21 #define ISODCL(from, to) (to - from + 1) 22 23 struct iso_volume_descriptor { 24 char type[ISODCL(1,1)]; /* 711 */ 25 char id[ISODCL(2,6)]; 26 char version[ISODCL(7,7)]; 27 char data[ISODCL(8,2048)]; 28 }; 29 30 /* volume descriptor types */ 31 #define ISO_VD_PRIMARY 1 32 #define ISO_VD_SUPPLEMENTARY 2 33 #define ISO_VD_END 255 34 35 #define ISO_STANDARD_ID "CD001" 36 37 struct iso_primary_descriptor { 38 char type [ISODCL ( 1, 1)]; /* 711 */ 39 char id [ISODCL ( 2, 6)]; 40 char version [ISODCL ( 7, 7)]; /* 711 */ 41 char unused1 [ISODCL ( 8, 8)]; 42 char system_id [ISODCL ( 9, 40)]; /* achars */ 43 char volume_id [ISODCL ( 41, 72)]; /* dchars */ 44 char unused2 [ISODCL ( 73, 80)]; 45 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 46 char unused3 [ISODCL ( 89, 120)]; 47 char volume_set_size [ISODCL (121, 124)]; /* 723 */ 48 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 49 char logical_block_size [ISODCL (129, 132)]; /* 723 */ 50 char path_table_size [ISODCL (133, 140)]; /* 733 */ 51 char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 52 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 53 char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 54 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 55 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 56 char volume_set_id [ISODCL (191, 318)]; /* dchars */ 57 char publisher_id [ISODCL (319, 446)]; /* achars */ 58 char preparer_id [ISODCL (447, 574)]; /* achars */ 59 char application_id [ISODCL (575, 702)]; /* achars */ 60 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 61 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 62 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 63 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 64 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 65 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 66 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 67 char file_structure_version [ISODCL (882, 882)]; /* 711 */ 68 char unused4 [ISODCL (883, 883)]; 69 char application_data [ISODCL (884, 1395)]; 70 char unused5 [ISODCL (1396, 2048)]; 71 }; 72 73 /* Almost the same as the primary descriptor but two fields are specified */ 74 struct iso_supplementary_descriptor { 75 char type [ISODCL ( 1, 1)]; /* 711 */ 76 char id [ISODCL ( 2, 6)]; 77 char version [ISODCL ( 7, 7)]; /* 711 */ 78 char flags [ISODCL ( 8, 8)]; /* 853 */ 79 char system_id [ISODCL ( 9, 40)]; /* achars */ 80 char volume_id [ISODCL ( 41, 72)]; /* dchars */ 81 char unused2 [ISODCL ( 73, 80)]; 82 char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 83 char escape [ISODCL ( 89, 120)]; /* 856 */ 84 char volume_set_size [ISODCL (121, 124)]; /* 723 */ 85 char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 86 char logical_block_size [ISODCL (129, 132)]; /* 723 */ 87 char path_table_size [ISODCL (133, 140)]; /* 733 */ 88 char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 89 char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 90 char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 91 char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 92 char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 93 char volume_set_id [ISODCL (191, 318)]; /* dchars */ 94 char publisher_id [ISODCL (319, 446)]; /* achars */ 95 char preparer_id [ISODCL (447, 574)]; /* achars */ 96 char application_id [ISODCL (575, 702)]; /* achars */ 97 char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 98 char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 99 char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 100 char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 101 char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 102 char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 103 char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 104 char file_structure_version [ISODCL (882, 882)]; /* 711 */ 105 char unused4 [ISODCL (883, 883)]; 106 char application_data [ISODCL (884, 1395)]; 107 char unused5 [ISODCL (1396, 2048)]; 108 }; 109 110 111 #define HS_STANDARD_ID "CDROM" 112 113 struct hs_volume_descriptor { 114 char foo [ISODCL ( 1, 8)]; /* 733 */ 115 char type [ISODCL ( 9, 9)]; /* 711 */ 116 char id [ISODCL ( 10, 14)]; 117 char version [ISODCL ( 15, 15)]; /* 711 */ 118 char data[ISODCL(16,2048)]; 119 }; 120 121 122 struct hs_primary_descriptor { 123 char foo [ISODCL ( 1, 8)]; /* 733 */ 124 char type [ISODCL ( 9, 9)]; /* 711 */ 125 char id [ISODCL ( 10, 14)]; 126 char version [ISODCL ( 15, 15)]; /* 711 */ 127 char unused1 [ISODCL ( 16, 16)]; /* 711 */ 128 char system_id [ISODCL ( 17, 48)]; /* achars */ 129 char volume_id [ISODCL ( 49, 80)]; /* dchars */ 130 char unused2 [ISODCL ( 81, 88)]; /* 733 */ 131 char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ 132 char unused3 [ISODCL ( 97, 128)]; /* 733 */ 133 char volume_set_size [ISODCL (129, 132)]; /* 723 */ 134 char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ 135 char logical_block_size [ISODCL (137, 140)]; /* 723 */ 136 char path_table_size [ISODCL (141, 148)]; /* 733 */ 137 char type_l_path_table [ISODCL (149, 152)]; /* 731 */ 138 char unused4 [ISODCL (153, 180)]; /* 733 */ 139 char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ 140 }; 141 142 /* We use this to help us look up the parent inode numbers. */ 143 # pragma pack (1) 144 struct iso_path_table{ 145 unsigned char name_len[2]; /* 721 */ 146 char extent[4]; /* 731 */ 147 char parent[2]; /* 721 */ 148 char name[0]; 149 }; 150 # pragma pack () 151 152 /* high sierra is identical to iso, except that the date is only 6 bytes, and 153 there is an extra reserved byte after the flags */ 154 155 # pragma pack (1) 156 struct iso_directory_record { 157 char length [ISODCL (1, 1)]; /* 711 */ 158 char ext_attr_length [ISODCL (2, 2)]; /* 711 */ 159 char extent [ISODCL (3, 10)]; /* 733 */ 160 char size [ISODCL (11, 18)]; /* 733 */ 161 char date [ISODCL (19, 25)]; /* 7 by 711 */ 162 char flags [ISODCL (26, 26)]; 163 char file_unit_size [ISODCL (27, 27)]; /* 711 */ 164 char interleave [ISODCL (28, 28)]; /* 711 */ 165 char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ 166 unsigned char name_len [ISODCL (33, 33)]; /* 711 */ 167 char name [0]; 168 }; 169 # pragma pack () 170 171 #define ISOFS_BLOCK_BITS 0 172 #define ISOFS_BLOCK_SIZE 2048 173 174 #define ISOFS_BUFFER_SIZE(INODE) ((INODE)->i_sb->s_blocksize) 175 #define ISOFS_BUFFER_BITS(INODE) ((INODE)->i_sb->s_blocksize_bits) 176 177 enum isofs_file_format { 178 isofs_file_normal = 0, 179 isofs_file_sparse = 1, 180 isofs_file_compressed = 2, 181 }; 182 183 /* 184 * iso fs inode data in memory 185 */ 186 struct iso_inode_info { 187 unsigned long i_iget5_block; 188 unsigned long i_iget5_offset; 189 unsigned int i_first_extent; 190 unsigned char i_file_format; 191 unsigned char i_format_parm[3]; 192 unsigned long i_next_section_block; 193 unsigned long i_next_section_offset; 194 isofs_off_t i_section_size; 195 //struct inode vfs_inode; 196 }; 197 198 /* 199 * iso9660 super-block data in memory 200 */ 201 struct isofs_sb_info { 202 unsigned long s_ninodes; 203 unsigned long s_nzones; 204 unsigned long s_firstdatazone; 205 unsigned long s_log_zone_size; 206 unsigned long s_max_size; 207 208 int s_rock_offset; /* offset of SUSP fields within SU area */ 209 unsigned char s_joliet_level; 210 unsigned char s_mapping; 211 unsigned int s_high_sierra:1; 212 unsigned int s_rock:2; 213 unsigned int s_utf8:1; 214 unsigned int s_cruft:1; /* Broken disks with high byte of length 215 * containing junk */ 216 unsigned int s_nocompress:1; 217 unsigned int s_hide:1; 218 unsigned int s_showassoc:1; 219 unsigned int s_overriderockperm:1; 220 unsigned int s_uid_set:1; 221 unsigned int s_gid_set:1; 222 223 isofs_mode_t s_fmode; 224 isofs_mode_t s_dmode; 225 isofs_gid_t s_gid; 226 isofs_uid_t s_uid; 227 //struct nls_table *s_nls_iocharset; /* Native language support table */ 228 unsigned int s_cdtv:1; 229 }; 230 231 232 struct iso9660_options{ 233 unsigned int rock:1; 234 unsigned int joliet:1; 235 unsigned int cruft:1; 236 unsigned int hide:1; 237 unsigned int showassoc:1; 238 unsigned int nocompress:1; 239 unsigned int overriderockperm:1; 240 unsigned int uid_set:1; 241 unsigned int gid_set:1; 242 unsigned int utf8:1; 243 unsigned char map; 244 unsigned char check; 245 unsigned int blocksize; 246 isofs_mode_t fmode; 247 isofs_mode_t dmode; 248 isofs_gid_t gid; 249 isofs_uid_t uid; 250 char *iocharset; 251 /* LVE */ 252 uae_s32 session; 253 uae_s32 sbsector; 254 }; 255 256 257 /* 258 * These structs are used by the system-use-sharing protocol, in which the 259 * Rock Ridge extensions are embedded. It is quite possible that other 260 * extensions are present on the disk, and this is fine as long as they 261 * all use SUSP 262 */ 263 264 # pragma pack (1) 265 266 struct SU_SP_s { 267 unsigned char magic[2]; 268 unsigned char skip; 269 }; 270 271 struct SU_CE_s { 272 char extent[8]; 273 char offset[8]; 274 char size[8]; 275 }; 276 277 struct SU_ER_s { 278 unsigned char len_id; 279 unsigned char len_des; 280 unsigned char len_src; 281 unsigned char ext_ver; 282 char data[1]; 283 }; 284 285 struct RR_RR_s { 286 char flags[1]; 287 }; 288 289 struct RR_PX_s { 290 char mode[8]; 291 char n_links[8]; 292 char uid[8]; 293 char gid[8]; 294 }; 295 296 struct RR_PN_s { 297 char dev_high[8]; 298 char dev_low[8]; 299 }; 300 301 struct SL_component { 302 unsigned char flags; 303 unsigned char len; 304 char text[1]; 305 }; 306 307 struct RR_SL_s { 308 unsigned char flags; 309 struct SL_component link; 310 }; 311 312 struct RR_NM_s { 313 unsigned char flags; 314 char name[1]; 315 }; 316 317 struct RR_CL_s { 318 char location[8]; 319 }; 320 321 struct RR_PL_s { 322 char location[8]; 323 }; 324 325 struct stamp { 326 char time[7]; 327 }; 328 329 struct RR_TF_s { 330 char flags; 331 struct stamp times[1]; /* Variable number of these beasts */ 332 }; 333 334 /* Linux-specific extension for transparent decompression */ 335 struct RR_ZF_s { 336 char algorithm[2]; 337 char parms[2]; 338 char real_size[8]; 339 }; 340 341 /* Amiga RR extension */ 342 struct RR_AS_s { 343 char flags; 344 char data[1]; 345 }; 346 /* 347 * These are the bits and their meanings for flags in the TF structure. 348 */ 349 #define TF_CREATE 1 350 #define TF_MODIFY 2 351 #define TF_ACCESS 4 352 #define TF_ATTRIBUTES 8 353 #define TF_BACKUP 16 354 #define TF_EXPIRATION 32 355 #define TF_EFFECTIVE 64 356 #define TF_LONG_FORM 128 357 358 struct rock_ridge { 359 char signature[2]; 360 unsigned char len; 361 unsigned char version; 362 union { 363 struct SU_SP_s SP; 364 struct SU_CE_s CE; 365 struct SU_ER_s ER; 366 struct RR_RR_s RR; 367 struct RR_PX_s PX; 368 struct RR_PN_s PN; 369 struct RR_SL_s SL; 370 struct RR_NM_s NM; 371 struct RR_CL_s CL; 372 struct RR_PL_s PL; 373 struct RR_TF_s TF; 374 struct RR_ZF_s ZF; 375 struct RR_AS_s AS; 376 } u; 377 }; 378 379 #define RR_PX 1 /* POSIX attributes */ 380 #define RR_PN 2 /* POSIX devices */ 381 #define RR_SL 4 /* Symbolic link */ 382 #define RR_NM 8 /* Alternate Name */ 383 #define RR_CL 16 /* Child link */ 384 #define RR_PL 32 /* Parent link */ 385 #define RR_RE 64 /* Relocation directory */ 386 #define RR_TF 128 /* Timestamps */ 387 388 # pragma pack () 389 390 #endif /* UAE_ISOFS_H */ 391