xref: /titanic_50/usr/src/uts/common/sys/fs/udf_volume.h (revision 02b4e56ca3a4e4a4fe9e52fca9c2972101f0e57f)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_FS_UDF_VOLUME_H
28 #define	_SYS_FS_UDF_VOLUME_H
29 
30 #include <sys/isa_defs.h>
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 #define	UDF_102	0x66
37 #define	UDF_150	0x96
38 #define	UDF_200	0xC8
39 
40 /* fid_idlen include compression id */
41 #define	FID_LEN(fid)	(((sizeof (struct file_id) +	\
42 		SWAP_16((fid)->fid_iulen) + (fid)->fid_idlen - 2) + 3) & ~3)
43 
44 /*
45  * #define	ID_LEN(fid)	\
46  *		(((SWAP_16((fid)->fid_iulen) + (fid)->fid_idlen - 2) + 3) & ~3)
47  */
48 
49 #define	F_LEN		(sizeof (struct file_id) - 2)
50 
51 #define	UDF_DOMAIN_NAME		"*OSTA UDF Compliant\0\0\0\0"
52 #define	UDF_LV_INFO		"*UDF LV Info\0\0\0\0\0\0\0\0\0\0\0\0"
53 #define	UDF_FREEEASPACE		"*UDF FreeEASpace\0\0\0\0\0\0\0\0"
54 #define	UDF_FREEAEASPACE	"*UDF FreeAppEASpace\0\0\0\0"
55 #define	UDF_CGMS_INFO		"*UDF DVD CGMS Info\0\0\0\0"
56 #define	UDF_OS2_EA		"*UDF OS/2 EA\0\0\0\0\0\0\0\0\0\0\0"
57 #define	UDF_OS2_EA_LEN		"*UDF OS/2 EALength\0\0\0\0\0\0"
58 #define	UDF_MAC_VOLINFO		"*UDF Mac VolumeInfo\0\0\0\0"
59 #define	UDF_MAC_UNIQID		"*UDF Mac UniqueIDTable\0"
60 #define	UDF_MAC_RESFRK		"*UDF Mac ResourceFork\0\0"
61 #define	UDF_VIRT_PART		"*UDF Virtual Partition\0"
62 #define	UDF_SPAR_PART		"*UDF Sparable Partition"
63 #define	UDF_VAT			"*UDF Virtual Alloc Tbl\0"
64 #define	UDF_SPAR_TBL		"*UDF Sparing Table\0\0\0\0\0"
65 
66 
67 #if defined(_BIG_ENDIAN)
68 #define	SWAP_16(a)	(((ushort_t)((a) & 0xff) << 8) | \
69 					((ushort_t)((a) & 0xff00) >> 8))
70 #define	SWAP_32(a)	((((a) & 0xff) << 24) |	\
71 				(((a) & 0xff00) << 8) |	\
72 				(((a) & 0xff0000) >> 8) |	\
73 				(((a) & 0xff000000) >> 24))
74 #define	SWAP_64(a)	((((a) & 0xffULL) << 56)	| \
75 				(((a) & 0xff00ULL) << 40) | \
76 				(((a) & 0xff0000ULL) << 24) | \
77 				(((a) & 0xff000000ULL) << 8) | \
78 				(((a) & 0xff00000000ULL) >> 8) | \
79 				(((a) & 0xff0000000000ULL) >> 24) | \
80 				(((a) & 0xff000000000000ULL) >> 40) | \
81 				(((a) & 0xff00000000000000ULL) >> 56))
82 
83 #define	GET_32(a)	((uint32_t)(*((uint8_t *)a)) | \
84 				(((uint32_t)(*(((uint8_t *)a) + 1))) << 8) | \
85 				(((uint32_t)(*(((uint8_t *)a) + 2))) << 16) | \
86 				(((uint32_t)(*(((uint8_t *)a) + 3))) << 24))
87 #else
88 #define	SWAP_16(a)	(a)
89 #define	SWAP_32(a)	(a)
90 #define	SWAP_64(a)	(a)
91 
92 #define	GET_32(a)	(*((uint32_t *)a))
93 #endif	/* _BIG_ENDIAN */
94 
95 
96 #define	BCD2HEX_16(a)	(((a) & 0xf) + \
97 			(((ushort_t)((a) & 0xf0) >> 4) * 10) + \
98 			(((ushort_t)((a) & 0xf00) >> 8) * 100) + \
99 			(((ushort_t)((a) & 0xf000) >> 12) * 1000))
100 
101 #define	HEX2BCD_16(a)	((((ushort_t)a) % 10) | \
102 			(((ushort_t)((ushort_t)(a) / 10) % 10) << 4) | \
103 			(((ushort_t)((ushort_t)(a) / 100) % 10) << 8) | \
104 			(((ushort_t)((ushort_t)(a) / 1000) % 10) << 12))
105 
106 #define	ANCHOR_VOL_DESC_LOC	(256)
107 #define	ANCHOR_VOL_DESC_LEN	0x200
108 
109 
110 
111 /* Basic data structures */
112 
113 
114 typedef char dstring_t;
115 
116 
117 /*
118  * recorded at the start of the descriptor
119  * used to distinguish between different
120  * descriptors
121  */
122 struct tag {
123 	uint16_t	tag_id;		/* 00 Tag Identifier */
124 	uint16_t	tag_desc_ver;	/* 02 Descriptor Version */
125 	uint8_t		tag_cksum;	/* 04 Tag Checksum */
126 	uint8_t		tag_res;	/* 05 Reserved */
127 	uint16_t	tag_sno;	/* 06 Tag Serial Number */
128 	uint16_t	tag_crc;	/* 08 Descriptor CRC */
129 	uint16_t	tag_crc_len;	/* 0A Descriptor CRC length */
130 	uint32_t	tag_loc;	/* 0C Tag Location */
131 };
132 typedef struct tag tag_t;
133 
134 /*
135  * descriptor tag id values
136  */
137 
138 #define	UD_PRI_VOL_DESC		0x0001
139 #define	UD_ANCH_VOL_DESC	0x0002
140 #define	UD_VOL_DESC_PTR		0x0003
141 #define	UD_IMPL_USE_DESC	0x0004
142 #define	UD_PART_DESC		0x0005
143 #define	UD_LOG_VOL_DESC		0x0006
144 #define	UD_UNALL_SPA_DESC	0x0007
145 #define	UD_TERM_DESC		0x0008
146 #define	UD_LOG_VOL_INT		0x0009
147 
148 #define	UD_FILE_SET_DESC	0x0100
149 #define	UD_FILE_ID_DESC		0x0101
150 #define	UD_ALLOC_EXT_DESC	0x0102
151 #define	UD_INDIRECT_ENT		0x0103
152 #define	UD_TERMINAL_ENT		0x0104
153 #define	UD_FILE_ENTRY		0x0105
154 #define	UD_EXT_ATTR_HDR		0x0106
155 #define	UD_UNALL_SPA_ENT	0x0107
156 #define	UD_SPA_BMAP_DESC	0x0108
157 #define	UD_PART_INT_DESC	0x0109
158 #define	UD_EXT_FILE_ENT		0x010A
159 
160 
161 
162 
163 /*
164  * Character set's allowed in descriptor fields
165  * shall be specified
166  */
167 struct charspec {
168 	uint8_t		cs_type;	/* 00 Character Set Type */
169 	char		cs_info[63];	/* 01 Character Set Information */
170 };
171 typedef struct charspec charspec_t;
172 
173 #define	CS_TYPE0	0x00
174 #define	CS_TYPE1	0x01
175 #define	CS_TYPE2	0x02
176 #define	CS_TYPE3	0x03
177 #define	CS_TYPE4	0x04
178 #define	CS_TYPE5	0x05
179 #define	CS_TYPE6	0x06
180 #define	CS_TYPE7	0x07
181 #define	CS_TYPE8	0x08
182 
183 
184 
185 /*
186  * Entity Identification
187  */
188 struct regid {
189 	uint8_t		reg_flags;	/* 00 Flags */
190 	char		reg_id[23];	/* 01 Identifier */
191 	char		reg_ids[8];	/* 18 Identifier Suffix */
192 };
193 typedef struct regid regid_t;
194 
195 #define	EI_FLAG_DIRTY		0x00
196 #define	EI_FLAG_PROT		0x01
197 
198 struct lb_addr {
199 	/* uint32_t	lba_number;	00 Logical Block Number */
200 	/* uint8_t	lba_prn[2];	04 Partition Reference Number */
201 	char		lba_aaa[6];
202 };
203 typedef	struct lb_addr lb_addr_t;
204 #define	lba_number(x)(((x)->lba_aaa[0]) | \
205 			((x)->lba_aaa[1] << 8) | \
206 			((x)->lba_aaa[2] << 16) | \
207 			((x)->lba_aaa[3] << 24))
208 
209 #define	lba_prn(x)	((x)->lba_aaa[4] | ((x)->lba_aaa[5] << 8))
210 
211 
212 /*
213  * Extend Descriptor
214  */
215 struct extent_ad {
216 	uint32_t	ext_len;	/* 00 Extent Length */
217 	uint32_t	ext_loc;	/* 04 Extent Location */
218 };
219 typedef struct extent_ad extent_ad_t;
220 
221 /*
222  * Short Allocation Descriptor
223  */
224 struct short_ad {
225 	uint32_t	sad_ext_len;	/* 00 Extent Length */
226 	uint32_t	sad_ext_loc;	/* 04 extent Position */
227 };
228 typedef struct short_ad short_ad_t;
229 
230 /*
231  * Long Allocation Descriptor
232  */
233 struct long_ad {
234 	uint32_t	lad_ext_len;	/* 00 Extent Length */
235 	uint32_t	lad_ext_loc;	/* 04 Extent Location */
236 	uint16_t	lad_ext_prn;	/* 08 Extent part ref no */
237 	/* lb_addr_t	lad_ext_loc;	 04 Extent Location */
238 	char		lad_iu[6];	/* 0A Implementation Use */
239 };
240 typedef struct long_ad long_ad_t;
241 
242 
243 
244 
245 /*
246  * Format to record date and time
247  * If zero date & time is not specified
248  */
249 struct tstamp {
250 	uint16_t	ts_tzone;	/* 00 Type and Time Zone */
251 	uint16_t	ts_year;	/* 02 Year */
252 	uint8_t		ts_month;	/* 04 Month */
253 	uint8_t		ts_day;		/* 05 Day */
254 	uint8_t		ts_hour;	/* 06 Hour */
255 	uint8_t		ts_min;		/* 07 Minute */
256 	uint8_t		ts_sec;		/* 08 Second */
257 	uint8_t		ts_csec;	/* 09 Centi-seconds */
258 	uint8_t		ts_husec;	/* 0A Hundreds of Micro sec's */
259 	uint8_t		ts_usec;	/* 0B Micro-seconds */
260 };
261 typedef struct tstamp tstamp_t;
262 
263 
264 /*
265  * ts_tzone
266  */
267 #define	TMODE		0xF000
268 #define	TSIGN		0x0800
269 #define	TOFFSET		0x07FF
270 #define	TINVALID	(TSIGN|TOFFSET)
271 
272 
273 /*
274  * Format of the ICB tag which specifies
275  * most of the infomation of the file
276  */
277 struct icb_tag {
278 	uint32_t	itag_prnde;	/* 00 Prior Recorded No of Dir Entry */
279 	uint16_t	itag_strategy;	/* 04 Strategy Type */
280 	uint16_t	itag_param;	/* 06 Strategy parameter */
281 	uint16_t	itag_max_ent;	/* 08 Maximum No of Entries */
282 	uint8_t		itag_rsvd;	/* 0A Reserved */
283 	uint8_t		itag_ftype;	/* 0B File Type */
284 	/* lb_addr_t	itag_lb_addr;	0C parent ICB Location */
285 	uint32_t	itag_lb_loc;	/* 0C */
286 	uint16_t	itag_lb_prn;	/* 10 */
287 	uint16_t	itag_flags;	/* 12 Flags */
288 };
289 typedef struct icb_tag icb_tag_t;
290 
291 /*
292  * Different strategy types for the file
293  * For DVD_ROM we use onlt type4
294  */
295 #define	STRAT_TYPE1		0x0001
296 #define	STRAT_TYPE2		0x0002
297 #define	STRAT_TYPE3		0x0003
298 #define	STRAT_TYPE4		0x0004
299 #define	STRAT_TYPE4096		0x1000
300 
301 /*
302  * File types
303  */
304 #define	FTYPE_UNALL_SPACE	0x01
305 #define	FTYPE_PART_INTEG	0x02
306 #define	FTYPE_INDIRECT		0x03
307 #define	FTYPE_DIRECTORY		0x04
308 #define	FTYPE_FILE		0x05
309 #define	FTYPE_BLOCK_DEV		0x06
310 #define	FTYPE_CHAR_DEV		0x07
311 #define	FTYPE_EAR		0x08
312 #define	FTYPE_FIFO		0x09
313 #define	FTYPE_C_ISSOCK		0x0A
314 #define	FTYPE_T_ENTRY		0x0B
315 #define	FTYPE_SYMLINK		0x0C
316 
317 /*
318  * Flags
319  */
320 #define	ICB_FLAG_SHORT_AD	0x0000
321 #define	ICB_FLAG_LONG_AD	0x0001
322 #define	ICB_FLAG_EXT_AD		0x0002
323 #define	ICB_FLAG_ONE_AD		0x0003
324 #define	ICB_FLAG_SORTED		0x0008
325 #define	ICB_FLAG_NON_RELOC	0x0010
326 #define	ICB_FLAG_ARCHIVE	0x0020
327 #define	ICB_FLAG_SETUID		0x0040
328 #define	ICB_FLAG_SETGID		0x0080
329 #define	ICB_FLAG_STICKY		0x0100
330 #define	ICB_FLAG_CONTIG		0x0200
331 #define	ICB_FLAG_SYSTEM		0x0400
332 #define	ICB_FLAG_TRNSFRMED	0x0800
333 #define	ICB_FLAG_MVERS		0x1000
334 
335 
336 
337 
338 /* Volume recognition descriptors */
339 
340 
341 
342 
343 /*
344  * Primary volume descriptor identifis the
345  * volume and certain attributes of the volume
346  */
347 struct pri_vol_desc {
348 	tag_t		pvd_tag;	/* 00 Descriptor Tag */
349 	uint32_t	pvd_vdsn;	/* 10 Volume Descriptor Seq Num */
350 	uint32_t	pvd_pvdn;	/* 14 Primary Vol Desc Num */
351 	dstring_t	pvd_vol_id[32];	/* 18 Volume Identifier */
352 	uint16_t	pvd_vsn;	/* 38 Volume Sequence Num */
353 	uint16_t	pvd_mvsn;	/* 3A Max Volume Sequence Num */
354 	uint16_t	pvd_il;		/* 3C Interchange Level */
355 	uint16_t	pvd_mil;	/* 3E Max Interchange Level */
356 	uint32_t	pvd_csl;	/* 40 Character Set List */
357 	uint32_t	pvd_mcsl;	/* 44 Max Character Set List */
358 	dstring_t	pvd_vsi[128];	/* 48 Volume Set Identifier */
359 	charspec_t	pvd_desc_cs;	/* C8 Descriptor Character Set */
360 	charspec_t	pvd_exp_cs;	/* 108 Explanatory Char Set */
361 	extent_ad_t	pvd_vol_abs;	/* 148 Volume Abstract */
362 	extent_ad_t	pvd_vcn;	/* 150 Volume Copyright Notice */
363 	regid_t		pvd_appl_id;	/* 158 Application Identifier */
364 	tstamp_t	pvd_time;	/* 178 Recording Data & Time */
365 	regid_t		pvd_ii;		/* 184 Implementation Identifier */
366 	char		pvd_iu[64];	/* 1A4 Implementation Use */
367 	uint32_t	pvd_pvdsl;	/* 1E4 Pred Vol Desc Seq Loc */
368 	uint16_t	pvd_flags;	/* 1E8 Flags */
369 	uint8_t		pvd_res[22];	/* 1EA Reserved */
370 };
371 
372 
373 
374 
375 /*
376  * Anchor Volume Descriptor Pointer specifies
377  * the extent of Main & Reserve volume descriptor
378  */
379 struct anch_vol_desc_ptr {
380 	tag_t		avd_tag;	/* 00 Descriptor Tag */
381 	extent_ad_t	avd_main_vdse;	/* 10 Main Vol Desc Seq Extent */
382 	extent_ad_t	avd_res_vdse;	/* 18 Reserve Vol Desc Seq Ext */
383 	char		avd_res[480];	/* 20 Reserved */
384 };
385 typedef struct anch_vol_desc_ptr anch_vol_desc_ptr_t;
386 
387 
388 
389 
390 /*
391  * Volume Descriptor Pointer
392  */
393 struct vol_desc_ptr {
394 	tag_t		vdp_tag;	/* 00 Descriptor Tag */
395 	uint32_t	vdp_vdsn;	/* 10 Volume Descriptor Seq Num */
396 	extent_ad_t	vdp_nvdse;	/* 14 Next Vol Desc Seq Extent */
397 	uint8_t		vdp_res[484];	/* 1A Reserved */
398 };
399 typedef struct vol_desc_ptr vol_desc_ptr_t;
400 
401 
402 
403 
404 /*
405  * Implementation Use Volume Descriptor
406  * This is taken from udf1.02/1.50 documents
407  * the fields after iuvd_ii are defined only
408  * for the udf domain
409  */
410 struct iuvd_desc {
411 	tag_t		iuvd_tag;	/* 00 Descriptor Tag */
412 	uint32_t	iuvd_vdsn;	/* 10 Volume Desc Seq Num */
413 	regid_t		iuvd_ii;	/* 14 Domain Identifier */
414 	charspec_t	iuvd_cset;	/* 34 LVI Charset */
415 	dstring_t	iuvd_lvi[128];	/* 74 Logical Vol Identifier */
416 	dstring_t	iuvd_ifo1[36];	/* F4 LV Info1 */
417 	dstring_t	iuvd_ifo2[36];	/* 118 LV Info2 */
418 	dstring_t	iuvd_ifo3[36];	/* 13C LV Info3 */
419 	regid_t		iuvd_iid;	/* 160 Implementation ID */
420 	uint8_t		iuvd_iu[128];	/* 180 Implementation Use */
421 };
422 typedef struct iuvd_desc iuvd_desc_t;
423 
424 
425 
426 
427 
428 /*
429  * Partition Descriptor
430  * specifies the size and location of the partition
431  */
432 struct part_desc {
433 	tag_t		pd_tag;		/* 00 Descriptor Tag */
434 	uint32_t	pd_vdsn;	/* 10 Volume Desc Seq Num */
435 	uint16_t	pd_pflags;	/* 14 Partition Flags */
436 	uint16_t	pd_pnum;	/* 16 partition Number */
437 	regid_t		pd_pcontents;	/* 18 Partition Contents */
438 	uint8_t		pd_pc_use[128];	/* 38 Partition Contents Use */
439 	uint32_t	pd_acc_type;	/* B8 Access Type */
440 	uint32_t	pd_part_start;	/* BC Part Start Location */
441 	uint32_t	pd_part_length;	/* C0 partition Length */
442 	regid_t		pd_ii;		/* C4 Implementation Identifier */
443 	uint8_t		pd_iu[128];	/* E4 Implementation Use */
444 	uint8_t		pd_res[156];	/* 164 Reserved */
445 };
446 typedef struct part_desc part_desc_t;
447 
448 
449 /*
450  * pd_acc_type
451  */
452 #define	PART_ACC_RO	0x01
453 #define	PART_ACC_WO	0x02
454 #define	PART_ACC_RW	0x03
455 #define	PART_ACC_OW	0x04
456 
457 
458 /*
459  * Partition Header Descriptor
460  * Overloads pd_pc_use
461  */
462 struct phdr_desc {
463 	struct short_ad	phdr_ust;		/* Unallocated Space Table */
464 	struct short_ad	phdr_usb;		/* Unallocated Space Bitmap */
465 	struct short_ad	phdr_it;		/* Partition Integrity Table */
466 	struct short_ad	phdr_fst;		/* Freed Space Table */
467 	struct short_ad	phdr_fsb;		/* Freed Space Bitmap */
468 };
469 typedef struct phdr_desc phdr_desc_t;
470 
471 
472 
473 
474 
475 
476 /*
477  * Logical Volume Descriptor
478  */
479 struct log_vol_desc {
480 	tag_t		lvd_tag;	/* 00 Descriptor Tag */
481 	uint32_t	lvd_vdsn;	/* 10 Volume Desc Seq Num */
482 	charspec_t	lvd_desc_cs;	/* 14 Descriptor Char Set */
483 	dstring_t	lvd_lvid[128];	/* 54 Logical Vol Identifier */
484 	uint32_t	lvd_log_bsize;	/* D4 Logical Block Size */
485 	regid_t		lvd_dom_id;	/* D8 Domain Identifier */
486 	long_ad_t	lvd_lvcu;	/* F8 Logical Vol Contents Use */
487 	uint32_t	lvd_mtbl_len;	/* 108 Map Table Length */
488 	uint32_t	lvd_num_pmaps;	/* 10C Number of Partition Maps */
489 	regid_t		lvd_ii;		/* 110 Implementation Identifier */
490 	uint8_t		lvd_iu[128];	/* 130 Implementation Use */
491 	extent_ad_t	lvd_int_seq_ext; /* 1B0 Integrity Sequence Extent */
492 	uint8_t		lvd_pmaps[72];	/* 1B8 Partition Maps */
493 };
494 typedef struct log_vol_desc log_vol_desc_t;
495 
496 
497 
498 
499 
500 /*
501  * Unallocated Space Descriptor
502  * Contains information about the space
503  * that does not belong to any of the
504  * partition
505  */
506 struct unall_spc_desc {
507 	tag_t		ua_tag;		/* 00 Descriptor Tag */
508 	uint32_t	ua_vdsn;	/* 10 Volume Desc Seq Num */
509 	uint32_t	ua_nad;		/* 14 Number of Allocation Desc */
510 	uint8_t		ua_al_dsc[488];	/* 18 Allocation Desc */
511 };
512 typedef struct unall_spc_desc unall_spc_desc_t;
513 
514 
515 
516 
517 /*
518  * Terminating Descriptor
519  * this will be the last in a Volume Descriptor Sequence
520  */
521 struct term_desc {
522 	tag_t		td_tag;		/* 00 Descriptor Tag */
523 	uint8_t		td_res[496];	/* 10 Reserved */
524 };
525 typedef struct term_desc term_desc_t;
526 
527 
528 /*
529  * Logical Volume Header Descriptor
530  * This will be overlaid on lvid_lvcu
531  * and will contain the maximum value of
532  * unique id on the media
533  */
534 struct log_vol_hdr_desc {
535 	uint64_t	lvhd_uniqid;	/* 00 Unique Id */
536 	uint8_t		lvhd_pad[24];	/* 08 reserved */
537 };
538 typedef struct log_vol_hdr_desc log_vol_hdr_desc_t;
539 
540 /*
541  * Logical Volume Integrity Sequence
542  * This will contain the integrity of the
543  * file system
544  */
545 struct log_vol_int_desc {
546 	tag_t		lvid_tag;	/* 00 Descriptor Tag */
547 	tstamp_t	lvid_tstamp;	/* 10 Recording Date and Time */
548 	uint32_t	lvid_int_type;	/* 1C Integrity Type */
549 	extent_ad_t	lvid_nie;	/* 20 Next Integrity Extent */
550 	/* uint8_t	lvid_lvcu[32]; */
551 	log_vol_hdr_desc_t lvid_lvcu;	/* 28 Logical Volume Contents Use */
552 	uint32_t	lvid_npart;	/* 48 Number of Partitions */
553 	uint32_t	lvid_liu;	/* 4C Length of Implementation Use */
554 	uint32_t	lvid_fst[2];	/* 50 Free Space Table */
555 					/* Size Table */
556 					/* Implementation Use */
557 };
558 typedef struct log_vol_int_desc log_vol_int_desc_t;
559 
560 #define	lvid_uniqid	lvid_lvcu.lvhd_uniqid
561 
562 
563 #define	LOG_VOL_OPEN_INT	0x00
564 #define	LOG_VOL_CLOSE_INT	0x01
565 
566 
567 /*
568  * Logical Volume integrity Implementation Use
569  * This is defined in udf spec
570  */
571 struct lvid_iu {
572 	regid_t		lvidiu_regid;	/* 00 Implementation ID */
573 	uint32_t	lvidiu_nfiles;	/* 20 Number of Files */
574 	uint32_t	lvidiu_ndirs;	/* 24 Number of Directories */
575 	uint16_t	lvidiu_mread;	/* 28 Minimum UDF read revision */
576 	uint16_t	lvidiu_mwrite;	/* 2A Minimum UDF write revision */
577 	uint16_t	lvidiu_maxwr;	/* 2C Maximum UDF write revision */
578 };
579 
580 
581 
582 
583 
584 
585 
586 /*
587  * File Set Descriptor
588  * This will point to the root directory.
589  */
590 struct file_set_desc {
591 	tag_t		fsd_tag;	/* 00 Descriptor Tag */
592 	tstamp_t	fsd_time;	/* 10 Recording Date and Time */
593 	uint16_t	fsd_ilevel;	/* 1C Interchange Level */
594 	uint16_t	fsd_mi_level;	/* 1E Max Interchange Level */
595 	uint32_t	fsd_cs_list;	/* 20 Character Set List */
596 	uint32_t	fsd_mcs_list;	/* 24 Max Character Set List */
597 	uint32_t	fsd_fs_no;	/* 28 File Set Number */
598 	uint32_t	fsd_fsd_no;	/* 2C File Set Desc Number */
599 	charspec_t	fsd_lvidcs;	/* 30 Log Vol Id Char Set */
600 	char		fsd_lvid[128];	/* 70 Log Vol Identifier */
601 	charspec_t	fsd_fscs;	/* F0 File Set Character Set */
602 	char		fsd_fsi[32];	/* 130 File Set Identifier */
603 	char		fsd_cfi[32];	/* 150 Copyright File Identifier */
604 	char		fsd_afi[32];	/* 170 Abstract File identifier */
605 	long_ad_t	fsd_root_icb;	/* 190 Root Directory ICB */
606 	regid_t		fsd_did;	/* 1A0 Domain Identifier */
607 	long_ad_t	fsd_next;	/* 1C0 Next Extent */
608 	uint8_t		fsd_res[48];	/* 1D0 Reserved */
609 };
610 typedef struct file_set_desc file_set_desc_t;
611 
612 
613 
614 
615 
616 
617 
618 /*
619  * File Identifier Descriptor
620  * Directory entries
621  */
622 struct file_id {
623 	tag_t		fid_tag;	/* 00 Descriptor Tag */
624 	uint16_t	fid_ver;	/* 10 File Version Number */
625 	uint8_t		fid_flags;	/* 12 File characteristics */
626 	uint8_t		fid_idlen;	/* 13 Length File Identifier */
627 	long_ad_t	fid_icb;	/* 14 ICB */
628 	uint16_t	fid_iulen;	/* 24 Length of Implmentation use */
629 	uint8_t		fid_spec[2];	/* iulen for iu name and padding */
630 };
631 typedef struct file_id file_id_t;
632 
633 #define	FID_EXIST	0x01
634 #define	FID_DIR		0x02
635 #define	FID_DELETED	0x04
636 #define	FID_PARENT	0x08
637 
638 
639 
640 
641 
642 
643 
644 /*
645  * Allocation Extent Descriptor
646  */
647 struct alloc_ext_desc {
648 	tag_t		aed_tag;	/* 00 Descriptor Tag */
649 	uint32_t	aed_rev_ael;	/* 10 Previous Alloc Extent Location */
650 	uint32_t	aed_len_aed;	/* 14 Length of Allocation Desc */
651 };
652 typedef struct alloc_ext_desc alloc_ext_desc_t;
653 
654 
655 
656 
657 
658 /*
659  * Indirect Entry
660  * used to specify the address of another ICB
661  */
662 struct indirect_entry {
663 	tag_t		ie_tag;		/* 00 Descriptor Tag */
664 	icb_tag_t	ie_icb_tag;	/* 10 ICB tag */
665 	long_ad_t	ie_indirecticb;	/* 24 Indirect ICB */
666 };
667 typedef struct indirect_entry indirect_entry_t;
668 
669 
670 
671 
672 /*
673  * Terminal Entry
674  */
675 struct term_entry {
676 	tag_t		te_tag;		/* 00 Descriptor Tag */
677 	icb_tag_t	te_icb_tag;	/* 10 ICB tag */
678 };
679 typedef struct term_entry term_entry_t;
680 
681 
682 
683 
684 /*
685  * File entry describes the
686  * file attributes and location it is recorded on the media
687  */
688 struct file_entry {
689 	tag_t		fe_tag;		/* 00 Descriptor Tag */
690 	icb_tag_t	fe_icb_tag;	/* 10 ICB tag */
691 	uint32_t	fe_uid;		/* 24 Uid */
692 	uint32_t	fe_gid;		/* 28 Gid */
693 	uint32_t	fe_perms;	/* 2C Permissions */
694 	uint16_t	fe_lcount;	/* 30 File Link Count */
695 	uint8_t		fe_rec_for;	/* 32 Record Format */
696 	uint8_t		fe_rec_dis;	/* 33 Record Display Attributes */
697 	uint32_t	fe_rec_len;	/* 34 Record Length */
698 	uint64_t	fe_info_len;	/* 38 Information Length */
699 	uint64_t	fe_lbr;		/* 40 Logical Blocks recorded */
700 	tstamp_t	fe_acc_time;	/* 48 Access Data and Time */
701 	tstamp_t	fe_mod_time;	/* 54 Modification Data and Time */
702 	tstamp_t	fe_attr_time;	/* 60 Attribute Data and Time */
703 	uint32_t	fe_ckpoint;	/* 6C Checkpoint */
704 	long_ad_t	fe_ea_icb;	/* 70 Extended Attr ICB */
705 	regid_t		fe_impl_id;	/* 80 Implementation Identifier */
706 	uint64_t	fe_uniq_id;	/* A0 Unique Id */
707 	uint32_t	fe_len_ear;	/* A8 Length of Extended Attr */
708 	uint32_t	fe_len_adesc;	/* AC Length of Alloc Desc */
709 	char		fe_spec[336];	/* B0 used for EA and AD's */
710 };
711 typedef struct file_entry file_entry_t;
712 
713 
714 
715 
716 
717 /*
718  * Extended Attribute Header
719  */
720 struct ext_attr_hdr {
721 	tag_t		eah_tag;	/* 00 Descriptor Tag */
722 	uint32_t	eah_ial;	/* 10 Implementation Attr Location */
723 	uint32_t	eah_aal;	/* 14 Application Attr Location */
724 };
725 typedef struct ext_attr_hdr ext_attr_hdr_t;
726 
727 
728 
729 
730 
731 
732 
733 /*
734  * Unallocated Space Entry
735  */
736 struct unall_space_ent {
737 	tag_t		use_tag;	/* 00 Descriptor Tag */
738 	icb_tag_t	use_icb_tag;	/* 10 ICB tag */
739 	uint32_t	use_len_ad;	/* 24 Lenght of Allocation desc */
740 	uint8_t		use_ad[484];	/* 28 Allocation Descriptors */
741 };
742 typedef struct unall_space_ent unall_space_ent_t;
743 
744 
745 
746 
747 
748 /*
749  * Space Bitmap Descriptor
750  */
751 struct space_bmap_desc {
752 	tag_t		sbd_tag;	/* 00 Descriptor Tag */
753 	uint32_t	sbd_nbits;	/* 10 Number of Bits */
754 	uint32_t	sbd_nbytes;	/* 14 Number of Bytes */
755 	uint8_t		sbd_bmap[500];	/* 18 Bitmap */
756 };
757 typedef struct space_bmap_desc space_bmap_desc_t;
758 
759 
760 
761 
762 
763 /*
764  * Partition Integrity entry
765  */
766 struct part_int_desc {
767 	tag_t		pid_tag;	/* 00 Descriptor Tag */
768 	icb_tag_t	pid_idb_tag;	/* 10 ICB tag */
769 	tstamp_t	pid_rtime;	/* 24 Recording Data and Time */
770 	uint8_t		pid_integ;	/* 30 Integrity type */
771 	uint8_t		pid_res[175];	/* 31 Reserved */
772 	regid_t		pid_ii;		/* E0 Implementation Identifier */
773 	uint8_t		pid_iu[256];	/* 100 Implementation Use */
774 };
775 typedef struct part_int_desc part_int_desc_t;
776 
777 
778 #define	PART_OPEN_INT		0x00
779 #define	PART_CLOSE_INT		0x01
780 #define	PART_STABLE_INT		0x02
781 
782 
783 
784 
785 struct attr_hdr {
786 	uint32_t	ahdr_atype;	/* Attribute Type */
787 	uint8_t		ahdr_astype;	/* Attribute Subtype */
788 	uint8_t		ahdr_res[3];	/* Reserved */
789 	uint32_t	ahdr_length;	/* Attribute Length */
790 	uint8_t		ahdr_data[4];	/* Attribute Data */
791 };
792 
793 /*
794  * We will support and use the
795  * following Extended Attributes
796  * we will ignore others while reading
797  * and will preserve then when updating
798  * the EAR's
799  * In all the EA's we allocate the last member
800  * as 4 bytes. This is a sort of hack
801  * since the structure has to be
802  * properly alined to 4 bytes.
803  */
804 
805 struct dev_spec_ear {
806 	uint32_t	ds_atype;	/* 00 Attribute Type */
807 	uint8_t		ds_astype;	/* 04 Attribute Subtype */
808 	uint8_t		ds_res[3];	/* 05 Reserved */
809 	uint32_t	ds_attr_len;	/* 08 Attrbute Length */
810 	uint32_t	ds_iu_len;	/* 0C Impl Use Length */
811 	uint32_t	ds_major_id;	/* 10 Major Device ID */
812 	uint32_t	ds_minor_id;	/* 14 Minor Device ID */
813 	uint8_t		ds_iu[4];	/* 18 Implementation Use */
814 };
815 
816 
817 struct ftimes_ear {
818 	uint32_t	ft_atype;	/* 00 Attribute Type */
819 	uint8_t		ft_astype;	/* 04 Attribute Subtype */
820 	uint8_t		ft_res[3];	/* 05 Reserved */
821 	uint32_t	ft_attr_len;	/* 08 Attrbute Length */
822 	uint32_t	ft_data_len;	/* 0C Data Length */
823 	uint32_t	ft_exist;	/* 10 File Time Existence */
824 	uint8_t		ft_ft[4];	/* 14 File Times */
825 };
826 
827 /* ft_exit */
828 #define	FT_EXIST	0x0
829 #define	FT_DELETE	0x2
830 #define	FT_FEDT		0x3
831 #define	FT_BACKUP	0x5
832 
833 struct iu_ea {
834 	uint32_t	iuea_atype;	/* 00 Attribute Type */
835 	uint8_t		iuea_astype;	/* 04 Attribute Subtype */
836 	uint8_t		iuea_res[3];	/* 05 Reserved */
837 	uint32_t	iuea_attr_len;	/* 08 Attrbute Length */
838 	uint32_t	iuea_iu_len;	/* 0C Implementation Use Length */
839 	regid_t		iuea_ii;		/* 10 Implementation ID */
840 	uint8_t		iuea_iu[4];	/* 30 Impl Use */
841 };
842 
843 
844 /*
845  * CGMS & FREE_SPACE will be
846  * over laid on iu_iu field
847  */
848 
849 struct copy_mgt_info {
850 	uint16_t	cgms_cksum;	/* Header Checksum */
851 	uint8_t		cgms_info;	/* CGMS Information */
852 	uint8_t		cgms_dstype;	/* Data Structure Type */
853 	uint32_t	cgms_psi;	/* Protection System Info */
854 };
855 
856 #define	COPY_PROTECTED	0x80
857 
858 struct FREE_SPACE {
859 	uint16_t	fs_cksum;	/* Header Checksum */
860 	uint8_t		fs_freesp[2];	/* Free EA space */
861 };
862 
863 
864 
865 
866 struct nsr_desc {
867 	uint8_t		nsr_str_type;
868 	uint8_t		nsr_id[5];
869 	uint8_t		nsr_ver;
870 	uint8_t		nsr_res;
871 	uint8_t		nsr_data[2040];
872 };
873 
874 
875 
876 /*
877  * Partition Map
878  */
879 struct pmap_hdr {
880 	uint8_t		maph_type;	/* Partition Map Type */
881 	uint8_t		maph_length;	/* Partition Map Length */
882 };
883 
884 #define	MAP_TYPE1	1
885 #define	MAP_TYPE2	2
886 
887 #define	MAP_TYPE1_LEN	6
888 #define	MAP_TYPE2_LEN	64
889 
890 struct pmap_typ1 {
891 	uint8_t		map1_type;	/* Map type == 1 */
892 	uint8_t		map1_length;	/* Map length == 6 */
893 	uint16_t	map1_vsn;	/* Volume Sequence Number */
894 	uint16_t	map1_pn;	/* Partition Number */
895 };
896 
897 
898 /*
899  * Only two types of type2 maps
900  * are supported they are
901  * *UDF Virtual Partition
902  * *UDF Sparable Partition
903  * For vpm fields till map2_pn
904  * are valid and the entire structure is
905  * valid for spm
906  */
907 struct pmap_typ2 {
908 	uint8_t		map2_type;	/* 00 Map type == 2 */
909 	uint8_t		map2_length;	/* 01 Map length == 64 */
910 	uint16_t	map2_pad1;	/* 02 Reserved */
911 	regid_t		map2_pti;	/* 04 Entiry ID */
912 	uint16_t	map2_vsn;	/* 24 Volume Sequence Number */
913 	uint16_t	map2_pn;	/* 26 Partition Number */
914 	uint16_t	map2_pl;	/* 28 Packet Length == 32 */
915 	uint8_t		map2_nst;	/* 2A Number of sparing tables */
916 	uint8_t		map2_pad2;	/* 2B Reserved */
917 	uint32_t	map2_sest;	/* 2C Size of each sparing table */
918 	uint32_t	map2_st[4];	/* 30 sparing Tables */
919 };
920 
921 
922 struct stbl_entry {
923 	uint32_t	sent_ol;	/* Original Location */
924 	uint32_t	sent_ml;	/* Mapped Location */
925 };
926 
927 typedef struct stbl_entry stbl_entry_t;
928 
929 struct stbl {
930 	tag_t		stbl_tag;	/* 00 Tag */
931 	regid_t		stbl_si;	/* 10 Sparing Identifier */
932 	uint16_t	stbl_len;	/* 30 Reallocation Table Len */
933 	uint16_t	stbl_res1;	/* 32 Reserved */
934 	uint32_t	stbl_seqno;	/* 34 Sequence Number */
935 	stbl_entry_t	stbl_entry;	/* 38 Sparing Table Entries */
936 };
937 
938 struct path_comp {
939 	uint8_t		pc_type;	/* Component Type */
940 	uint8_t		pc_len;		/* Length of Component ID */
941 	uint16_t	pc_ver;		/* Component File Version Number */
942 	uint8_t		pc_id[4];	/* Component ID */
943 };
944 
945 #ifdef	__cplusplus
946 }
947 #endif
948 
949 #endif	/* _SYS_FS_UDF_VOLUME_H */
950