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