ecma167-udf.h revision 1.10 1 /* $NetBSD: ecma167-udf.h,v 1.10 2008/06/24 15:30:33 reinoud Exp $ */
2
3 /*-
4 * Copyright (c) 2003, 2004, 2005, 2006, 2008 Reinoud Zandijk
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 __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_INDIRECTENTRY = 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 #define longad_uniqueid impl.im_used.unique_id
184
185
186 /* Extended Allocation Descriptor [4/14.14.3] ; identifies an extent of allocation descriptors ; also in UDF ? */
187 struct ext_ad {
188 uint32_t ex_len;
189 uint32_t rec_len;
190 uint32_t inf_len;
191 struct lb_addr ex_loc;
192 uint8_t reserved[2];
193 } __packed;
194
195
196 /* ICB : Information Control Block; positioning */
197 union icb {
198 struct short_ad s_ad;
199 struct long_ad l_ad;
200 struct ext_ad e_ad;
201 } __packed;
202
203
204 /* short/long/ext extent have flags encoded in length */
205 #define UDF_EXT_ALLOCATED (0<<30)
206 #define UDF_EXT_FREED (1<<30)
207 #define UDF_EXT_ALLOCATED_BUT_NOT_USED (1<<30)
208 #define UDF_EXT_FREE (2<<30)
209 #define UDF_EXT_REDIRECT (3<<30)
210 #define UDF_EXT_FLAGS(len) ((len) & (3<<30))
211 #define UDF_EXT_LEN(len) ((len) & ((1<<30)-1))
212 #define UDF_EXT_MAXLEN ((1<<30)-1)
213
214
215 /* Character set spec [1/7.2.1] */
216 struct charspec {
217 uint8_t type;
218 uint8_t inf[63];
219 } __packed;
220
221
222 struct pathcomp {
223 uint8_t type;
224 uint8_t l_ci;
225 uint16_t comp_filever;
226 uint8_t ident[256];
227 } __packed;
228 #define UDF_PATH_COMP_SIZE 4
229 #define UDF_PATH_COMP_RESERVED 0
230 #define UDF_PATH_COMP_ROOT 1
231 #define UDF_PATH_COMP_MOUNTROOT 2
232 #define UDF_PATH_COMP_PARENTDIR 3
233 #define UDF_PATH_COMP_CURDIR 4
234 #define UDF_PATH_COMP_NAME 5
235
236
237 /* Timestamp [1/7.3] */
238 struct timestamp {
239 uint16_t type_tz;
240 uint16_t year;
241 uint8_t month;
242 uint8_t day;
243 uint8_t hour;
244 uint8_t minute;
245 uint8_t second;
246 uint8_t centisec;
247 uint8_t hund_usec;
248 uint8_t usec;
249 } __packed;
250 #define UDF_TIMESTAMP_SIZE 12
251
252
253 /* Entity Identifier [1/7.4] */
254 #define UDF_REGID_ID_SIZE 23
255 struct regid {
256 uint8_t flags;
257 uint8_t id[UDF_REGID_ID_SIZE];
258 uint8_t id_suffix[8];
259 } __packed;
260
261
262 /* ICB Tag [4/14.6] */
263 struct icb_tag {
264 uint32_t prev_num_dirs;
265 uint16_t strat_type;
266 uint8_t strat_param[2];
267 uint16_t max_num_entries;
268 uint8_t reserved;
269 uint8_t file_type;
270 struct lb_addr parent_icb;
271 uint16_t flags;
272 } __packed;
273 #define UDF_ICB_TAG_FLAGS_ALLOC_MASK 0x03
274 #define UDF_ICB_SHORT_ALLOC 0x00
275 #define UDF_ICB_LONG_ALLOC 0x01
276 #define UDF_ICB_EXT_ALLOC 0x02
277 #define UDF_ICB_INTERN_ALLOC 0x03
278
279 #define UDF_ICB_TAG_FLAGS_DIRORDERED (1<< 3)
280 #define UDF_ICB_TAG_FLAGS_NONRELOC (1<< 4)
281 #define UDF_ICB_TAG_FLAGS_CONTIGUES (1<< 9)
282 #define UDF_ICB_TAG_FLAGS_MULTIPLEVERS (1<<12)
283
284 #define UDF_ICB_TAG_FLAGS_SETUID (1<< 6)
285 #define UDF_ICB_TAG_FLAGS_SETGID (1<< 7)
286 #define UDF_ICB_TAG_FLAGS_STICKY (1<< 8)
287
288 #define UDF_ICB_FILETYPE_UNKNOWN 0
289 #define UDF_ICB_FILETYPE_UNALLOCSPACE 1
290 #define UDF_ICB_FILETYPE_PARTINTEGRITY 2
291 #define UDF_ICB_FILETYPE_INDIRECTENTRY 3
292 #define UDF_ICB_FILETYPE_DIRECTORY 4
293 #define UDF_ICB_FILETYPE_RANDOMACCESS 5
294 #define UDF_ICB_FILETYPE_BLOCKDEVICE 6
295 #define UDF_ICB_FILETYPE_CHARDEVICE 7
296 #define UDF_ICB_FILETYPE_EXTATTRREC 8
297 #define UDF_ICB_FILETYPE_FIFO 9
298 #define UDF_ICB_FILETYPE_SOCKET 10
299 #define UDF_ICB_FILETYPE_TERM 11
300 #define UDF_ICB_FILETYPE_SYMLINK 12
301 #define UDF_ICB_FILETYPE_STREAMDIR 13
302 #define UDF_ICB_FILETYPE_VAT 248
303 #define UDF_ICB_FILETYPE_REALTIME 249
304 #define UDF_ICB_FILETYPE_META_MAIN 250
305 #define UDF_ICB_FILETYPE_META_MIRROR 251
306
307
308 /* Anchor Volume Descriptor Pointer [3/10.2] */
309 struct anchor_vdp {
310 struct desc_tag tag;
311 struct extent_ad main_vds_ex; /* to main volume descriptor set ; 16 sectors min */
312 struct extent_ad reserve_vds_ex; /* copy of main volume descriptor set ; 16 sectors min */
313 } __packed;
314
315
316 /* Volume Descriptor Pointer [3/10.3] */
317 struct vol_desc_ptr {
318 struct desc_tag tag; /* use for extending the volume descriptor space */
319 uint32_t vds_number;
320 struct extent_ad next_vds_ex; /* points to the next block for volume descriptor space */
321 } __packed;
322
323
324 /* Primary Volume Descriptor [3/10.1] */
325 struct pri_vol_desc {
326 struct desc_tag tag;
327 uint32_t seq_num; /* MAX prevail */
328 uint32_t pvd_num; /* assigned by author; 0 is special as in it may only occure once */
329 char vol_id[32]; /* KEY ; main identifier of this disc */
330 uint16_t vds_num; /* volume descriptor number; i.e. what volume number is it */
331 uint16_t max_vol_seq; /* maximum volume descriptor number known */
332 uint16_t ichg_lvl;
333 uint16_t max_ichg_lvl;
334 uint32_t charset_list;
335 uint32_t max_charset_list;
336 char volset_id[128]; /* KEY ; if part of a multi-disc set or a band of volumes */
337 struct charspec desc_charset; /* KEY according to ECMA 167 */
338 struct charspec explanatory_charset;
339 struct extent_ad vol_abstract;
340 struct extent_ad vol_copyright;
341 struct regid app_id;
342 struct timestamp time;
343 struct regid imp_id;
344 uint8_t imp_use[64];
345 uint32_t prev_vds_loc; /* location of predecessor _lov ? */
346 uint16_t flags; /* bit 0 : if set indicates volume set name is meaningfull */
347 uint8_t reserved[22];
348 } __packed;
349
350
351 /* UDF specific implementation use part of the implementation use volume descriptor */
352 struct udf_lv_info {
353 struct charspec lvi_charset;
354 char logvol_id[128];
355
356 char lvinfo1[36];
357 char lvinfo2[36];
358 char lvinfo3[36];
359
360 struct regid impl_id;
361 uint8_t impl_use[128];
362 } __packed;
363
364
365 /* Implementation use Volume Descriptor */
366 struct impvol_desc {
367 struct desc_tag tag;
368 uint32_t seq_num;
369 struct regid impl_id;
370 union {
371 struct udf_lv_info lv_info;
372 char impl_use[460];
373 } __packed _impl_use;
374 } __packed;
375
376
377 /* Logical Volume Descriptor [3/10.6] */
378 struct logvol_desc {
379 struct desc_tag tag;
380 uint32_t seq_num; /* MAX prevail */
381 struct charspec desc_charset; /* KEY */
382 char logvol_id[128]; /* KEY */
383 uint32_t lb_size;
384 struct regid domain_id;
385 union {
386 struct long_ad fsd_loc; /* to fileset descriptor SEQUENCE */
387 uint8_t logvol_content_use[16];
388 } __packed _lvd_use;
389 uint32_t mt_l; /* Partition map length */
390 uint32_t n_pm; /* Number of partition maps */
391 struct regid imp_id;
392 uint8_t imp_use[128];
393 struct extent_ad integrity_seq_loc;
394 uint8_t maps[1];
395 } __packed;
396 #define lv_fsd_loc _lvd_use.fsd_loc
397
398 #define UDF_INTEGRITY_OPEN 0
399 #define UDF_INTEGRITY_CLOSED 1
400
401
402 #define UDF_PMAP_SIZE 64
403
404 /* Type 1 Partition Map [3/10.7.2] */
405 struct part_map_1 {
406 uint8_t type;
407 uint8_t len;
408 uint16_t vol_seq_num;
409 uint16_t part_num;
410 } __packed;
411
412
413 /* Type 2 Partition Map [3/10.7.3] */
414 struct part_map_2 {
415 uint8_t type;
416 uint8_t len;
417 uint8_t reserved[2];
418 struct regid part_id;
419 uint16_t vol_seq_num;
420 uint16_t part_num;
421 uint8_t reserved2[24];
422 } __packed;
423
424
425 /* Virtual Partition Map [UDF 2.01/2.2.8] */
426 struct part_map_virt {
427 uint8_t type;
428 uint8_t len;
429 uint8_t reserved[2];
430 struct regid id;
431 uint16_t vol_seq_num;
432 uint16_t part_num;
433 uint8_t reserved1[24];
434 } __packed;
435
436
437 /* Sparable Partition Map [UDF 2.01/2.2.9] */
438 struct part_map_spare {
439 uint8_t type;
440 uint8_t len;
441 uint8_t reserved[2];
442 struct regid id;
443 uint16_t vol_seq_num;
444 uint16_t part_num;
445 uint16_t packet_len;
446 uint8_t n_st; /* Number of redundant sparing tables range 1-4 */
447 uint8_t reserved1;
448 uint32_t st_size; /* size of EACH sparing table */
449 uint32_t st_loc[1]; /* locations of sparing tables */
450 } __packed;
451
452
453 /* Metadata Partition Map [UDF 2.50/2.2.10] */
454 struct part_map_meta {
455 uint8_t type;
456 uint8_t len;
457 uint8_t reserved[2];
458 struct regid id;
459 uint16_t vol_seq_num;
460 uint16_t part_num;
461 uint32_t meta_file_lbn; /* logical block number for file entry within part_num */
462 uint32_t meta_mirror_file_lbn;
463 uint32_t meta_bitmap_file_lbn;
464 uint32_t alloc_unit_size; /* allocation unit size in blocks */
465 uint16_t alignment_unit_size; /* alignment nessisary in blocks */
466 uint8_t flags;
467 uint8_t reserved1[5];
468 } __packed;
469 #define METADATA_DUPLICATED 1
470
471
472 union udf_pmap {
473 uint8_t data[UDF_PMAP_SIZE];
474 struct part_map_1 pm1;
475 struct part_map_2 pm2;
476 struct part_map_virt pmv;
477 struct part_map_spare pms;
478 struct part_map_meta pmm;
479 } __packed;
480
481
482 /* Sparing Map Entry [UDF 2.01/2.2.11] */
483 struct spare_map_entry {
484 uint32_t org; /* partion relative address */
485 uint32_t map; /* absolute disc address (!) can be in partion, but doesn't have to be */
486 } __packed;
487
488
489 /* Sparing Table [UDF 2.01/2.2.11] */
490 struct udf_sparing_table {
491 struct desc_tag tag;
492 struct regid id;
493 uint16_t rt_l; /* Relocation Table len */
494 uint8_t reserved[2];
495 uint32_t seq_num;
496 struct spare_map_entry entries[1];
497 } __packed;
498
499
500 #define UDF_NO_PREV_VAT 0xffffffff
501 /* UDF 1.50 VAT suffix [UDF 2.2.10 (UDF 1.50 spec)] */
502 struct udf_oldvat_tail {
503 struct regid id; /* "*UDF Virtual Alloc Tbl" */
504 uint32_t prev_vat;
505 } __packed;
506
507
508 /* VAT table [UDF 2.0.1/2.2.10] */
509 struct udf_vat {
510 uint16_t header_len;
511 uint16_t impl_use_len;
512 char logvol_id[128]; /* newer version of the LVD one */
513 uint32_t prev_vat;
514 uint32_t num_files;
515 uint32_t num_directories;
516 uint16_t min_udf_readver;
517 uint16_t min_udf_writever;
518 uint16_t max_udf_writever;
519 uint16_t reserved;
520 uint8_t data[1]; /* impl.use followed by VAT entries (uint32_t) */
521 } __packed;
522
523
524 /* Space bitmap descriptor as found in the partition header descriptor */
525 struct space_bitmap_desc {
526 struct desc_tag tag; /* TagId 264 */
527 uint32_t num_bits; /* number of bits */
528 uint32_t num_bytes; /* bytes that contain it */
529 uint8_t data[1];
530 } __packed;
531
532
533 /* Unalloc space entry as found in the partition header descriptor */
534 struct space_entry_desc {
535 struct desc_tag tag; /* TagId 263 */
536 struct icb_tag icbtag; /* type 1 */
537 uint32_t l_ad; /* in bytes */
538 uint8_t entry[1];
539 } __packed;
540
541
542 /* Partition header descriptor; in the contents_use of part_desc */
543 struct part_hdr_desc {
544 struct short_ad unalloc_space_table;
545 struct short_ad unalloc_space_bitmap;
546 struct short_ad part_integrety_table; /* has to be ZERO for UDF */
547 struct short_ad freed_space_table;
548 struct short_ad freed_space_bitmap;
549 uint8_t reserved[88];
550 } __packed;
551
552
553 /* Partition Descriptor [3/10.5] */
554 struct part_desc {
555 struct desc_tag tag;
556 uint32_t seq_num; /* MAX prevailing */
557 uint16_t flags; /* bit 0 : if set the space is allocated */
558 uint16_t part_num; /* KEY */
559 struct regid contents;
560 union {
561 struct part_hdr_desc part_hdr;
562 uint8_t contents_use[128];
563 } _impl_use;
564 uint32_t access_type; /* R/W, WORM etc. */
565 uint32_t start_loc; /* start of partion with given length */
566 uint32_t part_len;
567 struct regid imp_id;
568 uint8_t imp_use[128];
569 uint8_t reserved[156];
570 } __packed;
571 #define pd_part_hdr _impl_use.part_hdr
572 #define UDF_PART_FLAG_ALLOCATED 1
573
574
575 /* Unallocated Space Descriptor (UDF 2.01/2.2.5) */
576 struct unalloc_sp_desc {
577 struct desc_tag tag;
578 uint32_t seq_num; /* MAX prevailing */
579 uint32_t alloc_desc_num;
580 struct extent_ad alloc_desc[1];
581 } __packed;
582
583
584 /* Logical Volume Integrity Descriptor [3/30.10] */
585 struct logvolhdr {
586 uint64_t next_unique_id;
587 /* rest reserved */
588 } __packed;
589
590
591 struct udf_logvol_info {
592 struct regid impl_id;
593 uint32_t num_files;
594 uint32_t num_directories;
595 uint16_t min_udf_readver;
596 uint16_t min_udf_writever;
597 uint16_t max_udf_writever;
598 } __packed;
599
600
601 struct logvol_int_desc {
602 struct desc_tag tag;
603 struct timestamp time;
604 uint32_t integrity_type;
605 struct extent_ad next_extent;
606 union {
607 struct logvolhdr logvolhdr;
608 int8_t reserved[32];
609 } __packed _impl_use;
610 uint32_t num_part;
611 uint32_t l_iu;
612 uint32_t tables[1]; /* Freespace table, Sizetable, Implementation use */
613 } __packed;
614 #define lvint_next_unique_id _impl_use.logvolhdr.next_unique_id
615
616
617 /* File Set Descriptor [4/14.1] */
618 struct fileset_desc {
619 struct desc_tag tag;
620 struct timestamp time;
621 uint16_t ichg_lvl;
622 uint16_t max_ichg_lvl;
623 uint32_t charset_list;
624 uint32_t max_charset_list;
625 uint32_t fileset_num; /* key! */
626 uint32_t fileset_desc_num;
627 struct charspec logvol_id_charset;
628 char logvol_id[128]; /* for recovery */
629 struct charspec fileset_charset;
630 char fileset_id[32]; /* Mountpoint !! */
631 char copyright_file_id[32];
632 char abstract_file_id[32];
633 struct long_ad rootdir_icb; /* to rootdir; icb->virtual ? */
634 struct regid domain_id;
635 struct long_ad next_ex; /* to the next fileset_desc extent */
636 struct long_ad streamdir_icb; /* streamdir; needed? */
637 uint8_t reserved[32];
638 } __packed;
639
640
641 /* File Identifier Descriptor [4/14.4] */
642 struct fileid_desc {
643 struct desc_tag tag;
644 uint16_t file_version_num;
645 uint8_t file_char;
646 uint8_t l_fi; /* Length of file identifier area */
647 struct long_ad icb;
648 uint16_t l_iu; /* Length of implementation use area */
649 uint8_t data[0];
650 } __packed;
651 #define UDF_FID_SIZE 38
652 #define UDF_FILE_CHAR_VIS (1 << 0) /* Invisible */
653 #define UDF_FILE_CHAR_DIR (1 << 1) /* Directory */
654 #define UDF_FILE_CHAR_DEL (1 << 2) /* Deleted */
655 #define UDF_FILE_CHAR_PAR (1 << 3) /* Parent Directory */
656 #define UDF_FILE_CHAR_META (1 << 4) /* Stream metadata */
657
658
659 /* Extended attributes [4/14.10.1] */
660 struct extattrhdr_desc {
661 struct desc_tag tag;
662 uint32_t impl_attr_loc; /* offsets within this descriptor */
663 uint32_t appl_attr_loc; /* ditto */
664 } __packed;
665 #define UDF_IMPL_ATTR_LOC_NOT_PRESENT 0xffffffff
666 #define UDF_APPL_ATTR_LOC_NOT_PRESENT 0xffffffff
667
668
669 /* Extended attribute entry [4/48.10.2] */
670 struct extattr_entry {
671 uint32_t type;
672 uint8_t subtype;
673 uint8_t reserved[3];
674 uint32_t a_l;
675 } __packed;
676
677
678 /* Extended attribute entry; type 2048 [4/48.10.8] */
679 struct impl_extattr_entry {
680 struct extattr_entry hdr;
681 uint32_t iu_l;
682 struct regid imp_id;
683 uint8_t data[1];
684 } __packed;
685
686
687 /* Extended attribute entry; type 65 536 [4/48.10.9] */
688 struct appl_extattr_entry {
689 struct extattr_entry hdr;
690 uint32_t au_l;
691 struct regid appl_id;
692 uint8_t data[1];
693 } __packed;
694
695
696 /* File Times attribute entry; type 5 or type 6 [4/48.10.5], [4/48.10.6] */
697 struct filetimes_extattr_entry {
698 struct extattr_entry hdr;
699 uint32_t d_l; /* length of times[] data following */
700 uint32_t existence; /* bitmask */
701 struct timestamp times[1]; /* in order of assending bits */
702 } __packed;
703 #define UDF_FILETIMES_ATTR_NO 5
704 #define UDF_FILETIMES_FILE_CREATION 1
705 #define UDF_FILETIMES_FILE_DELETION 4
706 #define UDF_FILETIMES_FILE_EFFECTIVE 8
707 #define UDF_FILETIMES_FILE_BACKUPED 16
708 #define UDF_FILETIMES_ATTR_SIZE(no) (20 + (no)*sizeof(struct timestamp))
709
710
711 /* Device Specification Extended Attribute [4/4.10.7] */
712 struct device_extattr_entry {
713 struct extattr_entry hdr;
714 uint32_t iu_l; /* length of implementation use */
715 uint32_t major;
716 uint32_t minor;
717 uint8_t data[1]; /* UDF: if nonzero length, contain developer ID regid */
718 } __packed;
719 #define UDF_DEVICESPEC_ATTR_NO 12
720
721
722 /* VAT LV extension Extended Attribute [UDF 3.3.4.5.1.3] 1.50 errata */
723 struct vatlvext_extattr_entry {
724 uint64_t unique_id_chk; /* needs to be copy of ICB's */
725 uint32_t num_files;
726 uint32_t num_directories;
727 char logvol_id[128]; /* replaces logvol name */
728 } __packed;
729
730
731 /* File Entry [4/14.9] */
732 struct file_entry {
733 struct desc_tag tag;
734 struct icb_tag icbtag;
735 uint32_t uid;
736 uint32_t gid;
737 uint32_t perm;
738 uint16_t link_cnt;
739 uint8_t rec_format;
740 uint8_t rec_disp_attr;
741 uint32_t rec_len;
742 uint64_t inf_len;
743 uint64_t logblks_rec;
744 struct timestamp atime;
745 struct timestamp mtime;
746 struct timestamp attrtime;
747 uint32_t ckpoint;
748 struct long_ad ex_attr_icb;
749 struct regid imp_id;
750 uint64_t unique_id;
751 uint32_t l_ea; /* Length of extended attribute area */
752 uint32_t l_ad; /* Length of allocation descriptors */
753 uint8_t data[1];
754 } __packed;
755 #define UDF_FENTRY_SIZE 176
756 #define UDF_FENTRY_PERM_USER_MASK 0x07
757 #define UDF_FENTRY_PERM_GRP_MASK 0xE0
758 #define UDF_FENTRY_PERM_OWNER_MASK 0x1C00
759
760
761 /* Extended File Entry [4/48.17] */
762 struct extfile_entry {
763 struct desc_tag tag;
764 struct icb_tag icbtag;
765 uint32_t uid;
766 uint32_t gid;
767 uint32_t perm;
768 uint16_t link_cnt;
769 uint8_t rec_format;
770 uint8_t rec_disp_attr;
771 uint32_t rec_len;
772 uint64_t inf_len;
773 uint64_t obj_size;
774 uint64_t logblks_rec;
775 struct timestamp atime;
776 struct timestamp mtime;
777 struct timestamp ctime;
778 struct timestamp attrtime;
779 uint32_t ckpoint;
780 uint32_t reserved1;
781 struct long_ad ex_attr_icb;
782 struct long_ad streamdir_icb;
783 struct regid imp_id;
784 uint64_t unique_id;
785 uint32_t l_ea; /* Length of extended attribute area */
786 uint32_t l_ad; /* Length of allocation descriptors */
787 uint8_t data[1];
788 } __packed;
789 #define UDF_EXTFENTRY_SIZE 216
790
791
792 /* Indirect entry [ecma 48.7] */
793 struct indirect_entry {
794 struct desc_tag tag;
795 struct icb_tag icbtag;
796 struct long_ad indirect_icb;
797 } __packed;
798
799
800 /* Allocation extent descriptor [ecma 48.5] */
801 struct alloc_ext_entry {
802 struct desc_tag tag;
803 uint32_t prev_entry;
804 uint32_t l_ad;
805 uint8_t data[1];
806 } __packed;
807
808
809 union dscrptr {
810 struct desc_tag tag;
811 struct anchor_vdp avdp;
812 struct vol_desc_ptr vdp;
813 struct pri_vol_desc pvd;
814 struct logvol_desc lvd;
815 struct unalloc_sp_desc usd;
816 struct logvol_int_desc lvid;
817 struct impvol_desc ivd;
818 struct part_desc pd;
819 struct fileset_desc fsd;
820 struct fileid_desc fid;
821 struct file_entry fe;
822 struct extfile_entry efe;
823 struct extattrhdr_desc eahd;
824 struct indirect_entry inde;
825 struct alloc_ext_entry aee;
826 struct udf_sparing_table spt;
827 struct space_bitmap_desc sbd;
828 struct space_entry_desc sed;
829 } __packed;
830
831
832 #endif /* !_FS_UDF_ECMA167_UDF_H_ */
833
834