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