ecma167-udf.h revision 1.3 1 /* $NetBSD: ecma167-udf.h,v 1.3 2006/08/25 17:43:51 reinoud Exp $ */
2
3 /*-
4 * Copyright (c) 2003, 2004, 2005, 2006 Reinoud Zandijk <reinoud (at) netbsd.org>
5 * Copyright (c) 2001, 2002 Scott Long <scottl (at) freebsd.org>
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 *
30 * Extended and adapted for UDFv2.50+ bij Reinoud Zandijk based on the
31 * origional by Scott Long.
32 *
33 * 20030508 Made some small typo and explainatory comments
34 * 20030510 Added UDF 2.01 structures
35 * 20030519 Added/correct comments on multi-partitioned logical volume space
36 * 20050616 Added pseudo overwrite
37 * 20050624 Added the missing extended attribute types and `magic values'.
38 * 20051106 Reworked some implementation use parts
39 *
40 */
41
42
43 #ifndef _FS_UDF_ECMA167_UDF_H_
44 #define _FS_UDF_ECMA167_UDF_H_
45
46
47 /*
48 * in case of an older gcc versions, define the __packed as explicit
49 * attribute
50 */
51
52 /*
53 * You may specify the `aligned' and `transparent_union' attributes either in
54 * a `typedef' declaration or just past the closing curly brace of a complete
55 * enum, struct or union type _definition_ and the `packed' attribute only
56 * past the closing brace of a definition. You may also specify attributes
57 * between the enum, struct or union tag and the name of the type rather than
58 * after the closing brace.
59 */
60
61 #ifndef __packed
62 #define __packed __attribute__((packed))
63 #endif
64
65
66 /* ecma167-udf.h */
67
68 /* Volume recognition sequence ECMA 167 rev. 3 16.1 */
69 struct vrs_desc {
70 uint8_t struct_type;
71 uint8_t identifier[5];
72 uint8_t version;
73 uint8_t data[2041];
74 } __packed;
75
76
77 #define VRS_NSR02 "NSR02"
78 #define VRS_NSR03 "NSR03"
79 #define VRS_BEA01 "BEA01"
80 #define VRS_TEA01 "TEA01"
81 #define VRS_CD001 "CD001"
82 #define VRS_CDW02 "CDW02"
83
84
85 /* Structure/definitions/constants a la ECMA 167 rev. 3 */
86
87
88 #define MAX_TAGID_VOLUMES 9
89 /* Tag identifiers */
90 enum {
91 TAGID_SPARING_TABLE = 0,
92 TAGID_PRI_VOL = 1,
93 TAGID_ANCHOR = 2,
94 TAGID_VOL = 3,
95 TAGID_IMP_VOL = 4,
96 TAGID_PARTITION = 5,
97 TAGID_LOGVOL = 6,
98 TAGID_UNALLOC_SPACE = 7,
99 TAGID_TERM = 8,
100 TAGID_LOGVOL_INTEGRITY= 9,
101 TAGID_FSD = 256,
102 TAGID_FID = 257,
103 TAGID_ALLOCEXTENT = 258,
104 TAGID_INDIRECT_ENTRY = 259,
105 TAGID_ICB_TERM = 260,
106 TAGID_FENTRY = 261,
107 TAGID_EXTATTR_HDR = 262,
108 TAGID_UNALL_SP_ENTRY = 263,
109 TAGID_SPACE_BITMAP = 264,
110 TAGID_PART_INTEGRETY = 265,
111 TAGID_EXTFENTRY = 266,
112 TAGID_MAX = 266
113 };
114
115
116 enum {
117 UDF_DOMAIN_FLAG_HARD_WRITE_PROTECT = 1,
118 UDF_DOMAIN_FLAG_SOFT_WRITE_PROTECT = 2
119 };
120
121
122 enum {
123 UDF_ACCESSTYPE_NOT_SPECIFIED = 0, /* unknown */
124 UDF_ACCESSTYPE_PSEUDO_OVERWITE = 0, /* Pseudo overwritable, f.e. BD-R's LOW */
125 UDF_ACCESSTYPE_READ_ONLY = 1, /* really only readable */
126 UDF_ACCESSTYPE_WRITE_ONCE = 2, /* write once and you're done */
127 UDF_ACCESSTYPE_REWRITEABLE = 3, /* may need extra work to rewrite */
128 UDF_ACCESSTYPE_OVERWRITABLE = 4 /* no limits on rewriting; harddisc f.e.*/
129 };
130
131
132 /* Descriptor tag [3/7.2] */
133 struct desc_tag {
134 uint16_t id;
135 uint16_t descriptor_ver;
136 uint8_t cksum;
137 uint8_t reserved;
138 uint16_t serial_num;
139 uint16_t desc_crc;
140 uint16_t desc_crc_len;
141 uint32_t tag_loc;
142 } __packed;
143 #define UDF_DESC_TAG_LENGTH 16
144
145
146 /* Recorded Address [4/7.1] */
147 struct lb_addr { /* within partition space */
148 uint32_t lb_num;
149 uint16_t part_num;
150 } __packed;
151
152
153 /* Extent Descriptor [3/7.1] */
154 struct extent_ad {
155 uint32_t len;
156 uint32_t loc;
157 } __packed;
158
159
160 /* Short Allocation Descriptor [4/14.14.1] */
161 struct short_ad {
162 uint32_t len;
163 uint32_t lb_num;
164 } __packed;
165
166
167 /* Long Allocation Descriptor [4/14.14.2] */
168 struct UDF_ADImp_use {
169 uint16_t flags;
170 uint32_t unique_id;
171 } __packed;
172 #define UDF_ADIMP_FLAGS_EXTENT_ERASED 1
173
174
175 struct long_ad {
176 uint32_t len;
177 struct lb_addr loc; /* within a logical volume mapped partition space !! */
178 union {
179 uint8_t bytes[6];
180 struct UDF_ADImp_use im_used;
181 } __packed impl;
182 } __packed;
183
184
185 /* Extended Allocation Descriptor [4/14.14.3] ; identifies an extent of allocation descriptors ; also in UDF ? */
186 struct ext_ad {
187 uint32_t ex_len;
188 uint32_t rec_len;
189 uint32_t inf_len;
190 struct lb_addr ex_loc;
191 uint8_t reserved[2];
192 } __packed;
193
194
195 /* ICB : Information Control Block; positioning */
196 union icb {
197 struct short_ad s_ad;
198 struct long_ad l_ad;
199 struct ext_ad e_ad;
200 } __packed;
201
202
203 /* short/long/ext extent have flags encoded in length */
204 #define UDF_EXT_ALLOCATED (0<<30)
205 #define UDF_EXT_FREED (1<<30)
206 #define UDF_EXT_ALLOCATED_BUT_NOT_USED (1<<30)
207 #define UDF_EXT_FREE (2<<30)
208 #define UDF_EXT_REDIRECT (3<<30)
209 #define UDF_EXT_FLAGS(len) ((len) & (3<<30))
210 #define UDF_EXT_LEN(len) ((len) & ((1<<30)-1))
211
212
213 /* Character set spec [1/7.2.1] */
214 struct charspec {
215 uint8_t type;
216 uint8_t inf[63];
217 } __packed;
218
219
220 /* Timestamp [1/7.3] */
221 struct timestamp {
222 uint16_t type_tz;
223 uint16_t year;
224 uint8_t month;
225 uint8_t day;
226 uint8_t hour;
227 uint8_t minute;
228 uint8_t second;
229 uint8_t centisec;
230 uint8_t hund_usec;
231 uint8_t usec;
232 } __packed;
233
234
235 /* Entity Identifier [1/7.4] */
236 #define UDF_REGID_ID_SIZE 23
237 struct regid {
238 uint8_t flags;
239 uint8_t id[UDF_REGID_ID_SIZE];
240 uint8_t id_suffix[8];
241 } __packed;
242
243
244 /* ICB Tag [4/14.6] */
245 struct icb_tag {
246 uint32_t prev_num_dirs;
247 uint16_t strat_type;
248 uint8_t strat_param[2];
249 uint16_t max_num_entries;
250 uint8_t reserved;
251 uint8_t file_type;
252 struct lb_addr parent_icb;
253 uint16_t flags;
254 } __packed;
255 #define UDF_ICB_TAG_FLAGS_ALLOC_MASK 0x03
256 #define UDF_ICB_SHORT_ALLOC 0x00
257 #define UDF_ICB_LONG_ALLOC 0x01
258 #define UDF_ICB_EXT_ALLOC 0x02
259 #define UDF_ICB_INTERN_ALLOC 0x03
260
261 #define UDF_ICB_TAG_FLAGS_DIRORDERED (1<< 3)
262 #define UDF_ICB_TAG_FLAGS_NONRELOC (1<< 4)
263 #define UDF_ICB_TAG_FLAGS_CONTIGUES (1<< 9)
264 #define UDF_ICB_TAG_FLAGS_MULTIPLEVERS (1<<12)
265
266 #define UDF_ICB_TAG_FLAGS_SETUID (1<< 6)
267 #define UDF_ICB_TAG_FLAGS_SETGID (1<< 7)
268 #define UDF_ICB_TAG_FLAGS_STICKY (1<< 8)
269
270 #define UDF_ICB_FILETYPE_UNKNOWN 0
271 #define UDF_ICB_FILETYPE_UNALLOCSPACE 1
272 #define UDF_ICB_FILETYPE_PARTINTEGRITY 2
273 #define UDF_ICB_FILETYPE_INDIRECTENTRY 3
274 #define UDF_ICB_FILETYPE_DIRECTORY 4
275 #define UDF_ICB_FILETYPE_RANDOMACCESS 5
276 #define UDF_ICB_FILETYPE_BLOCKDEVICE 6
277 #define UDF_ICB_FILETYPE_CHARDEVICE 7
278 #define UDF_ICB_FILETYPE_EXTATTRREC 8
279 #define UDF_ICB_FILETYPE_FIFO 9
280 #define UDF_ICB_FILETYPE_SOCKET 10
281 #define UDF_ICB_FILETYPE_TERM 11
282 #define UDF_ICB_FILETYPE_SYMLINK 12
283 #define UDF_ICB_FILETYPE_STREAMDIR 13
284 #define UDF_ICB_FILETYPE_VAT 248
285 #define UDF_ICB_FILETYPE_META_MAIN 250
286 #define UDF_ICB_FILETYPE_META_MIRROR 251
287
288
289 /* Anchor Volume Descriptor Pointer [3/10.2] */
290 struct anchor_vdp {
291 struct desc_tag tag;
292 struct extent_ad main_vds_ex; /* to main volume descriptor set ; 16 sectors min */
293 struct extent_ad reserve_vds_ex; /* copy of main volume descriptor set ; 16 sectors min */
294 } __packed;
295
296
297 /* Volume Descriptor Pointer [3/10.3] */
298 struct vol_desc_ptr {
299 struct desc_tag tag; /* use for extending the volume descriptor space */
300 uint32_t vds_number;
301 struct extent_ad next_vds_ex; /* points to the next block for volume descriptor space */
302 } __packed;
303
304
305 /* Primary Volume Descriptor [3/10.1] */
306 struct pri_vol_desc {
307 struct desc_tag tag;
308 uint32_t seq_num; /* MAX prevail */
309 uint32_t pvd_num; /* assigned by author; 0 is special as in it may only occure once */
310 char vol_id[32]; /* KEY ; main identifier of this disc */
311 uint16_t vds_num; /* volume descriptor number; i.e. what volume number is it */
312 uint16_t max_vol_seq; /* maximum volume descriptor number known */
313 uint16_t ichg_lvl;
314 uint16_t max_ichg_lvl;
315 uint32_t charset_list;
316 uint32_t max_charset_list;
317 char volset_id[128]; /* KEY ; if part of a multi-disc set or a band of volumes */
318 struct charspec desc_charset; /* KEY according to ECMA 167 */
319 struct charspec explanatory_charset;
320 struct extent_ad vol_abstract;
321 struct extent_ad vol_copyright;
322 struct regid app_id;
323 struct timestamp time;
324 struct regid imp_id;
325 uint8_t imp_use[64];
326 uint32_t prev_vds_loc; /* location of predecessor _lov ? */
327 uint16_t flags; /* bit 0 : if set indicates volume set name is meaningfull */
328 uint8_t reserved[22];
329 } __packed;
330
331
332 /* UDF specific implementation use part of the implementation use volume descriptor */
333 struct udf_lv_info {
334 struct charspec lvi_charset;
335 char logvol_id[128];
336
337 char lvinfo1[36];
338 char lvinfo2[36];
339 char lvinfo3[36];
340
341 struct regid impl_id;
342 uint8_t impl_use[128];
343 } __packed;
344
345
346 /* Implementation use Volume Descriptor */
347 struct impvol_desc {
348 struct desc_tag tag;
349 uint32_t seq_num;
350 struct regid impl_id;
351 union {
352 struct udf_lv_info lv_info;
353 char impl_use[460];
354 } __packed _impl_use;
355 } __packed;
356
357
358 /* Logical Volume Descriptor [3/10.6] */
359 struct logvol_desc {
360 struct desc_tag tag;
361 uint32_t seq_num; /* MAX prevail */
362 struct charspec desc_charset; /* KEY */
363 char logvol_id[128]; /* KEY */
364 uint32_t lb_size;
365 struct regid domain_id;
366 union {
367 struct long_ad fsd_loc; /* to fileset descriptor SEQUENCE */
368 uint8_t logvol_content_use[16];
369 } __packed _lvd_use;
370 uint32_t mt_l; /* Partition map length */
371 uint32_t n_pm; /* Number of partition maps */
372 struct regid imp_id;
373 uint8_t imp_use[128];
374 struct extent_ad integrity_seq_loc;
375 uint8_t maps[1];
376 } __packed;
377 #define lv_fsd_loc _lvd_use.fsd_loc
378
379 #define UDF_INTEGRITY_OPEN 0
380 #define UDF_INTEGRITY_CLOSED 1
381
382
383 #define UDF_PMAP_SIZE 64
384
385 /* Type 1 Partition Map [3/10.7.2] */
386 struct part_map_1 {
387 uint8_t type;
388 uint8_t len;
389 uint16_t vol_seq_num;
390 uint16_t part_num;
391 } __packed;
392
393
394 /* Type 2 Partition Map [3/10.7.3] */
395 struct part_map_2 {
396 uint8_t type;
397 uint8_t len;
398 uint8_t reserved[2];
399 struct regid part_id;
400 uint16_t vol_seq_num;
401 uint16_t part_num;
402 uint8_t reserved2[24];
403 } __packed;
404
405
406 /* Virtual Partition Map [UDF 2.01/2.2.8] */
407 struct part_map_virt {
408 uint8_t type;
409 uint8_t len;
410 uint8_t reserved[2];
411 struct regid id;
412 uint16_t vol_seq_num;
413 uint16_t part_num;
414 uint8_t reserved1[24];
415 } __packed;
416
417
418 /* Sparable Partition Map [UDF 2.01/2.2.9] */
419 struct part_map_spare {
420 uint8_t type;
421 uint8_t len;
422 uint8_t reserved[2];
423 struct regid id;
424 uint16_t vol_seq_num;
425 uint16_t part_num;
426 uint16_t packet_len;
427 uint8_t n_st; /* Number of redundant sparing tables range 1-4 */
428 uint8_t reserved1;
429 uint32_t st_size; /* size of EACH sparing table */
430 uint32_t st_loc[1]; /* locations of sparing tables */
431 } __packed;
432
433
434 /* Metadata Partition Map [UDF 2.50/2.2.10] */
435 struct part_map_meta {
436 uint8_t type;
437 uint8_t len;
438 uint8_t reserved[2];
439 struct regid id;
440 uint16_t vol_seq_num;
441 uint16_t part_num;
442 uint32_t meta_file_lbn; /* logical block number for file entry within part_num */
443 uint32_t meta_mirror_file_lbn;
444 uint32_t meta_bitmap_file_lbn;
445 uint32_t alloc_unit_size; /* allocation unit size in blocks */
446 uint16_t alignment_unit_size; /* alignment nessisary in blocks */
447 uint8_t flags;
448 uint8_t reserved1[5];
449 } __packed;
450 #define METADATA_DUPLICATED 1
451
452
453 union udf_pmap {
454 uint8_t data[UDF_PMAP_SIZE];
455 struct part_map_1 pm1;
456 struct part_map_2 pm2;
457 struct part_map_virt pmv;
458 struct part_map_spare pms;
459 struct part_map_meta pmm;
460 } __packed;
461
462
463 /* Sparing Map Entry [UDF 2.01/2.2.11] */
464 struct spare_map_entry {
465 uint32_t org; /* partion relative address */
466 uint32_t map; /* absolute disc address (!) can be in partion, but doesn't have to be */
467 } __packed;
468
469
470 /* Sparing Table [UDF 2.01/2.2.11] */
471 struct udf_sparing_table {
472 struct desc_tag tag;
473 struct regid id;
474 uint16_t rt_l; /* Relocation Table len */
475 uint8_t reserved[2];
476 uint32_t seq_num;
477 struct spare_map_entry entries[1];
478 } __packed;
479
480
481 #define UDF_NO_PREV_VAT 0xffffffff
482 /* UDF 1.50 VAT suffix [UDF 2.2.10 (UDF 1.50 spec)] */
483 struct udf_oldvat_tail {
484 struct regid id; /* "*UDF Virtual Alloc Tbl" */
485 uint32_t prev_vat;
486 } __packed;
487
488
489 /* VAT table [UDF 2.0.1/2.2.10] */
490 struct udf_vat {
491 uint16_t header_len;
492 uint16_t impl_use_len;
493 char logvol_id[128]; /* newer version of the LVD one */
494 uint32_t prev_vat;
495 uint32_t num_files;
496 uint32_t num_directories;
497 uint16_t min_udf_readver;
498 uint16_t min_udf_writever;
499 uint16_t max_udf_writever;
500 uint16_t reserved;
501 uint8_t data[1]; /* impl.use followed by VAT entries (uint32_t) */
502 } __packed;
503
504
505 /* Space bitmap descriptor as found in the partition header descriptor */
506 struct space_bitmap_desc {
507 struct desc_tag tag; /* TagId 264 */
508 uint32_t num_bits; /* number of bits */
509 uint32_t num_bytes; /* bytes that contain it */
510 uint8_t data[1];
511 } __packed;
512
513
514 /* Unalloc space entry as found in the partition header descriptor */
515 struct space_entry_desc {
516 struct desc_tag tag; /* TagId 263 */
517 struct icb_tag icbtag; /* type 1 */
518 uint32_t l_ad; /* in bytes */
519 uint8_t entry[1];
520 } __packed;
521
522
523 /* Partition header descriptor; in the contents_use of part_desc */
524 struct part_hdr_desc {
525 struct short_ad unalloc_space_table;
526 struct short_ad unalloc_space_bitmap;
527 struct short_ad part_integrety_table; /* has to be ZERO for UDF */
528 struct short_ad freed_space_table;
529 struct short_ad freed_space_bitmap;
530 uint8_t reserved[88];
531 } __packed;
532
533
534 /* Partition Descriptor [3/10.5] */
535 struct part_desc {
536 struct desc_tag tag;
537 uint32_t seq_num; /* MAX prevailing */
538 uint16_t flags; /* bit 0 : if set the space is allocated */
539 uint16_t part_num; /* KEY */
540 struct regid contents;
541 union {
542 struct part_hdr_desc part_hdr;
543 uint8_t contents_use[128];
544 } _impl_use;
545 uint32_t access_type; /* R/W, WORM etc. */
546 uint32_t start_loc; /* start of partion with given length */
547 uint32_t part_len;
548 struct regid imp_id;
549 uint8_t imp_use[128];
550 uint8_t reserved[156];
551 } __packed;
552 #define pd_part_hdr _impl_use.part_hdr
553 #define UDF_PART_FLAG_ALLOCATED 1
554
555
556 /* Unallocated Space Descriptor (UDF 2.01/2.2.5) */
557 struct unalloc_sp_desc {
558 struct desc_tag tag;
559 uint32_t seq_num; /* MAX prevailing */
560 uint32_t alloc_desc_num;
561 struct extent_ad alloc_desc[1];
562 } __packed;
563
564
565 /* Logical Volume Integrity Descriptor [3/30.10] */
566 struct logvolhdr {
567 uint64_t next_unique_id;
568 /* rest reserved */
569 } __packed;
570
571
572 struct udf_logvol_info {
573 struct regid impl_id;
574 uint32_t num_files;
575 uint32_t num_directories;
576 uint16_t min_udf_readver;
577 uint16_t min_udf_writever;
578 uint16_t max_udf_writever;
579 } __packed;
580
581
582 struct logvol_int_desc {
583 struct desc_tag tag;
584 struct timestamp time;
585 uint32_t integrity_type;
586 struct extent_ad next_extent;
587 union {
588 struct logvolhdr logvolhdr;
589 int8_t reserved[32];
590 } __packed _impl_use;
591 uint32_t num_part;
592 uint32_t l_iu;
593 uint32_t tables[1]; /* Freespace table, Sizetable, Implementation use */
594 } __packed;
595 #define lvint_next_unique_id _impl_use.logvolhdr.next_unique_id
596
597
598 /* File Set Descriptor [4/14.1] */
599 struct fileset_desc {
600 struct desc_tag tag;
601 struct timestamp time;
602 uint16_t ichg_lvl;
603 uint16_t max_ichg_lvl;
604 uint32_t charset_list;
605 uint32_t max_charset_list;
606 uint32_t fileset_num; /* key! */
607 uint32_t fileset_desc_num;
608 struct charspec logvol_id_charset;
609 char logvol_id[128]; /* for recovery */
610 struct charspec fileset_charset;
611 char fileset_id[32]; /* Mountpoint !! */
612 char copyright_file_id[32];
613 char abstract_file_id[32];
614 struct long_ad rootdir_icb; /* to rootdir; icb->virtual ? */
615 struct regid domain_id;
616 struct long_ad next_ex; /* to the next fileset_desc extent */
617 struct long_ad streamdir_icb; /* streamdir; needed? */
618 uint8_t reserved[32];
619 } __packed;
620
621
622 /* File Identifier Descriptor [4/14.4] */
623 struct fileid_desc {
624 struct desc_tag tag;
625 uint16_t file_version_num;
626 uint8_t file_char;
627 uint8_t l_fi; /* Length of file identifier area */
628 struct long_ad icb;
629 uint16_t l_iu; /* Length of implementation use area */
630 uint8_t data[1];
631 } __packed;
632 #define UDF_FID_SIZE 38
633 #define UDF_FILE_CHAR_VIS (1 << 0) /* Invisible */
634 #define UDF_FILE_CHAR_DIR (1 << 1) /* Directory */
635 #define UDF_FILE_CHAR_DEL (1 << 2) /* Deleted */
636 #define UDF_FILE_CHAR_PAR (1 << 3) /* Parent Directory */
637 #define UDF_FILE_CHAR_META (1 << 4) /* Stream metadata */
638
639
640 /* Extended attributes [4/14.10.1] */
641 struct extattrhdr_desc {
642 struct desc_tag tag;
643 uint32_t impl_attr_loc; /* offsets within this descriptor */
644 uint32_t appl_attr_loc; /* ditto */
645 } __packed;
646 #define UDF_IMPL_ATTR_LOC_NOT_PRESENT 0xffffffff
647 #define UDF_APPL_ATTR_LOC_NOT_PRESENT 0xffffffff
648
649
650 /* Extended attribute entry [4/48.10.2] */
651 struct extattr_entry {
652 uint32_t type;
653 uint8_t subtype;
654 uint8_t reserved[3];
655 uint32_t a_l;
656 } __packed;
657
658
659 /* Extended attribute entry; type 2048 [4/48.10.8] */
660 struct impl_extattr_entry {
661 struct extattr_entry hdr;
662 uint32_t iu_l;
663 struct regid imp_id;
664 uint8_t data[1];
665 } __packed;
666
667
668 /* Extended attribute entry; type 65 536 [4/48.10.9] */
669 struct appl_extattr_entry {
670 struct extattr_entry hdr;
671 uint32_t au_l;
672 struct regid appl_id;
673 uint8_t data[1];
674 } __packed;
675
676
677 /* File Times attribute entry; type 5 or type 6 [4/48.10.5], [4/48.10.6] */
678 struct filetimes_extattr_entry {
679 struct extattr_entry hdr;
680 uint32_t d_l; /* length of times[] data following */
681 uint32_t existence; /* bitmask */
682 struct timestamp times[1]; /* in order of assending bits */
683 } __packed;
684
685
686 /* Device Specification Extended Attribute [4/4.10.7] */
687 struct device_extattr_entry {
688 struct extattr_entry hdr;
689 uint32_t iu_l; /* length of implementation use */
690 uint32_t major;
691 uint32_t minor;
692 uint8_t data[1]; /* UDF: if nonzero length, contain developer ID regid */
693 } __packed;
694
695
696 /* VAT LV extension Extended Attribute [UDF 3.3.4.5.1.3] 1.50 errata */
697 struct vatlvext_extattr_entry {
698 uint64_t unique_id_chk; /* needs to be copy of ICB's */
699 uint32_t num_files;
700 uint32_t num_directories;
701 char logvol_id[128]; /* replaces logvol name */
702 } __packed;
703
704
705 /* File Entry [4/14.9] */
706 struct file_entry {
707 struct desc_tag tag;
708 struct icb_tag icbtag;
709 uint32_t uid;
710 uint32_t gid;
711 uint32_t perm;
712 uint16_t link_cnt;
713 uint8_t rec_format;
714 uint8_t rec_disp_attr;
715 uint32_t rec_len;
716 uint64_t inf_len;
717 uint64_t logblks_rec;
718 struct timestamp atime;
719 struct timestamp mtime;
720 struct timestamp attrtime;
721 uint32_t ckpoint;
722 struct long_ad ex_attr_icb;
723 struct regid imp_id;
724 uint64_t unique_id;
725 uint32_t l_ea; /* Length of extended attribute area */
726 uint32_t l_ad; /* Length of allocation descriptors */
727 uint8_t data[1];
728 } __packed;
729 #define UDF_FENTRY_SIZE 176
730 #define UDF_FENTRY_PERM_USER_MASK 0x07
731 #define UDF_FENTRY_PERM_GRP_MASK 0xE0
732 #define UDF_FENTRY_PERM_OWNER_MASK 0x1C00
733
734
735 /* Extended File Entry [4/48.17] */
736 struct extfile_entry {
737 struct desc_tag tag;
738 struct icb_tag icbtag;
739 uint32_t uid;
740 uint32_t gid;
741 uint32_t perm;
742 uint16_t link_cnt;
743 uint8_t rec_format;
744 uint8_t rec_disp_attr;
745 uint32_t rec_len;
746 uint64_t inf_len;
747 uint64_t obj_size;
748 uint64_t logblks_rec;
749 struct timestamp atime;
750 struct timestamp mtime;
751 struct timestamp ctime;
752 struct timestamp attrtime;
753 uint32_t ckpoint;
754 uint32_t reserved1;
755 struct long_ad ex_attr_icb;
756 struct long_ad streamdir_icb;
757 struct regid imp_id;
758 uint64_t unique_id;
759 uint32_t l_ea; /* Length of extended attribute area */
760 uint32_t l_ad; /* Length of allocation descriptors */
761 uint8_t data[1];
762 } __packed;
763
764
765 /* Indirect entry [ecma 48.7] */
766 struct indirect_entry {
767 struct desc_tag tag;
768 struct icb_tag icbtag;
769 struct long_ad indirect_icb;
770 } __packed;
771
772
773 /* Allocation extent descritor [ecma 48.5] */
774 struct alloc_ext_entry {
775 struct desc_tag tag;
776 uint32_t prev_entry;
777 uint32_t l_ad;
778 uint8_t data[1];
779 } __packed;
780
781
782 union dscrptr {
783 struct desc_tag tag;
784 struct anchor_vdp avdp;
785 struct vol_desc_ptr vdp;
786 struct pri_vol_desc pvd;
787 struct logvol_desc lvd;
788 struct unalloc_sp_desc usd;
789 struct logvol_int_desc lvid;
790 struct impvol_desc ivd;
791 struct part_desc pd;
792 struct fileset_desc fsd;
793 struct fileid_desc fid;
794 struct file_entry fe;
795 struct extfile_entry efe;
796 struct extattrhdr_desc eahd;
797 struct indirect_entry inde;
798 struct alloc_ext_entry aee;
799 struct udf_sparing_table spt;
800 struct space_bitmap_desc sbd;
801 struct space_entry_desc sed;
802 } __packed;
803
804
805 /* Useful defines */
806
807 #define GETICB(ad_type, fentry, offset) \
808 (struct ad_type *)&fentry->data[offset]
809
810 #define GETICBLEN(ad_type, icb) ((struct ad_type *)(icb))->len
811
812
813 #endif /* !_FS_UDF_ECMA167_UDF_H_ */
814
815