1 /* @(#)udf_fs.h	1.6 13/02/12 Copyright 2001-2013 J. Schilling */
2 /*
3  * udf_fs.h - UDF structure definitions for mkisofs
4  *
5  * Written by Ben Rudiak-Gould (2001).
6  *
7  * Copyright 2001-2013 J. Schilling.
8  */
9 /*
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  * as published by the Free Software Foundation.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License along with
20  * this program; see the file COPYING.  If not, write to the Free Software
21  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22  */
23 
24 #ifndef	_UDF_FS_H
25 #define	_UDF_FS_H
26 
27 /*
28  * Abbreviations:
29  *
30  * ad		allocation descriptor
31  * desc		descriptor
32  * ext		extended
33  * ident	identifier
34  * impl		implementation
35  * info		information
36  * ptr		pointer
37  * seq		sequence
38  */
39 
40 typedef char udf_Uint8;
41 typedef char udf_dchar;
42 typedef char udf_dstring;
43 typedef char udf_byte;
44 typedef char udf_zerobyte;
45 
46 /* Is this safe? Are there compilers so perverse as to pad these structs? */
47 typedef struct udf_Uint16_ {
48 	char	l;
49 	char	h;
50 } udf_Uint16;
51 
52 typedef struct udf_Uint32_ {
53 	char	l;
54 	char	ml;
55 	char	mh;
56 	char	h;
57 } udf_Uint32;
58 typedef struct udf_Uint64_ {
59 	udf_Uint32	l;
60 	udf_Uint32	h;
61 } udf_Uint64;
62 
63 typedef struct udf_tag_ {			/* ECMA-167 3/7.2 */
64 /* 0*/	udf_Uint16	tag_ident;
65 /* 2*/	udf_Uint16	desc_version;
66 /* 4*/	udf_Uint8	tag_checksum;
67 /* 5*/	udf_zerobyte	reserved;
68 /* 6*/	udf_Uint16	tag_serial_number;
69 /* 8*/	udf_Uint16	desc_crc;
70 /*10*/	udf_Uint16	desc_crc_length;
71 /*12*/	udf_Uint32	tag_location;
72 /*16*/
73 } udf_tag;
74 
75 #define	UDF_TAGID_PRIMARY_VOLUME_DESC		1
76 #define	UDF_TAGID_ANCHOR_VOLUME_DESC_PTR	2
77 #define	UDF_TAGID_IMPL_USE_VOLUME_DESC		4
78 #define	UDF_TAGID_PARTITION_DESC		5
79 #define	UDF_TAGID_LOGICAL_VOLUME_DESC		6
80 #define	UDF_TAGID_UNALLOCATED_SPACE_DESC	7
81 #define	UDF_TAGID_TERMINATING_DESC		8
82 #define	UDF_TAGID_LOGICAL_VOLUME_INTEGRITY_DESC	9
83 #define	UDF_TAGID_FILE_SET_DESC			256
84 #define	UDF_TAGID_FILE_IDENT_DESC		257
85 #define	UDF_TAGID_FILE_ENTRY			261
86 #define	UDF_TAGID_EXT_ATTRIBUTE_HEADER_DESC	262
87 #define	UDF_TAGID_EXT_FILE_ENTRY		266
88 
89 typedef struct udf_extent_ad_ {			/* ECMA-167 3/7.1 */
90 /*0*/	udf_Uint32	extent_length;
91 /*4*/	udf_Uint32	extent_location;
92 /*8*/
93 } udf_extent_ad;
94 
95 typedef struct udf_charspec_ {			/* ECMA-167 1/7.2.1 */
96 /* 0*/	udf_Uint8	character_set_type;
97 /* 1*/	udf_byte	character_set_info[63];
98 /*64*/
99 } udf_charspec;
100 
101 typedef struct udf_EntityID_ {			/* ECMA-167 1/7.4 */
102 /* 0*/	udf_Uint8	flags;
103 /* 1*/	udf_byte	ident[23];
104 /*24*/	udf_byte	ident_suffix[8];
105 /*32*/
106 } udf_EntityID;
107 
108 #define	UDF_ENTITYID_FLAG_PROTECTED	2	/* ECMA-167 1/7.4.1 */
109 
110 typedef struct udf_lb_addr_ {			/* ECMA-167 4/7.1 */
111 /*0*/	udf_Uint32	logical_block_number;
112 /*4*/	udf_Uint16	partition_reference_number;
113 /*6*/
114 } udf_lb_addr;
115 
116 typedef struct udf_short_ad_ {			/* ECMA-167 4/14.14.1 */
117 /*0*/	udf_Uint32	extent_length;
118 /*4*/	udf_Uint32	extent_position;
119 /*8*/
120 } udf_short_ad;
121 
122 typedef struct udf_long_ad_impl_use_field_ {	/* UDF 2.01 2.3.4.3 */
123 /*0*/	udf_Uint16	flags;
124 /*2*/	udf_Uint32	unique_id;
125 /*6*/
126 } udf_long_ad_impl_use_field;
127 
128 typedef struct udf_long_ad_ {			/* ECMA-167 4/14.14.2 */
129 /* 0*/	udf_Uint32	extent_length;
130 /* 4*/	udf_lb_addr	extent_location;
131 /*10*/	udf_long_ad_impl_use_field	impl_use;
132 /*16*/
133 } udf_long_ad;
134 
135 typedef struct udf_timestamp_ {			/* TR/71 1.5.4 */
136 /* 0*/	udf_Uint16	type_and_time_zone;
137 /* 2*/	udf_Uint16	year;
138 /* 4*/	udf_Uint8	month;
139 /* 5*/	udf_Uint8	day;
140 /* 6*/	udf_Uint8	hour;
141 /* 7*/	udf_Uint8	minute;
142 /* 8*/	udf_Uint8	second;
143 /* 9*/	udf_Uint8	centiseconds;
144 /*10*/	udf_Uint8	hundreds_of_microseconds;
145 /*11*/	udf_Uint8	microseconds;
146 /*12*/
147 } udf_timestamp;
148 
149 typedef struct udf_volume_recognition_desc_ {	/* TR/71 2.4.{1,2,3} */
150 	udf_Uint8	structure_type;
151 	udf_byte	standard_identifier[5];
152 	udf_Uint8	structure_version;
153 	udf_zerobyte	structure_data[2041];
154 } udf_volume_recognition_desc;
155 
156 typedef struct udf_anchor_volume_desc_ptr_ {	/* TR/71 2.5.1 */
157 /*  0*/	udf_tag		desc_tag;
158 /* 16*/	udf_extent_ad	main_volume_desc_seq_extent;
159 /* 24*/	udf_extent_ad	reserve_volume_desc_seq_extent;
160 /* 32*/	udf_zerobyte	reserved[480];
161 /*512*/
162 } udf_anchor_volume_desc_ptr;
163 
164 typedef struct udf_primary_volume_desc_ {	/* TR/71 2.6.1 */
165 /*  0*/	udf_tag		desc_tag;
166 /* 16*/	udf_Uint32	volume_desc_seq_number;
167 /* 20*/	udf_Uint32	primary_volume_desc_number;
168 /* 24*/	udf_dstring	volume_ident[32];
169 /* 56*/	udf_Uint16	volume_seq_number;
170 /* 58*/	udf_Uint16	maximum_volume_seq_number;
171 /* 60*/	udf_Uint16	interchange_level;
172 /* 62*/	udf_Uint16	maximum_interchange_level;
173 /* 64*/	udf_Uint32	character_set_list;
174 /* 68*/	udf_Uint32	maximum_character_set_list;
175 /* 72*/	udf_dstring	volume_set_ident[128];
176 /*200*/	udf_charspec	desc_character_set;
177 /*264*/	udf_charspec	explanatory_character_set;
178 /*328*/	udf_extent_ad	volume_abstract;
179 /*336*/	udf_extent_ad	volume_copyright_notice;
180 /*344*/	udf_EntityID	application_ident;
181 /*376*/	udf_timestamp	recording_date_and_time;
182 /*388*/	udf_EntityID	impl_ident;
183 /*420*/	udf_byte	impl_use[64];
184 /*484*/	udf_Uint32	predecessor_volume_desc_seq_location;
185 /*488*/	udf_Uint16	flags;
186 /*490*/	udf_zerobyte	reserved[22];
187 /*512*/
188 } udf_primary_volume_desc;
189 
190 typedef struct udf_impl_use_volume_desc_impl_use_field_ {	/* TR/71 2.6.3 */
191 /*  0*/	udf_charspec	lvi_charset;
192 /* 64*/	udf_dstring	logical_volume_ident[128];
193 /*192*/	udf_dstring	lv_info1[36];
194 /*228*/	udf_dstring	lv_info2[36];
195 /*264*/	udf_dstring	lv_info3[36];
196 /*300*/	udf_EntityID	impl_id;
197 /*332*/	udf_byte	impl_use[128];
198 /*460*/
199 } udf_impl_use_volume_desc_impl_use_field;
200 
201 typedef struct udf_impl_use_volume_desc_ {	/* TR/71 2.6.2 */
202 /*  0*/	udf_tag		desc_tag;
203 /* 16*/	udf_Uint32	volume_desc_seq_number;
204 /* 20*/	udf_EntityID	impl_ident;
205 /* 52*/	udf_impl_use_volume_desc_impl_use_field	impl_use;
206 /*512*/
207 } udf_impl_use_volume_desc;
208 
209 typedef struct udf_partition_desc_ {		/* TR/71 2.6.4 */
210 /*  0*/	udf_tag		desc_tag;
211 /* 16*/	udf_Uint32	volume_desc_seq_number;
212 /* 20*/	udf_Uint16	partition_flags;
213 /* 22*/	udf_Uint16	partition_number;
214 /* 24*/	udf_EntityID	partition_contents;
215 /* 56*/	udf_byte	partition_contents_use[128];
216 /*184*/	udf_Uint32	access_type;
217 /*188*/	udf_Uint32	partition_starting_location;
218 /*192*/	udf_Uint32	partition_length;
219 /*196*/	udf_EntityID	impl_ident;
220 /*228*/	udf_byte	impl_use[128];
221 /*356*/	udf_zerobyte	reserved[156];
222 /*512*/
223 } udf_partition_desc;
224 
225 #define	UDF_PARTITION_FLAG_ALLOCATED	1	/* ECMA-167 3/10.5.3 */
226 #define	UDF_ACCESSTYPE_READONLY		1	/* ECMA-167 3/10.5.7 */
227 
228 typedef struct udf_type_1_partition_map_ {	/* TR/71 2.6.8 */
229 /*0*/	udf_Uint8	partition_map_type;
230 /*1*/	udf_Uint8	partition_map_length;
231 /*2*/	udf_Uint16	volume_seq_number;
232 /*4*/	udf_Uint16	partition_number;
233 /*6*/
234 } udf_type_1_partition_map;
235 
236 #define	UDF_PARTITION_MAP_TYPE_1	1
237 
238 typedef struct udf_logical_volume_desc_ {	/* TR/71 2.6.7 */
239 /*  0*/	udf_tag		desc_tag;
240 /* 16*/	udf_Uint32	volume_desc_seq_number;
241 /* 20*/	udf_charspec	desc_character_set;
242 /* 84*/	udf_dstring	logical_volume_ident[128];
243 /*212*/	udf_Uint32	logical_block_size;
244 /*216*/	udf_EntityID	domain_ident;
245 /*248*/	udf_long_ad	logical_volume_contents_use;
246 /*264*/	udf_Uint32	map_table_length;
247 /*268*/	udf_Uint32	number_of_partition_maps;
248 /*272*/	udf_EntityID	impl_ident;
249 /*304*/	udf_byte	impl_use[128];
250 /*432*/	udf_extent_ad	integrity_seq_extent;
251 /*440*/	udf_type_1_partition_map	partition_map[1];
252 /*446*/
253 } udf_logical_volume_desc;
254 
255 typedef struct udf_unallocated_space_desc_ {	/* TR/71 2.6.9 */
256 /* 0*/	udf_tag		desc_tag;
257 /*16*/	udf_Uint32	volume_desc_seq_number;
258 /*20*/	udf_Uint32	number_of_allocation_descs;
259 /*24*/	/*udf_extent_ad	allocation_descs[0];*/
260 } udf_unallocated_space_desc;
261 
262 typedef struct udf_terminating_desc_ {		/* TR/71 2.6.10 */
263 /*  0*/	udf_tag		desc_tag;
264 /* 16*/	udf_zerobyte	reserved[496];
265 /*512*/
266 } udf_terminating_desc;
267 
268 typedef struct udf_logical_volume_integrity_desc_impl_use_field_ {	/* TR/71 2.7.3 */
269 /* 0*/	udf_EntityID	impl_id;
270 /*32*/	udf_Uint32	number_of_files;
271 /*36*/	udf_Uint32	number_of_directories;
272 /*40*/	udf_Uint16	minimum_udf_read_revision;
273 /*42*/	udf_Uint16	minimum_udf_write_revision;
274 /*44*/	udf_Uint16	maximum_udf_write_revision;
275 /*46*/	/*udf_byte	impl_use[0];*/
276 } udf_logical_volume_integrity_desc_impl_use_field;
277 
278 typedef struct udf_logical_volume_integrity_desc_contents_use_field_ {	/* TR/71 2.7.2 */
279 	udf_Uint64	unique_id;
280 	udf_zerobyte	reserved[24];
281 } udf_logical_volume_integrity_desc_contents_use_field;
282 
283 typedef struct udf_logical_volume_integrity_desc_ {	/* TR/71 2.7.1 */
284 /* 0*/	udf_tag		desc_tag;
285 /*16*/	udf_timestamp	recording_date;
286 /*28*/	udf_Uint32	integrity_type;
287 /*32*/	udf_extent_ad	next_integrity_extent;
288 /*40*/	udf_logical_volume_integrity_desc_contents_use_field	logical_volume_contents_use;
289 /*72*/	udf_Uint32	number_of_partitions;
290 /*76*/	udf_Uint32	length_of_impl_use;
291 /*80*/	udf_Uint32	free_space_table;
292 /*84*/	udf_Uint32	size_table;
293 /*88*/	udf_logical_volume_integrity_desc_impl_use_field	impl_use;
294 } udf_logical_volume_integrity_desc;
295 
296 #define	UDF_INTEGRITY_TYPE_CLOSE	1	/* ECMA-167 3/10.10.3 */
297 
298 typedef struct udf_file_set_desc_ {		/* TR/71 3.3.1 */
299 /* 0*/	udf_tag		desc_tag;
300 /*16*/	udf_timestamp	recording_date_and_time;
301 /*28*/	udf_Uint16	interchange_level;
302 /*30*/	udf_Uint16	maximum_interchange_level;
303 /*32*/	udf_Uint32	character_set_list;
304 /*36*/	udf_Uint32	maximum_character_set_list;
305 /*40*/	udf_Uint32	file_set_number;
306 /*44*/	udf_Uint32	file_set_desc_number;
307 /*48*/	udf_charspec	logical_volume_ident_character_set;
308 /*112*/	udf_dstring	logical_volume_ident[128];
309 /*240*/	udf_charspec	file_set_character_set;
310 /*304*/	udf_dstring	file_set_ident[32];
311 /*336*/	udf_dstring	copyright_file_ident[32];
312 /*368*/	udf_dstring	abstract_file_ident[32];
313 /*400*/	udf_long_ad	root_directory_icb;
314 /*416*/	udf_EntityID	domain_ident;
315 /*448*/	udf_long_ad	next_extent;
316 /*464*/	udf_zerobyte	reserved[48];
317 /*512*/
318 } udf_file_set_desc;
319 
320 typedef struct udf_file_ident_desc_ {		/* TR/71 3.4.1 */
321 /* 0*/	udf_tag		desc_tag;
322 /*16*/	udf_Uint16	file_version_number;
323 /*18*/	udf_Uint8	file_characteristics;
324 /*19*/	udf_Uint8	length_of_file_ident;
325 /*20*/	udf_long_ad	icb;
326 /*36*/	udf_Uint16	length_of_impl_use;
327 /*38*/	/*udf_EntityID	impl_use;*/
328 /*38*/	udf_dchar	file_ident[1];
329 	/*udf_zerobyte	padding[0/1/2/3];*/
330 } udf_file_ident_desc;
331 
332 #define	UDF_FILE_CHARACTERISTIC_HIDDEN		1	/* ECMA-167 4/14.4.3 */
333 #define	UDF_FILE_CHARACTERISTIC_DIRECTORY	2
334 #define	UDF_FILE_CHARACTERISTIC_DELETED		4
335 #define	UDF_FILE_CHARACTERISTIC_PARENT		8
336 
337 typedef struct udf_icbtag_ {			/* TR/71 3.5.2 */
338 /* 0*/	udf_Uint32	prior_recorded_number_of_direct_entries;
339 /* 4*/	udf_Uint16	strategy_type;
340 /* 6*/	udf_Uint16	strategy_parameter;
341 /* 8*/	udf_Uint16	maximum_number_of_entries;
342 /*10*/	udf_zerobyte	reserved;
343 /*11*/	udf_Uint8	file_type;
344 /*12*/	udf_lb_addr	parent_icb_location;
345 /*18*/	udf_Uint16	flags;
346 /*20*/
347 } udf_icbtag;
348 
349 /*
350  * File types
351  */
352 #define	UDF_ICBTAG_FILETYPE_UNSPEC	0
353 #define	UDF_ICBTAG_FILETYPE_UNALL_SPACE	1
354 #define	UDF_ICBTAG_FILETYPE_PART_INTEG	2
355 #define	UDF_ICBTAG_FILETYPE_INDIRECT	3
356 #define	UDF_ICBTAG_FILETYPE_DIRECTORY	4	/* ECMA-167 4/14.6.6 */
357 #define	UDF_ICBTAG_FILETYPE_BYTESEQ	5	/* FILE */
358 #define	UDF_ICBTAG_FILETYPE_BLOCK_DEV	6
359 #define	UDF_ICBTAG_FILETYPE_CHAR_DEV	7
360 #define	UDF_ICBTAG_FILETYPE_EA		8	/* Extended attributes */
361 #define	UDF_ICBTAG_FILETYPE_FIFO	9
362 #define	UDF_ICBTAG_FILETYPE_C_ISSOCK	10
363 #define	UDF_ICBTAG_FILETYPE_T_ENTRY	11	/* Terminal entry */
364 #define	UDF_ICBTAG_FILETYPE_SYMLINK	12
365 #define	UDF_ICBTAG_FILETYPE_STREAMDIR	13
366 					/* 14..247	Reserved */
367 					/* 248..255	Subject to agreement */
368 
369 #define	UDF_ICBTAG_FLAG_MASK_AD_TYPE	7	/* TR/71 3.5.3 */
370 #define	UDF_ICBTAG_FLAG_SHORT_AD	0
371 #define	UDF_ICBTAG_FLAG_DIRECTORY_SORT	8
372 #define	UDF_ICBTAG_FLAG_NONRELOCATABLE	16
373 #define	UDF_ICBTAG_FLAG_ARCHIVE		32
374 #define	UDF_ICBTAG_FLAG_SETUID		64
375 #define	UDF_ICBTAG_FLAG_SETGID		128
376 #define	UDF_ICBTAG_FLAG_STICKY		256
377 #define	UDF_ICBTAG_FLAG_CONTIGUOUS	512
378 #define	UDF_ICBTAG_FLAG_SYSTEM		1024
379 #define	UDF_ICBTAG_FLAG_TRANSFORMED	2048
380 #define	UDF_ICBTAG_FLAG_MULTI_VERSIONS	4096
381 #define	UDF_ICBTAG_FLAG_STREAM	8192
382 
383 typedef struct udf_ext_attribute_header_desc_ {	/* TR/71 3.6.1 */
384 /* 0*/	udf_tag		desc_tag;
385 /*16*/	udf_Uint32	impl_attributes_location;
386 /*20*/	udf_Uint32	application_attributes_location;
387 /*24*/
388 } udf_ext_attribute_header_desc;
389 
390 typedef struct udf_ext_attribute_common_ {	/* TR/71 3.6.{2,3} */
391 /* 0*/	udf_Uint32	attribute_type;
392 /* 4*/	udf_Uint8	attribute_subtype;
393 /* 5*/	udf_zerobyte	reserved[3];
394 /* 8*/	udf_Uint32	attribute_length;
395 /*12*/	udf_Uint32	impl_use_length;
396 /*16*/	udf_EntityID	impl_ident;
397 /*48*/	udf_Uint16	header_checksum;
398 /*50*/
399 } udf_ext_attribute_common;
400 
401 typedef struct udf_ext_attribute_dev_spec_ {	/* ECMA-167 4/14.10.7 */
402 /* 0*/	udf_Uint32	attribute_type;		/* = 12 */
403 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
404 /* 5*/	udf_zerobyte	reserved[3];
405 /* 8*/	udf_Uint32	attribute_length;	/* = 24 */
406 /*12*/	udf_Uint32	impl_use_length;	/* = 0 */
407 /*16*/	udf_Uint32	dev_major;		/* major(st_rdev) */
408 /*20*/	udf_Uint32	dev_minor;		/* minor(st_rdev) */
409 #ifdef	__needed__
410 /*24*/	udf_Uint8	impl_use[0];
411 #endif
412 /*24*/
413 } udf_ext_attribute_dev_spec;
414 
415 typedef struct udf_ext_attribute_free_ea_space_ {	/* TR/71 3.6.{2,3} */
416 /* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
417 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
418 /* 5*/	udf_zerobyte	reserved[3];
419 /* 8*/	udf_Uint32	attribute_length;	/* = 52 */
420 /*12*/	udf_Uint32	impl_use_length;	/* = 4 */
421 /*16*/	udf_EntityID	impl_ident;		/* "*UDF FreeEASpace" */
422 /*48*/	udf_Uint16	header_checksum;
423 /*50*/	udf_Uint16	free_ea_space;		/* = 0 */
424 /*52*/
425 } udf_ext_attribute_free_ea_space;
426 
427 typedef struct udf_ext_attribute_dvd_cgms_info_ {	/* TR/71 3.6.{2,4} */
428 /* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
429 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
430 /* 5*/	udf_zerobyte	reserved[3];
431 /* 8*/	udf_Uint32	attribute_length;	/* = 56 */
432 /*12*/	udf_Uint32	impl_use_length;	/* = 8 */
433 /*16*/	udf_EntityID	impl_ident;		/* "*UDF DVD CGMS Info" */
434 /*48*/	udf_Uint16	header_checksum;
435 /*50*/	udf_byte	cgms_info;
436 /*51*/	udf_Uint8	data_structure_type;
437 /*52*/	udf_byte	protection_system_info[4];
438 /*56*/
439 } udf_ext_attribute_dvd_cgms_info;
440 
441 #define	UDF_CGMSINFO_NO_COPIES			48	/* TR/71 3.6.4 */
442 #define	UDF_CGMSINFO_ONE_GENERATION		32
443 #define	UDF_CGMSINFO_UNLIMITED_COPIES		0
444 #define	UDF_CGMSINFO_FLAG_COPYRIGHTED_MATERIAL	128
445 
446 
447 /* start mac finder info defs */
448 typedef struct udf_point_ {
449 	udf_Uint16	v;
450 	udf_Uint16	h;
451 } udf_point;
452 
453 typedef struct udf_rect_ {
454 	udf_Uint16	top;
455 	udf_Uint16	left;
456 	udf_Uint16	bottom;
457 	udf_Uint16	right;
458 } udf_rect;
459 
460 typedef struct udf_dinfo_ {
461 	udf_rect	frrect;
462 	udf_Uint16	frflags;
463 	udf_point	frlocation;
464 	udf_Uint16	frview;
465 } udf_dinfo;
466 
467 typedef struct udf_dxinfo_ {
468 	udf_point	frscroll;
469 	udf_Uint32	fropenchain;
470 	udf_Uint8	frscript;
471 	udf_Uint8	frxflags;
472 	udf_Uint16	frcomment;
473 	udf_Uint32	frputaway;
474 } udf_dxinfo;
475 
476 typedef struct udf_finfo_ {
477 	udf_Uint32	fdtype;
478 	udf_Uint32	fdcreator;
479 	udf_Uint16	fdflags;
480 	udf_point	fdlocation;
481 	udf_Uint16	fdfldr;
482 } udf_finfo;
483 
484 typedef struct udf_fxinfo_ {
485 	udf_Uint16	fdiconid;
486 	udf_Uint8	unused[6];
487 	udf_Uint8	fdscript;
488 	udf_Uint8	fdxflags;
489 	udf_Uint16	fdcomment;
490 	udf_Uint32	fdputaway;
491 } udf_fxinfo;
492 
493 typedef struct udf_mac_file_finderinfo_ {
494 /* 0*/	udf_Uint16	headerchecksum;
495 /* 2*/	udf_Uint16	reserved;
496 /* 4*/	udf_Uint32	parentdirid;
497 /* 8*/	udf_finfo	fileinfo;
498 /*24*/	udf_fxinfo	fileextinfo;
499 /*40*/	udf_Uint32	resourcedatalength;
500 /*44*/	udf_Uint32	resourcealloclength;
501 /*48*/
502 } udf_mac_file_finderinfo;
503 
504 typedef struct udf_mac_dir_volumeinfo_ {
505 /* 0*/	udf_Uint16	headerchecksum;
506 /* 2*/	udf_timestamp	moddate;
507 /* 14*/	udf_timestamp	budate;
508 /* 26*/	udf_Uint32	volfinderinfo[8];	/* ?? */
509 /* 58*/ udf_Uint8	unknown[2];	/* ?? */
510 /* 60 */
511 } udf_mac_dir_volumeinfo;
512 
513 
514 typedef struct udf_mac_dir_finderinfo_ {
515 /* 0*/	udf_Uint16	headerchecksum;
516 /* 2*/	udf_Uint16	reserved;
517 /* 4*/	udf_Uint32	parentdirid;
518 /* 8*/	udf_dinfo	dirinfo;
519 /*24*/	udf_dxinfo	dirextinfo;
520 /*40*/
521 } udf_mac_dir_finderinfo;
522 
523 typedef struct udf_ext_attribute_file_macfinderinfo_ {
524 /* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
525 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
526 /* 5*/	udf_zerobyte	reserved[3];
527 /* 8*/	udf_Uint32	attribute_length;	/* = 48 + 48 */
528 /*12*/	udf_Uint32	impl_use_length;	/* = 48 */
529 /*16*/	udf_EntityID	impl_ident;		/* "*UDF Mac FinderInfo" */
530 /*48*/	udf_mac_file_finderinfo	finderinfo;
531 /*96*/
532 } udf_ext_attribute_file_macfinderinfo;
533 
534 typedef struct udf_ext_attribute_dir_macvolinfo_ {
535 /* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
536 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
537 /* 5*/	udf_zerobyte	reserved[3];
538 /* 8*/	udf_Uint32	attribute_length;	/* = 48 + 60 */
539 /*12*/	udf_Uint32	impl_use_length;	/* = 60 */
540 /*16*/	udf_EntityID	impl_ident;		/* "*UDF Mac VolumeInfo" */
541 
542 /*48*/	udf_mac_dir_volumeinfo	volumeinfo;
543 /*96*/
544 } udf_ext_attribute_dir_macvolinfo;
545 
546 typedef struct udf_ext_attribute_dir_macfinderinfo_ {
547 /* 0*/	udf_Uint32	attribute_type;		/* = 2048 */
548 /* 4*/	udf_Uint8	attribute_subtype;	/* = 1 */
549 /* 5*/	udf_zerobyte	reserved[3];
550 /* 8*/	udf_Uint32	attribute_length;	/* = 48 + 40 */
551 /*12*/	udf_Uint32	impl_use_length;	/* = 40 */
552 /*16*/	udf_EntityID	impl_ident;		/* "*UDF Mac FinderInfo" */
553 /*48*/	udf_mac_dir_finderinfo	finderinfo;
554 /*96*/
555 } udf_ext_attribute_dir_macfinderinfo;
556 
557 #define	EXTATTR_IMP_USE 2048
558 /* end mac finder info defs */
559 
560 
561 typedef struct udf_macvolume_filed_entry_ {		/* TR/71 3.5.1 */
562 /* 0*/	udf_tag		desc_tag;
563 /*16*/	udf_icbtag	icb_tag;
564 /*36*/	udf_Uint32	uid;
565 /*40*/	udf_Uint32	gid;
566 /*44*/	udf_Uint32	permissions;
567 /*48*/	udf_Uint16	file_link_count;
568 /*50*/	udf_Uint8	record_format;
569 /*51*/	udf_Uint8	record_display_attributes;
570 /*52*/	udf_Uint32	record_length;
571 /*56*/	udf_Uint64	info_length;
572 /*64*/	udf_Uint64	logical_blocks_recorded;
573 /*72*/	udf_timestamp	access_time;
574 /*84*/	udf_timestamp	modification_time;
575 /*96*/	udf_timestamp	attribute_time;
576 /*108*/	udf_Uint32	checkpoint;
577 /*112*/	udf_long_ad	ext_attribute_icb;
578 /*128*/	udf_EntityID	impl_ident;
579 /*160*/	udf_Uint64	unique_id;
580 /*168*/	udf_Uint32	length_of_ext_attributes;
581 /*172*/	udf_Uint32	length_of_allocation_descs;
582 udf_ext_attribute_header_desc			ext_attribute_header;
583 udf_ext_attribute_free_ea_space			ext_attribute_free_ea_space;
584 udf_ext_attribute_dvd_cgms_info			ext_attribute_dvd_cgms_info;
585 udf_ext_attribute_dir_macvolinfo		ext_attribute_macvolumeinfo;
586 udf_ext_attribute_dir_macfinderinfo		ext_attribute_macfinderinfo;
587 udf_short_ad							allocation_desc;
588 } udf_macvolume_filed_entry;
589 
590 
591 typedef struct udf_file_entry_ {		/* TR/71 3.5.1 */
592 /* 0*/	udf_tag		desc_tag;
593 /*16*/	udf_icbtag	icb_tag;
594 /*36*/	udf_Uint32	uid;
595 /*40*/	udf_Uint32	gid;
596 /*44*/	udf_Uint32	permissions;
597 /*48*/	udf_Uint16	file_link_count;
598 /*50*/	udf_Uint8	record_format;
599 /*51*/	udf_Uint8	record_display_attributes;
600 /*52*/	udf_Uint32	record_length;
601 /*56*/	udf_Uint64	info_length;
602 /*64*/	udf_Uint64	logical_blocks_recorded;
603 /*72*/	udf_timestamp	access_time;
604 /*84*/	udf_timestamp	modification_time;
605 /*96*/	udf_timestamp	attribute_time;
606 /*108*/	udf_Uint32	checkpoint;
607 /*112*/	udf_long_ad	ext_attribute_icb;
608 /*128*/	udf_EntityID	impl_ident;
609 /*160*/	udf_Uint64	unique_id;
610 /*168*/	udf_Uint32	length_of_ext_attributes;
611 /*172*/	udf_Uint32	length_of_allocation_descs;
612 #if 0
613 /*176*/	udf_ext_attribute_header_desc	ext_attribute_header;
614 /*200*/	udf_ext_attribute_free_ea_space	ext_attribute_free_ea_space;
615 /*252*/	udf_ext_attribute_dvd_cgms_info	ext_attribute_dvd_cgms_info;
616 /*308*/	udf_short_ad	allocation_desc;
617 /*316*/
618 #else
619 	udf_ext_attribute_header_desc	ext_attribute_header;
620 	udf_ext_attribute_dev_spec	ext_attribute_dev_spec;
621 	udf_ext_attribute_free_ea_space	ext_attribute_free_ea_space;
622 	udf_ext_attribute_dvd_cgms_info	ext_attribute_dvd_cgms_info;
623 	udf_ext_attribute_file_macfinderinfo	ext_attribute_macfinderinfo;
624 	udf_short_ad	allocation_desc;
625 #endif
626 } udf_file_entry;
627 
628 typedef struct udf_attr_file_entry_ {		/* TR/71 3.5.1 */
629 /* 0*/	udf_tag		desc_tag;
630 /*16*/	udf_icbtag	icb_tag;
631 /*36*/	udf_Uint32	uid;
632 /*40*/	udf_Uint32	gid;
633 /*44*/	udf_Uint32	permissions;
634 /*48*/	udf_Uint16	file_link_count;
635 /*50*/	udf_Uint8	record_format;
636 /*51*/	udf_Uint8	record_display_attributes;
637 /*52*/	udf_Uint32	record_length;
638 /*56*/	udf_Uint64	info_length;
639 /*64*/	udf_Uint64	logical_blocks_recorded;
640 /*72*/	udf_timestamp	access_time;
641 /*84*/	udf_timestamp	modification_time;
642 /*96*/	udf_timestamp	attribute_time;
643 /*108*/	udf_Uint32	checkpoint;
644 /*112*/	udf_long_ad	ext_attribute_icb;
645 /*128*/	udf_EntityID	impl_ident;
646 /*160*/	udf_Uint64	unique_id;
647 /*168*/	udf_Uint32	length_of_ext_attributes;
648 /*172*/	udf_Uint32	length_of_allocation_descs;
649 #if 0
650 /*176*/	udf_ext_attribute_header_desc	ext_attribute_header;
651 /*200*/	udf_ext_attribute_free_ea_space	ext_attribute_free_ea_space;
652 /*252*/	udf_ext_attribute_dvd_cgms_info	ext_attribute_dvd_cgms_info;
653 /*308*/	udf_short_ad	allocation_desc;
654 /*316*/
655 #else
656 	udf_short_ad	allocation_desc;
657 #endif
658 } udf_attr_file_entry;
659 
660 typedef struct udf_filed_entry_ {		/* TR/71 3.5.1 */
661 /* 0*/	udf_tag		desc_tag;
662 /*16*/	udf_icbtag	icb_tag;
663 /*36*/	udf_Uint32	uid;
664 /*40*/	udf_Uint32	gid;
665 /*44*/	udf_Uint32	permissions;
666 /*48*/	udf_Uint16	file_link_count;
667 /*50*/	udf_Uint8	record_format;
668 /*51*/	udf_Uint8	record_display_attributes;
669 /*52*/	udf_Uint32	record_length;
670 /*56*/	udf_Uint64	info_length;
671 /*64*/	udf_Uint64	logical_blocks_recorded;
672 /*72*/	udf_timestamp	access_time;
673 /*84*/	udf_timestamp	modification_time;
674 /*96*/	udf_timestamp	attribute_time;
675 /*108*/	udf_Uint32	checkpoint;
676 /*112*/	udf_long_ad	ext_attribute_icb;
677 /*128*/	udf_EntityID	impl_ident;
678 /*160*/	udf_Uint64	unique_id;
679 /*168*/	udf_Uint32	length_of_ext_attributes;
680 /*172*/	udf_Uint32	length_of_allocation_descs;
681 #if 0
682 /*176*/	udf_ext_attribute_header_desc	ext_attribute_header;
683 /*200*/	udf_ext_attribute_free_ea_space	ext_attribute_free_ea_space;
684 /*252*/	udf_ext_attribute_dvd_cgms_info	ext_attribute_dvd_cgms_info;
685 /*308*/	udf_short_ad	allocation_desc;
686 /*316*/
687 #else
688 udf_ext_attribute_header_desc			ext_attribute_header;
689 udf_ext_attribute_free_ea_space			ext_attribute_free_ea_space;
690 udf_ext_attribute_dvd_cgms_info			ext_attribute_dvd_cgms_info;
691 udf_ext_attribute_dir_macfinderinfo		ext_attribute_macfinderinfo;
692 udf_short_ad							allocation_desc;
693 #endif
694 } udf_filed_entry;
695 
696 
697 typedef struct udf_ext_file_entry_ {		/* ECMA 167/3 4/50 */
698 /* 0*/	udf_tag		desc_tag;	/* 266 */
699 /*16*/	udf_icbtag	icb_tag;
700 /*36*/	udf_Uint32	uid;
701 /*40*/	udf_Uint32	gid;
702 /*44*/	udf_Uint32	permissions;
703 /*48*/	udf_Uint16	file_link_count;
704 /*50*/	udf_Uint8	record_format;
705 /*51*/	udf_Uint8	record_display_attributes;
706 /*52*/	udf_Uint32	record_length;
707 /*56*/	udf_Uint64	info_length;
708 /* */		udf_Uint64		object_size;
709 /*64+8*/	udf_Uint64		logical_blocks_recorded;
710 /*72*/		udf_timestamp	access_time;
711 /*84*/		udf_timestamp	modification_time;
712 /* */		udf_timestamp	creation_time;
713 /*96+12*/	udf_timestamp	attribute_time;
714 /*108*/		udf_Uint32		checkpoint;
715 /* */		udf_Uint32		reserved;
716 /*112+4*/	udf_long_ad		ext_attribute_icb;
717 /* */		udf_long_ad		stream_dir_icb;
718 /*128+16*/	udf_EntityID	impl_ident;
719 /*160*/		udf_Uint64		unique_id;
720 /*168*/		udf_Uint32		length_of_ext_attributes;
721 /*172*/		udf_Uint32		length_of_allocation_descs;
722 			udf_short_ad	allocation_desc;
723 } udf_ext_file_entry;
724 
725 
726 /*
727  * (U,G,O) = (owner, group, other)
728  * (X,R) = (execute, read)
729  *
730  * There are Write, Change Attribute and Delete permissions also,
731  * but it is not permitted to set them on DVD Read-Only media.
732  */
733 #define	UDF_FILEENTRY_PERMISSION_OX	1	/* TR/71 3.5.4 */
734 #define	UDF_FILEENTRY_PERMISSION_OW	2
735 #define	UDF_FILEENTRY_PERMISSION_OR	4
736 #define	UDF_FILEENTRY_PERMISSION_GX	32
737 #define	UDF_FILEENTRY_PERMISSION_GW	64
738 #define	UDF_FILEENTRY_PERMISSION_GR	128
739 #define	UDF_FILEENTRY_PERMISSION_UX	1024
740 #define	UDF_FILEENTRY_PERMISSION_UW	2048
741 #define	UDF_FILEENTRY_PERMISSION_UR	4096
742 
743 
744 #endif	/* _UDF_FS_H */
745