Annotation of kernel/bsd/isofs/cd9660/iso.h, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
                      7:  * Reserved.  This file contains Original Code and/or Modifications of
                      8:  * Original Code as defined in and that are subject to the Apple Public
                      9:  * Source License Version 1.1 (the "License").  You may not use this file
                     10:  * except in compliance with the License.  Please obtain a copy of the
                     11:  * License at http://www.apple.com/publicsource and read it before using
                     12:  * this file.
                     13:  * 
                     14:  * The Original Code and all software distributed under the License are
                     15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     19:  * License for the specific language governing rights and limitations
                     20:  * under the License.
                     21:  * 
                     22:  * @APPLE_LICENSE_HEADER_END@
                     23:  */
                     24: 
                     25: /*     $NetBSD: iso.h,v 1.9 1995/01/18 09:23:19 mycroft Exp $  */
                     26: 
                     27: /*-
                     28:  * Copyright (c) 1994
                     29:  *     The Regents of the University of California.  All rights reserved.
                     30:  *
                     31:  * This code is derived from software contributed to Berkeley
                     32:  * by Pace Willisson ([email protected]).  The Rock Ridge Extension
                     33:  * Support code is derived from software contributed to Berkeley
                     34:  * by Atsushi Murai ([email protected]).
                     35:  *
                     36:  * Redistribution and use in source and binary forms, with or without
                     37:  * modification, are permitted provided that the following conditions
                     38:  * are met:
                     39:  * 1. Redistributions of source code must retain the above copyright
                     40:  *    notice, this list of conditions and the following disclaimer.
                     41:  * 2. Redistributions in binary form must reproduce the above copyright
                     42:  *    notice, this list of conditions and the following disclaimer in the
                     43:  *    documentation and/or other materials provided with the distribution.
                     44:  * 3. All advertising materials mentioning features or use of this software
                     45:  *    must display the following acknowledgement:
                     46:  *     This product includes software developed by the University of
                     47:  *     California, Berkeley and its contributors.
                     48:  * 4. Neither the name of the University nor the names of its contributors
                     49:  *    may be used to endorse or promote products derived from this software
                     50:  *    without specific prior written permission.
                     51:  *
                     52:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     53:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     54:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     55:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     56:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     57:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     58:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     59:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     60:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     61:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     62:  * SUCH DAMAGE.
                     63:  *
                     64:  *     @(#)iso.h       8.4 (Berkeley) 12/5/94
                     65:  */
                     66: 
                     67: #define ISODCL(from, to) (to - from + 1)
                     68: 
                     69: struct iso_volume_descriptor {
                     70:        char type[ISODCL(1,1)]; /* 711 */
                     71:        char id[ISODCL(2,6)];
                     72:        char version[ISODCL(7,7)];
                     73:        char data[ISODCL(8,2048)];
                     74: };
                     75: 
                     76: /* volume descriptor types */
                     77: #define ISO_VD_PRIMARY 1
                     78: #define ISO_VD_END 255
                     79: 
                     80: #define ISO_STANDARD_ID "CD001"
                     81: #define ISO_ECMA_ID     "CDW01"
                     82: #define ISO_XA_ID              "CD-XA001"      /* XA style disk signature */
                     83: #define        DEFAULTTYPE             0x54455854      /* 'TEXT' */
                     84: #define DEFAULTCREATOR 0x68736364      /* 'hscd' */
                     85: #define ISO9660SIGNATURE 0x4147                /* for getattrlist ATTR_VOL_SIGNATURE */
                     86: 
                     87: /* Finder flags, from Technical Note 40 */
                     88: #define                fLockedBit              0x8000
                     89: #define                fInvisibleBit   0x4000
                     90: #define                fHasBundleBit   0x2000
                     91: #define                fSystemBit              0x1000
                     92: #define                fNoCopyBit              0x0800
                     93: #define                fBusyBit                0x0400
                     94: #define                fChangedBit             0x0200
                     95: #define                fInitedBit              0x0100
                     96: #define                fCachedBit              0x0080
                     97: #define                fSharedBit              0x0040
                     98: #define                fAlwaysBit              0x0020          /* always switch-launch */
                     99: #define                fNeverBit               0x0010          /* never switch-launch */
                    100: #define                fOwnApplBit             0x0002
                    101: #define                fOnDesktopBit   0x0001
                    102: 
                    103: #define                EXTFNDRINFOSIZE         16
                    104: 
                    105: struct finder_info {
                    106:        unsigned long           fdType;
                    107:        unsigned long           fdCreator;
                    108:        unsigned short          fdFlags;
                    109:        unsigned short          fdReserved[3];
                    110: };
                    111: 
                    112: struct iso_primary_descriptor {
                    113:        char type                       [ISODCL (  1,   1)]; /* 711 */
                    114:        char id                         [ISODCL (  2,   6)];
                    115:        char version                    [ISODCL (  7,   7)]; /* 711 */
                    116:        char unused1                    [ISODCL (  8,   8)];
                    117:        char system_id                  [ISODCL (  9,  40)]; /* achars */
                    118:        char volume_id                  [ISODCL ( 41,  72)]; /* dchars */
                    119:        char unused2                    [ISODCL ( 73,  80)];
                    120:        char volume_space_size          [ISODCL ( 81,  88)]; /* 733 */
                    121:        char unused3                    [ISODCL ( 89, 120)];
                    122:        char volume_set_size            [ISODCL (121, 124)]; /* 723 */
                    123:        char volume_sequence_number     [ISODCL (125, 128)]; /* 723 */
                    124:        char logical_block_size         [ISODCL (129, 132)]; /* 723 */
                    125:        char path_table_size            [ISODCL (133, 140)]; /* 733 */
                    126:        char type_l_path_table          [ISODCL (141, 144)]; /* 731 */
                    127:        char opt_type_l_path_table      [ISODCL (145, 148)]; /* 731 */
                    128:        char type_m_path_table          [ISODCL (149, 152)]; /* 732 */
                    129:        char opt_type_m_path_table      [ISODCL (153, 156)]; /* 732 */
                    130:        char root_directory_record      [ISODCL (157, 190)]; /* 9.1 */
                    131:        char volume_set_id              [ISODCL (191, 318)]; /* dchars */
                    132:        char publisher_id               [ISODCL (319, 446)]; /* achars */
                    133:        char preparer_id                [ISODCL (447, 574)]; /* achars */
                    134:        char application_id             [ISODCL (575, 702)]; /* achars */
                    135:        char copyright_file_id          [ISODCL (703, 739)]; /* 7.5 dchars */
                    136:        char abstract_file_id           [ISODCL (740, 776)]; /* 7.5 dchars */
                    137:        char bibliographic_file_id      [ISODCL (777, 813)]; /* 7.5 dchars */
                    138:        char creation_date              [ISODCL (814, 830)]; /* 8.4.26.1 */
                    139:        char modification_date          [ISODCL (831, 847)]; /* 8.4.26.1 */
                    140:        char expiration_date            [ISODCL (848, 864)]; /* 8.4.26.1 */
                    141:        char effective_date             [ISODCL (865, 881)]; /* 8.4.26.1 */
                    142:        char file_structure_version     [ISODCL (882, 882)]; /* 711 */
                    143:        char unused4                    [ISODCL (883, 883)];
                    144:        char application_data1          [ISODCL (884, 1024)];
                    145:        char CDXASignature                      [ISODCL (1025, 1032)];
                    146:        char CDXAResv                           [ISODCL (1033, 1050)];
                    147:        char application_data2          [ISODCL (1051, 1395)];
                    148: };
                    149: #define ISO_DEFAULT_BLOCK_SIZE         2048
                    150: 
                    151: #if 1
                    152: /* from HighSierra.h in MacOS land */
                    153: typedef struct 
                    154: {
                    155:        char    signature               [ISODCL (1, 2)];        /* x42 x41 - 'BA' signature */
                    156:        u_char  systemUseID             [ISODCL (3, 3)];        /* 02 = no icon, 03 = icon, 04 = icon + bundle */
                    157:        u_char  fileType                [ISODCL (4, 7)];        /* such as 'TEXT' or 'STAK' */
                    158:        u_char  fileCreator             [ISODCL (8, 11)];       /* such as 'hscd' or 'WILD' */
                    159:        u_char  finderFlags             [ISODCL (12, 13)];      /* optional for type 06 */
                    160: } AppleExtension;
                    161: 
                    162: typedef struct 
                    163: {
                    164:        char    signature               [ISODCL (1, 2)];        /* x41 x41 - 'AA' signature */
                    165:        u_char  OSULength               [ISODCL (3, 3)];        /* optional SystemUse length (size of this struct) */
                    166:        u_char  systemUseID             [ISODCL (4, 4)];        /* 1 = ProDOS 2 = HFS */
                    167:        u_char  fileType                [ISODCL (5, 8)];        /* such as 'TEXT' or 'STAK' */
                    168:        u_char  fileCreator             [ISODCL (9, 12)];       /* such as 'hscd' or 'WILD' */
                    169:        u_char  finderFlags             [ISODCL (13, 14)];      /* only certain bits of this are used */
                    170: } NewAppleExtension;
                    171: #endif
                    172: 
                    173: struct iso_directory_record {
                    174:        char length                     [ISODCL (1, 1)]; /* 711 */
                    175:        char ext_attr_length            [ISODCL (2, 2)]; /* 711 */
                    176:        u_char extent                   [ISODCL (3, 10)]; /* 733 */
                    177:        u_char size                     [ISODCL (11, 18)]; /* 733 */
                    178:        char date                       [ISODCL (19, 25)]; /* 7 by 711 */
                    179:        char flags                      [ISODCL (26, 26)];
                    180:        char file_unit_size             [ISODCL (27, 27)]; /* 711 */
                    181:        char interleave                 [ISODCL (28, 28)]; /* 711 */
                    182:        char volume_sequence_number     [ISODCL (29, 32)]; /* 723 */
                    183:        char name_len                   [ISODCL (33, 33)]; /* 711 */
                    184:        char name                       [1];                    /* XXX */
                    185: };
                    186: /* can't take sizeof(iso_directory_record), because of possible alignment
                    187:    of the last entry (34 instead of 33) */
                    188: #define ISO_DIRECTORY_RECORD_SIZE      33
                    189: 
                    190: /* iso_directory_record.flags for Directory Records (except CD-I discs) */
                    191: #define existenceBit   0x01    /* Invisible */
                    192: #define directoryBit   0x02
                    193: #define associatedBit  0x04
                    194: #define recordBit              0x08
                    195: #define protectionBit  0x10
                    196: #define multiextentBit 0x80
                    197: 
                    198: struct iso_extended_attributes {
                    199:        u_char owner                    [ISODCL (1, 4)]; /* 723 */
                    200:        u_char group                    [ISODCL (5, 8)]; /* 723 */
                    201:        u_char perm                     [ISODCL (9, 10)]; /* 9.5.3 */
                    202:        char ctime                      [ISODCL (11, 27)]; /* 8.4.26.1 */
                    203:        char mtime                      [ISODCL (28, 44)]; /* 8.4.26.1 */
                    204:        char xtime                      [ISODCL (45, 61)]; /* 8.4.26.1 */
                    205:        char ftime                      [ISODCL (62, 78)]; /* 8.4.26.1 */
                    206:        char recfmt                     [ISODCL (79, 79)]; /* 711 */
                    207:        char recattr                    [ISODCL (80, 80)]; /* 711 */
                    208:        u_char reclen                   [ISODCL (81, 84)]; /* 723 */
                    209:        char system_id                  [ISODCL (85, 116)]; /* achars */
                    210:        char system_use                 [ISODCL (117, 180)];
                    211:        char version                    [ISODCL (181, 181)]; /* 711 */
                    212:        char len_esc                    [ISODCL (182, 182)]; /* 711 */
                    213:        char reserved                   [ISODCL (183, 246)];
                    214:        u_char len_au                   [ISODCL (247, 250)]; /* 723 */
                    215: };
                    216: 
                    217: /* CD-ROM Format type */
                    218: enum ISO_FTYPE  { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, ISO_FTYPE_ECMA };
                    219: 
                    220: #ifndef        ISOFSMNT_ROOT
                    221: #define        ISOFSMNT_ROOT   0
                    222: #endif
                    223: 
                    224: struct iso_mnt {
                    225:        int im_flags;   /* mount flags */
                    226:        int im_flags2;  /* misc flags */
                    227: 
                    228:        struct mount *im_mountp;
                    229:        dev_t im_dev;
                    230:        struct vnode *im_devvp;
                    231: 
                    232:        int logical_block_size;
                    233:        int im_bshift;
                    234:        int im_bmask;
                    235:        
                    236:        int volume_space_size;
                    237:        struct netexport im_export;
                    238:        
                    239:        char root[ISODCL (157, 190)];
                    240:        int root_extent;
                    241:        int root_size;
                    242:        enum ISO_FTYPE  iso_ftype;
                    243:        
                    244:        int rr_skip;
                    245:        int rr_skip0;
                    246: 
                    247:        struct timespec creation_date;          /* needed for getattrlist */
                    248:        struct timespec modification_date;      /* needed for getattrlist */
                    249:        u_char volume_id[32];                           /* name of volume */
                    250: };
                    251: 
                    252: /* bit settings for iso_mnt.im_flags2 */
                    253: /*
                    254:  * CD is in XA format. Need this to find where apple extensions are
                    255:  * in the iso_directory_record
                    256:  */
                    257: #define        IMF2_IS_CDXA    0x00000001
                    258: 
                    259: #define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data))
                    260: 
                    261: #define blkoff(imp, loc)       ((loc) & (imp)->im_bmask)
                    262: #define lblktosize(imp, blk)   ((blk) << (imp)->im_bshift)
                    263: #define lblkno(imp, loc)       ((loc) >> (imp)->im_bshift)
                    264: #define blksize(imp, ip, lbn)  ((imp)->logical_block_size)
                    265: 
                    266: int cd9660_mount __P((struct mount *,
                    267:            char *, caddr_t, struct nameidata *, struct proc *));
                    268: int cd9660_start __P((struct mount *, int, struct proc *));
                    269: int cd9660_unmount __P((struct mount *, int, struct proc *));
                    270: int cd9660_root __P((struct mount *, struct vnode **));
                    271: int cd9660_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *));
                    272: int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *));
                    273: int cd9660_sync __P((struct mount *, int, struct ucred *, struct proc *));
                    274: int cd9660_vget __P((struct mount *, void *, struct vnode **));
                    275: int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *,
                    276:            struct vnode **, int *, struct ucred **));
                    277: int cd9660_vptofh __P((struct vnode *, struct fid *));
                    278: int cd9660_init __P(());
                    279: 
                    280: int cd9660_mountroot __P((void)); 
                    281: 
                    282: int cd9660_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *));
                    283: 
                    284: extern int (**cd9660_vnodeop_p)();
                    285: extern int (**cd9660_specop_p)();
