2 * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * $FreeBSD: src/sys/fs/udf/ecma167-udf.h,v 1.4 2002/09/23 18:54:30 alfred Exp $
27 * $DragonFly: src/sys/vfs/udf/ecma167-udf.h,v 1.1 2004/03/12 22:38:15 joerg Exp $
31 /* Structure/definitions/constants a la ECMA 167 rev. 3 */
41 TAGID_UNALLOC_SPACE = 7,
43 TAGID_LOGVOL_INTEGRITY = 9,
49 /* Descriptor tag [3/7.2] */
52 uint16_t descriptor_ver;
57 uint16_t desc_crc_len;
61 /* Recorded Address [4/7.1] */
67 /* Extent Descriptor [3/7.1] */
73 /* Short Allocation Descriptor [4/14.14.1] */
79 /* Long Allocation Descriptor [4/14.14.2] */
87 /* Extended Allocation Descriptor [4/14.14.3] */
92 struct lb_addr ex_loc;
102 /* Character set spec [1/7.2.1] */
108 /* Timestamp [1/7.3] */
122 /* Entity Identifier [1/7.4] */
123 #define UDF_REGID_ID_SIZE 23
126 uint8_t id[UDF_REGID_ID_SIZE];
127 uint8_t id_suffix[8];
130 /* ICB Tag [4/14.6] */
132 uint32_t prev_num_dirs;
134 uint8_t strat_param[2];
135 uint16_t max_num_entries;
138 struct lb_addr parent_icb;
141 #define UDF_ICB_TAG_FLAGS_SETUID 0x40
142 #define UDF_ICB_TAG_FLAGS_SETGID 0x80
143 #define UDF_ICB_TAG_FLAGS_STICKY 0x100
145 /* Anchor Volume Descriptor Pointer [3/10.2] */
148 struct extent_ad main_vds_ex;
149 struct extent_ad reserve_vds_ex;
152 /* Volume Descriptor Pointer [3/10.3] */
153 struct vol_desc_ptr {
156 struct extent_ad next_vds_ex;
159 /* Primary Volume Descriptor [3/10.1] */
160 struct pri_vol_desc {
166 uint16_t max_vol_seq;
168 uint16_t max_ichg_lvl;
169 uint32_t charset_list;
170 uint32_t max_charset_list;
172 struct charspec desc_charset;
173 struct charspec explanatory_charset;
174 struct extent_ad vol_abstract;
175 struct extent_ad vol_copyright;
177 struct timestamp time;
180 uint32_t prev_vds_lov;
182 uint8_t reserved[22];
185 /* Logical Volume Descriptor [3/10.6] */
189 struct charspec desc_charset;
192 struct regid domain_id;
194 struct long_ad fsd_loc;
195 uint8_t logvol_content_use[16];
197 uint32_t mt_l; /* Partition map length */
198 uint32_t n_pm; /* Number of partition maps */
200 uint8_t imp_use[128];
201 struct extent_ad integrity_seq_id;
205 #define UDF_PMAP_SIZE 64
207 /* Type 1 Partition Map [3/10.7.2] */
211 uint16_t vol_seq_num;
215 /* Type 2 Partition Map [3/10.7.3] */
222 /* Virtual Partition Map [UDF 2.01/2.2.8] */
223 struct part_map_virt {
228 uint16_t vol_seq_num;
230 uint8_t reserved1[24];
233 /* Sparable Partition Map [UDF 2.01/2.2.9] */
234 struct part_map_spare {
239 uint16_t vol_seq_num;
242 uint8_t n_st; /* Number of Sparing Tables */
249 uint8_t data[UDF_PMAP_SIZE];
250 struct part_map_1 pm1;
251 struct part_map_2 pm2;
252 struct part_map_virt pmv;
253 struct part_map_spare pms;
256 /* Sparing Map Entry [UDF 2.01/2.2.11] */
257 struct spare_map_entry {
262 /* Sparing Table [UDF 2.01/2.2.11] */
263 struct udf_sparing_table {
266 uint16_t rt_l; /* Relocation Table len */
269 struct spare_map_entry entries[1];
272 /* Partition Descriptor [3/10.5] */
278 struct regid contents;
279 uint8_t contents_use[128];
280 uint32_t access_type;
284 uint8_t imp_use[128];
285 uint8_t reserved[156];
288 /* File Set Descriptor [4/14.1] */
289 struct fileset_desc {
291 struct timestamp time;
293 uint16_t max_ichg_lvl;
294 uint32_t charset_list;
295 uint32_t max_charset_list;
296 uint32_t fileset_num;
297 uint32_t fileset_desc_num;
298 struct charspec logvol_id_charset;
300 struct charspec fileset_charset;
302 char copyright_file_id[32];
303 char abstract_file_id[32];
304 struct long_ad rootdir_icb;
305 struct regid domain_id;
306 struct long_ad next_ex;
307 struct long_ad streamdir_icb;
308 uint8_t reserved[32];
311 /* File Identifier Descriptor [4/14.4] */
316 uint8_t l_fi; /* Length of file identifier area */
318 uint16_t l_iu; /* Length of implementaion use area */
321 #define UDF_FID_SIZE 38
322 #define UDF_FILE_CHAR_VIS (1 << 0) /* Visible */
323 #define UDF_FILE_CHAR_DIR (1 << 1) /* Directory */
324 #define UDF_FILE_CHAR_DEL (1 << 2) /* Deleted */
325 #define UDF_FILE_CHAR_PAR (1 << 3) /* Parent Directory */
326 #define UDF_FILE_CHAR_META (1 << 4) /* Stream metadata */
328 /* File Entry [4/14.9] */
331 struct icb_tag icbtag;
337 uint8_t rec_disp_attr;
340 uint64_t logblks_rec;
341 struct timestamp atime;
342 struct timestamp mtime;
343 struct timestamp attrtime;
345 struct long_ad ex_attr_icb;
348 uint32_t l_ea; /* Length of extended attribute area */
349 uint32_t l_ad; /* Length of allocation descriptors */
352 #define UDF_FENTRY_SIZE 176
353 #define UDF_FENTRY_PERM_USER_MASK 0x07
354 #define UDF_FENTRY_PERM_GRP_MASK 0xE0
355 #define UDF_FENTRY_PERM_OWNER_MASK 0x1C00
359 struct anchor_vdp avdp;
360 struct vol_desc_ptr vdp;
361 struct pri_vol_desc pvd;
362 struct logvol_desc lvd;
364 struct fileset_desc fsd;
365 struct fileid_desc fid;
366 struct file_entry fe;
371 #define GETICB(ad_type, fentry, offset) \
372 (struct ad_type *)&fentry->data[offset]
374 #define GETICBLEN(ad_type, icb) ((struct ad_type *)(icb))->len