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