1.1.1.2 ! root      286: #if FIFO
1.1       root      287: extern int (**cd9660_fifoop_p)();
                    288: #endif
                    289: 
                    290: static __inline int
                    291: isonum_711(p)
                    292:        u_char *p;
                    293: {
                    294:        return *p;
                    295: }
                    296: 
                    297: static __inline int
                    298: isonum_712(p)
                    299:        char *p;
                    300: {
                    301:        return *p;
                    302: }
                    303: 
                    304: #ifndef UNALIGNED_ACCESS
                    305: 
                    306: static __inline int
                    307: isonum_723(p)
                    308:        u_char *p;
                    309: {
                    310:        return *p|(p[1] << 8);
                    311: }
                    312: 
                    313: static __inline int
                    314: isonum_733(p)
                    315:        u_char *p;
                    316: {
                    317:        return *p|(p[1] << 8)|(p[2] << 16)|(p[3] << 24);
                    318: }
                    319: 
                    320: #else /* UNALIGNED_ACCESS */
                    321: 
                    322: #if BYTE_ORDER == LITTLE_ENDIAN
                    323: 
                    324: static __inline int
                    325: isonum_723(p)
                    326:        u_char *p
                    327: {
                    328:        return *(u_int16t *)p;
                    329: }
                    330: 
                    331: static __inline int
                    332: isonum_733(p)
                    333:        u_char *p;
                    334: {
                    335:        return *(u_int32t *)p;
                    336: }
                    337: 
                    338: #endif
                    339: 
                    340: #if BYTE_ORDER == BIG_ENDIAN
                    341: 
                    342: static __inline int
                    343: isonum_723(p)
                    344:        u_char *p
                    345: {
                    346:        return *(u_int16t *)(p + 2);
                    347: }
                    348: 
                    349: static __inline int
                    350: isonum_733(p)
                    351:        u_char *p;
                    352: {
                    353:        return *(u_int32t *)(p + 4);
                    354: }
                    355: 
                    356: #endif
                    357: 
                    358: #endif /* UNALIGNED_ACCESS */
                    359: 
                    360: int isofncmp __P((u_char *, int, u_char *, int));
                    361: void isofntrans __P((u_char *, int, u_char *, u_short *, int, int));
                    362: ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
                    363: int attrcalcsize __P((struct attrlist *attrlist));
                    364: void packattrblk __P((struct attrlist *alist, struct vnode *vp,
                    365:                                          void **attrbufptrptr, void **varbufptrptr));
                    366: 
                    367: 
                    368: /*
                    369:  * Associated files have a leading '='.
                    370:  */
                    371: #define        ASSOCCHAR       '='

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.