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