[BACK]Return to ecma167-udf.h CVS log [TXT][DIR] Up to [local] / sys / isofs / udf

Annotation of sys/isofs/udf/ecma167-udf.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: ecma167-udf.h,v 1.6 2006/07/04 01:11:29 pedro Exp $   */
                      2:
                      3: /*
                      4:  * Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
                      5:  * All rights reserved.
                      6:  *
                      7:  * Redistribution and use in source and binary forms, with or without
                      8:  * modification, are permitted provided that the following conditions
                      9:  * are met:
                     10:  * 1. Redistributions of source code must retain the above copyright
                     11:  *    notice, this list of conditions and the following disclaimer.
                     12:  * 2. Redistributions in binary form must reproduce the above copyright
                     13:  *    notice, this list of conditions and the following disclaimer in the
                     14:  *    documentation and/or other materials provided with the distribution.
                     15:  *
                     16:  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
                     17:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     18:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     19:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
                     20:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     21:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     22:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     23:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     24:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     25:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     26:  * SUCH DAMAGE.
                     27:  *
                     28:  * $FreeBSD: src/sys/fs/udf/ecma167-udf.h,v 1.4 2002/09/23 18:54:30 alfred Exp $
                     29:  */
                     30:
                     31: /* ecma167-udf.h */
                     32: /* Structure/definitions/constants a la ECMA 167 rev. 3 */
                     33:
                     34: /* Tag identifiers */
                     35: enum {
                     36:        TAGID_PRI_VOL =         1,
                     37:        TAGID_ANCHOR =          2,
                     38:        TAGID_VOL =             3,
                     39:        TAGID_IMP_VOL =         4,
                     40:        TAGID_PARTITION =       5,
                     41:        TAGID_LOGVOL =          6,
                     42:        TAGID_UNALLOC_SPACE =   7,
                     43:        TAGID_TERM =            8,
                     44:        TAGID_LOGVOL_INTEGRITY = 9,
                     45:        TAGID_FSD =             256,
                     46:        TAGID_FID =             257,
                     47:        TAGID_FENTRY =          261
                     48: };
                     49:
                     50: /* Descriptor tag [3/7.2] */
                     51: struct desc_tag {
                     52:        uint16_t        id;
                     53:        uint16_t        descriptor_ver;
                     54:        uint8_t         cksum;
                     55:        uint8_t         reserved;
                     56:        uint16_t        serial_num;
                     57:        uint16_t        desc_crc;
                     58:        uint16_t        desc_crc_len;
                     59:        uint32_t        tag_loc;
                     60: } __packed;
                     61:
                     62: /* Recorded Address [4/7.1] */
                     63: struct lb_addr {
                     64:        uint32_t        lb_num;
                     65:        uint16_t        part_num;
                     66: } __packed;
                     67:
                     68: /* Extent Descriptor [3/7.1] */
                     69: struct extent_ad {
                     70:        uint32_t        len;
                     71:        uint32_t        loc;
                     72: } __packed;
                     73:
                     74: /* Short Allocation Descriptor [4/14.14.1] */
                     75: struct short_ad {
                     76:        uint32_t        len;
                     77:        uint32_t        pos;
                     78: } __packed;
                     79:
                     80: /* Long Allocation Descriptor [4/14.14.2] */
                     81: struct long_ad {
                     82:        uint32_t        len;
                     83:        struct lb_addr  loc;
                     84:        uint16_t        ad_flags;
                     85:        uint32_t        ad_id;
                     86: } __packed;
                     87:
                     88: /* Extended Allocation Descriptor [4/14.14.3] */
                     89: struct ext_ad {
                     90:        uint32_t        ex_len;
                     91:        uint32_t        rec_len;
                     92:        uint32_t        inf_len;
                     93:        struct lb_addr  ex_loc;
                     94:        uint8_t         reserved[2];
                     95: } __packed;
                     96:
                     97: union icb {
                     98:        struct short_ad s_ad;
                     99:        struct long_ad  l_ad;
                    100:        struct ext_ad   e_ad;
                    101: };
                    102:
                    103: /* Character set spec [1/7.2.1] */
                    104: struct charspec {
                    105:        uint8_t         type;
                    106:        uint8_t         inf[63];
                    107: } __packed;
                    108:
                    109: /* Timestamp [1/7.3] */
                    110: struct timestamp {
                    111:        uint16_t        type_tz;
                    112:        uint16_t        year;
                    113:        uint8_t         month;
                    114:        uint8_t         day;
                    115:        uint8_t         hour;
                    116:        uint8_t         minute;
                    117:        uint8_t         second;
                    118:        uint8_t         centisec;
                    119:        uint8_t         hund_usec;
                    120:        uint8_t         usec;
                    121: } __packed;
                    122:
                    123: /* Entity Identifier [1/7.4] */
                    124: #define        UDF_REGID_ID_SIZE       23
                    125: struct regid {
                    126:        uint8_t         flags;
                    127:        uint8_t         id[UDF_REGID_ID_SIZE];
                    128:        uint8_t         id_suffix[8];
                    129: } __packed;
                    130:
                    131: /* ICB Tag [4/14.6] */
                    132: struct icb_tag {
                    133:        uint32_t        prev_num_dirs;
                    134:        uint16_t        strat_type;
                    135:        uint8_t         strat_param[2];
                    136:        uint16_t        max_num_entries;
                    137:        uint8_t         reserved;
                    138:        uint8_t         file_type;
                    139:        struct lb_addr  parent_icb;
                    140:        uint16_t        flags;
                    141: } __packed;
                    142:
                    143: #define        UDF_ICB_TYPE_VAT_150            0x00
                    144: #define        UDF_ICB_TYPE_DIR                0x04
                    145: #define        UDF_ICB_TYPE_FILE               0x05
                    146: #define        UDF_ICB_TYPE_BLKDEV             0x06
                    147: #define        UDF_ICB_TYPE_CHRDEV             0x07
                    148: #define        UDF_ICB_TYPE_FIFO               0x09
                    149: #define        UDF_ICB_TYPE_SOCKET             0x0a
                    150: #define        UDF_ICB_TYPE_SYMLINK            0x0c
                    151: #define        UDF_ICB_TYPE_VAT_250            0xf8
                    152: #define        UDF_ICB_TAG_FLAGS_SETUID        0x40
                    153: #define        UDF_ICB_TAG_FLAGS_SETGID        0x80
                    154: #define        UDF_ICB_TAG_FLAGS_STICKY        0x100
                    155:
                    156: /* Anchor Volume Descriptor Pointer [3/10.2] */
                    157: struct anchor_vdp {
                    158:        struct desc_tag         tag;
                    159:        struct extent_ad        main_vds_ex;
                    160:        struct extent_ad        reserve_vds_ex;
                    161: } __packed;
                    162:
                    163: /* Volume Descriptor Pointer [3/10.3] */
                    164: struct vol_desc_ptr {
                    165:        struct desc_tag         tag;
                    166:        uint32_t                vds_number;
                    167:        struct extent_ad        next_vds_ex;
                    168: } __packed;
                    169:
                    170: /* Primary Volume Descriptor [3/10.1] */
                    171: struct pri_vol_desc {
                    172:        struct desc_tag         tag;
                    173:        uint32_t                seq_num;
                    174:        uint32_t                pdv_num;
                    175:        char                    vol_id[32];
                    176:        uint16_t                vds_num;
                    177:        uint16_t                max_vol_seq;
                    178:        uint16_t                ichg_lvl;
                    179:        uint16_t                max_ichg_lvl;
                    180:        uint32_t                charset_list;
                    181:        uint32_t                max_charset_list;
                    182:        char                    volset_id[128];
                    183:        struct charspec         desc_charset;
                    184:        struct charspec         explanatory_charset;
                    185:        struct extent_ad        vol_abstract;
                    186:        struct extent_ad        vol_copyright;
                    187:        struct regid            app_id;
                    188:        struct timestamp        time;
                    189:        struct regid            imp_id;
                    190:        uint8_t                 imp_use[64];
                    191:        uint32_t                prev_vds_lov;
                    192:        uint16_t                flags;
                    193:        uint8_t                 reserved[22];
                    194: } __packed;
                    195:
                    196: /* Logical Volume Descriptor [3/10.6] */
                    197: struct logvol_desc {
                    198:        struct desc_tag         tag;
                    199:        uint32_t                seq_num;
                    200:        struct charspec         desc_charset;
                    201:        char                    logvol_id[128];
                    202:        uint32_t                lb_size;
                    203:        struct regid            domain_id;
                    204:        union {
                    205:                struct long_ad  fsd_loc;
                    206:                uint8_t         logvol_content_use[16];
                    207:        } _lvd_use;
                    208:        uint32_t                mt_l; /* Partition map length */
                    209:        uint32_t                n_pm; /* Number of partition maps */
                    210:        struct regid            imp_id;
                    211:        uint8_t                 imp_use[128];
                    212:        struct extent_ad        integrity_seq_id;
                    213:        uint8_t                 maps[1];
                    214: } __packed;
                    215:
                    216: /* Type 1 Partition Map [3/10.7.2] */
                    217: struct part_map_1 {
                    218:        uint8_t                 type;
                    219:        uint8_t                 len;
                    220:        uint16_t                vol_seq_num;
                    221:        uint16_t                part_num;
                    222: } __packed;
                    223:
                    224: #define        UDF_PMAP_TYPE1_SIZE     6
                    225:
                    226: /* Type 2 Partition Map [3/10.7.3] */
                    227: struct part_map_2 {
                    228:        uint8_t                 type;
                    229:        uint8_t                 len;
                    230:        uint8_t                 part_id[62];
                    231: } __packed;
                    232:
                    233: #define        UDF_PMAP_TYPE2_SIZE     64
                    234:
                    235: /* Virtual Partition Map [UDF 2.01/2.2.8] */
                    236: struct part_map_virt {
                    237:        uint8_t                 type;
                    238:        uint8_t                 len;
                    239:        uint8_t                 reserved[2];
                    240:        struct regid            id;
                    241:        uint16_t                vol_seq_num;
                    242:        uint16_t                part_num;
                    243:        uint8_t                 reserved1[24];
                    244: } __packed;
                    245:
                    246: /* Sparable Partition Map [UDF 2.01/2.2.9] */
                    247: struct part_map_spare {
                    248:        uint8_t                 type;
                    249:        uint8_t                 len;
                    250:        uint8_t                 reserved[2];
                    251:        struct regid            id;
                    252:        uint16_t                vol_seq_num;
                    253:        uint16_t                part_num;
                    254:        uint16_t                packet_len;
                    255:        uint8_t                 n_st;   /* Number of Sparing Tables */
                    256:        uint8_t                 reserved1;
                    257:        uint32_t                st_size;
                    258:        uint32_t                st_loc[1];
                    259: } __packed;
                    260:
                    261: union udf_pmap {
                    262:        struct part_map_1       pm1;
                    263:        struct part_map_2       pm2;
                    264:        struct part_map_virt    pmv;
                    265:        struct part_map_spare   pms;
                    266: };
                    267:
                    268: /* Sparing Map Entry [UDF 2.01/2.2.11] */
                    269: struct spare_map_entry {
                    270:        uint32_t                org;
                    271:        uint32_t                map;
                    272: } __packed;
                    273:
                    274: /* Sparing Table [UDF 2.01/2.2.11] */
                    275: struct udf_sparing_table {
                    276:        struct desc_tag         tag;
                    277:        struct regid            id;
                    278:        uint16_t                rt_l;   /* Relocation Table len */
                    279:        uint8_t                 reserved[2];
                    280:        uint32_t                seq_num;
                    281:        struct spare_map_entry  entries[1];
                    282: } __packed;
                    283:
                    284: /* Partition Descriptor [3/10.5] */
                    285: struct part_desc {
                    286:        struct desc_tag tag;
                    287:        uint32_t        seq_num;
                    288:        uint16_t        flags;
                    289:        uint16_t        part_num;
                    290:        struct regid    contents;
                    291:        uint8_t         contents_use[128];
                    292:        uint32_t        access_type;
                    293:        uint32_t        start_loc;
                    294:        uint32_t        part_len;
                    295:        struct regid    imp_id;
                    296:        uint8_t         imp_use[128];
                    297:        uint8_t         reserved[156];
                    298: } __packed;
                    299:
                    300: /* File Set Descriptor [4/14.1] */
                    301: struct fileset_desc {
                    302:        struct desc_tag         tag;
                    303:        struct timestamp        time;
                    304:        uint16_t                ichg_lvl;
                    305:        uint16_t                max_ichg_lvl;
                    306:        uint32_t                charset_list;
                    307:        uint32_t                max_charset_list;
                    308:        uint32_t                fileset_num;
                    309:        uint32_t                fileset_desc_num;
                    310:        struct charspec         logvol_id_charset;
                    311:        char                    logvol_id[128];
                    312:        struct charspec         fileset_charset;
                    313:        char                    fileset_id[32];
                    314:        char                    copyright_file_id[32];
                    315:        char                    abstract_file_id[32];
                    316:        struct long_ad          rootdir_icb;
                    317:        struct regid            domain_id;
                    318:        struct long_ad          next_ex;
                    319:        struct long_ad          streamdir_icb;
                    320:        uint8_t                 reserved[32];
                    321: } __packed;
                    322:
                    323: /* File Identifier Descriptor [4/14.4] */
                    324: struct fileid_desc {
                    325:        struct desc_tag tag;
                    326:        uint16_t        file_num;
                    327:        uint8_t         file_char;
                    328:        uint8_t         l_fi;   /* Length of file identifier area */
                    329:        struct long_ad  icb;
                    330:        uint16_t        l_iu;   /* Length of implementation use area */
                    331:        uint8_t         data[1];
                    332: } __packed;
                    333: #define        UDF_FID_SIZE    38
                    334: #define        UDF_FILE_CHAR_VIS       (1 << 0) /* Visible */
                    335: #define        UDF_FILE_CHAR_DIR       (1 << 1) /* Directory */
                    336: #define        UDF_FILE_CHAR_DEL       (1 << 2) /* Deleted */
                    337: #define        UDF_FILE_CHAR_PAR       (1 << 3) /* Parent Directory */
                    338: #define        UDF_FILE_CHAR_META      (1 << 4) /* Stream metadata */
                    339:
                    340: /* File Entry [4/14.9] */
                    341: struct file_entry {
                    342:        struct desc_tag         tag;
                    343:        struct icb_tag          icbtag;
                    344:        uint32_t                uid;
                    345:        uint32_t                gid;
                    346:        uint32_t                perm;
                    347:        uint16_t                link_cnt;
                    348:        uint8_t                 rec_format;
                    349:        uint8_t                 rec_disp_attr;
                    350:        uint32_t                rec_len;
                    351:        uint64_t                inf_len;
                    352:        uint64_t                logblks_rec;
                    353:        struct timestamp        atime;
                    354:        struct timestamp        mtime;
                    355:        struct timestamp        attrtime;
                    356:        uint32_t                ckpoint;
                    357:        struct long_ad          ex_attr_icb;
                    358:        struct regid            imp_id;
                    359:        uint64_t                unique_id;
                    360:        uint32_t                l_ea;   /* Length of extended attribute area */
                    361:        uint32_t                l_ad;   /* Length of allocation descriptors */
                    362:        uint8_t                 data[1];
                    363: } __packed;
                    364: #define        UDF_FENTRY_SIZE 176
                    365: #define        UDF_FENTRY_PERM_USER_MASK       0x07
                    366: #define        UDF_FENTRY_PERM_GRP_MASK        0xE0
                    367: #define        UDF_FENTRY_PERM_OWNER_MASK      0x1C00
                    368:
                    369: union dscrptr {
                    370:        struct desc_tag         tag;
                    371:        struct anchor_vdp       avdp;
                    372:        struct vol_desc_ptr     vdp;
                    373:        struct pri_vol_desc     pvd;
                    374:        struct logvol_desc      lvd;
                    375:        struct part_desc        pd;
                    376:        struct fileset_desc     fsd;
                    377:        struct fileid_desc      fid;
                    378:        struct file_entry       fe;
                    379: };
                    380:
                    381: /* Useful defines */
                    382:
                    383: #define        GETICB(ad_type, fentry, offset) \
                    384:        (struct ad_type *)&fentry->data[offset]
                    385:
                    386: #define        GETICBLEN(ad_type, icb) letoh32(((struct ad_type *)(icb))->len)

CVSweb