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