1*4a5d661aSToomas Soome /*- 2*4a5d661aSToomas Soome * Copyright (c) 1994 3*4a5d661aSToomas Soome * The Regents of the University of California. All rights reserved. 4*4a5d661aSToomas Soome * 5*4a5d661aSToomas Soome * This code is derived from software contributed to Berkeley 6*4a5d661aSToomas Soome * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension 7*4a5d661aSToomas Soome * Support code is derived from software contributed to Berkeley 8*4a5d661aSToomas Soome * by Atsushi Murai (amurai@spec.co.jp). 9*4a5d661aSToomas Soome * 10*4a5d661aSToomas Soome * Redistribution and use in source and binary forms, with or without 11*4a5d661aSToomas Soome * modification, are permitted provided that the following conditions 12*4a5d661aSToomas Soome * are met: 13*4a5d661aSToomas Soome * 1. Redistributions of source code must retain the above copyright 14*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer. 15*4a5d661aSToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 16*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer in the 17*4a5d661aSToomas Soome * documentation and/or other materials provided with the distribution. 18*4a5d661aSToomas Soome * 4. Neither the name of the University nor the names of its contributors 19*4a5d661aSToomas Soome * may be used to endorse or promote products derived from this software 20*4a5d661aSToomas Soome * without specific prior written permission. 21*4a5d661aSToomas Soome * 22*4a5d661aSToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23*4a5d661aSToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24*4a5d661aSToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25*4a5d661aSToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26*4a5d661aSToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27*4a5d661aSToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28*4a5d661aSToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29*4a5d661aSToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30*4a5d661aSToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31*4a5d661aSToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32*4a5d661aSToomas Soome * SUCH DAMAGE. 33*4a5d661aSToomas Soome * 34*4a5d661aSToomas Soome * @(#)iso.h 8.6 (Berkeley) 5/10/95 35*4a5d661aSToomas Soome * $FreeBSD$ 36*4a5d661aSToomas Soome */ 37*4a5d661aSToomas Soome 38*4a5d661aSToomas Soome #define ISODCL(from, to) (to - from + 1) 39*4a5d661aSToomas Soome 40*4a5d661aSToomas Soome struct iso_volume_descriptor { 41*4a5d661aSToomas Soome char type[ISODCL(1,1)]; /* 711 */ 42*4a5d661aSToomas Soome char id[ISODCL(2,6)]; 43*4a5d661aSToomas Soome char version[ISODCL(7,7)]; 44*4a5d661aSToomas Soome char unused[ISODCL(8,8)]; 45*4a5d661aSToomas Soome char type_sierra[ISODCL(9,9)]; /* 711 */ 46*4a5d661aSToomas Soome char id_sierra[ISODCL(10,14)]; 47*4a5d661aSToomas Soome char version_sierra[ISODCL(15,15)]; 48*4a5d661aSToomas Soome char data[ISODCL(16,2048)]; 49*4a5d661aSToomas Soome }; 50*4a5d661aSToomas Soome 51*4a5d661aSToomas Soome /* volume descriptor types */ 52*4a5d661aSToomas Soome #define ISO_VD_PRIMARY 1 53*4a5d661aSToomas Soome #define ISO_VD_SUPPLEMENTARY 2 54*4a5d661aSToomas Soome #define ISO_VD_END 255 55*4a5d661aSToomas Soome 56*4a5d661aSToomas Soome #define ISO_STANDARD_ID "CD001" 57*4a5d661aSToomas Soome #define ISO_ECMA_ID "CDW01" 58*4a5d661aSToomas Soome 59*4a5d661aSToomas Soome #define ISO_SIERRA_ID "CDROM" 60*4a5d661aSToomas Soome 61*4a5d661aSToomas Soome struct iso_primary_descriptor { 62*4a5d661aSToomas Soome char type [ISODCL ( 1, 1)]; /* 711 */ 63*4a5d661aSToomas Soome char id [ISODCL ( 2, 6)]; 64*4a5d661aSToomas Soome char version [ISODCL ( 7, 7)]; /* 711 */ 65*4a5d661aSToomas Soome char unused1 [ISODCL ( 8, 8)]; 66*4a5d661aSToomas Soome char system_id [ISODCL ( 9, 40)]; /* achars */ 67*4a5d661aSToomas Soome char volume_id [ISODCL ( 41, 72)]; /* dchars */ 68*4a5d661aSToomas Soome char unused2 [ISODCL ( 73, 80)]; 69*4a5d661aSToomas Soome char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 70*4a5d661aSToomas Soome char unused3 [ISODCL ( 89, 120)]; 71*4a5d661aSToomas Soome char volume_set_size [ISODCL (121, 124)]; /* 723 */ 72*4a5d661aSToomas Soome char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 73*4a5d661aSToomas Soome char logical_block_size [ISODCL (129, 132)]; /* 723 */ 74*4a5d661aSToomas Soome char path_table_size [ISODCL (133, 140)]; /* 733 */ 75*4a5d661aSToomas Soome char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 76*4a5d661aSToomas Soome char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 77*4a5d661aSToomas Soome char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 78*4a5d661aSToomas Soome char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 79*4a5d661aSToomas Soome char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 80*4a5d661aSToomas Soome char volume_set_id [ISODCL (191, 318)]; /* dchars */ 81*4a5d661aSToomas Soome char publisher_id [ISODCL (319, 446)]; /* achars */ 82*4a5d661aSToomas Soome char preparer_id [ISODCL (447, 574)]; /* achars */ 83*4a5d661aSToomas Soome char application_id [ISODCL (575, 702)]; /* achars */ 84*4a5d661aSToomas Soome char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 85*4a5d661aSToomas Soome char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 86*4a5d661aSToomas Soome char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 87*4a5d661aSToomas Soome char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 88*4a5d661aSToomas Soome char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 89*4a5d661aSToomas Soome char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 90*4a5d661aSToomas Soome char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 91*4a5d661aSToomas Soome char file_structure_version [ISODCL (882, 882)]; /* 711 */ 92*4a5d661aSToomas Soome char unused4 [ISODCL (883, 883)]; 93*4a5d661aSToomas Soome char application_data [ISODCL (884, 1395)]; 94*4a5d661aSToomas Soome char unused5 [ISODCL (1396, 2048)]; 95*4a5d661aSToomas Soome }; 96*4a5d661aSToomas Soome #define ISO_DEFAULT_BLOCK_SIZE 2048 97*4a5d661aSToomas Soome 98*4a5d661aSToomas Soome /* 99*4a5d661aSToomas Soome * Used by Microsoft Joliet extension to ISO9660. Almost the same 100*4a5d661aSToomas Soome * as PVD, but byte position 8 is a flag, and 89-120 is for escape. 101*4a5d661aSToomas Soome */ 102*4a5d661aSToomas Soome 103*4a5d661aSToomas Soome struct iso_supplementary_descriptor { 104*4a5d661aSToomas Soome char type [ISODCL ( 1, 1)]; /* 711 */ 105*4a5d661aSToomas Soome char id [ISODCL ( 2, 6)]; 106*4a5d661aSToomas Soome char version [ISODCL ( 7, 7)]; /* 711 */ 107*4a5d661aSToomas Soome char flags [ISODCL ( 8, 8)]; /* 711? */ 108*4a5d661aSToomas Soome char system_id [ISODCL ( 9, 40)]; /* achars */ 109*4a5d661aSToomas Soome char volume_id [ISODCL ( 41, 72)]; /* dchars */ 110*4a5d661aSToomas Soome char unused2 [ISODCL ( 73, 80)]; 111*4a5d661aSToomas Soome char volume_space_size [ISODCL ( 81, 88)]; /* 733 */ 112*4a5d661aSToomas Soome char escape [ISODCL ( 89, 120)]; 113*4a5d661aSToomas Soome char volume_set_size [ISODCL (121, 124)]; /* 723 */ 114*4a5d661aSToomas Soome char volume_sequence_number [ISODCL (125, 128)]; /* 723 */ 115*4a5d661aSToomas Soome char logical_block_size [ISODCL (129, 132)]; /* 723 */ 116*4a5d661aSToomas Soome char path_table_size [ISODCL (133, 140)]; /* 733 */ 117*4a5d661aSToomas Soome char type_l_path_table [ISODCL (141, 144)]; /* 731 */ 118*4a5d661aSToomas Soome char opt_type_l_path_table [ISODCL (145, 148)]; /* 731 */ 119*4a5d661aSToomas Soome char type_m_path_table [ISODCL (149, 152)]; /* 732 */ 120*4a5d661aSToomas Soome char opt_type_m_path_table [ISODCL (153, 156)]; /* 732 */ 121*4a5d661aSToomas Soome char root_directory_record [ISODCL (157, 190)]; /* 9.1 */ 122*4a5d661aSToomas Soome char volume_set_id [ISODCL (191, 318)]; /* dchars */ 123*4a5d661aSToomas Soome char publisher_id [ISODCL (319, 446)]; /* achars */ 124*4a5d661aSToomas Soome char preparer_id [ISODCL (447, 574)]; /* achars */ 125*4a5d661aSToomas Soome char application_id [ISODCL (575, 702)]; /* achars */ 126*4a5d661aSToomas Soome char copyright_file_id [ISODCL (703, 739)]; /* 7.5 dchars */ 127*4a5d661aSToomas Soome char abstract_file_id [ISODCL (740, 776)]; /* 7.5 dchars */ 128*4a5d661aSToomas Soome char bibliographic_file_id [ISODCL (777, 813)]; /* 7.5 dchars */ 129*4a5d661aSToomas Soome char creation_date [ISODCL (814, 830)]; /* 8.4.26.1 */ 130*4a5d661aSToomas Soome char modification_date [ISODCL (831, 847)]; /* 8.4.26.1 */ 131*4a5d661aSToomas Soome char expiration_date [ISODCL (848, 864)]; /* 8.4.26.1 */ 132*4a5d661aSToomas Soome char effective_date [ISODCL (865, 881)]; /* 8.4.26.1 */ 133*4a5d661aSToomas Soome char file_structure_version [ISODCL (882, 882)]; /* 711 */ 134*4a5d661aSToomas Soome char unused4 [ISODCL (883, 883)]; 135*4a5d661aSToomas Soome char application_data [ISODCL (884, 1395)]; 136*4a5d661aSToomas Soome char unused5 [ISODCL (1396, 2048)]; 137*4a5d661aSToomas Soome }; 138*4a5d661aSToomas Soome 139*4a5d661aSToomas Soome struct iso_sierra_primary_descriptor { 140*4a5d661aSToomas Soome char unknown1 [ISODCL ( 1, 8)]; /* 733 */ 141*4a5d661aSToomas Soome char type [ISODCL ( 9, 9)]; /* 711 */ 142*4a5d661aSToomas Soome char id [ISODCL ( 10, 14)]; 143*4a5d661aSToomas Soome char version [ISODCL ( 15, 15)]; /* 711 */ 144*4a5d661aSToomas Soome char unused1 [ISODCL ( 16, 16)]; 145*4a5d661aSToomas Soome char system_id [ISODCL ( 17, 48)]; /* achars */ 146*4a5d661aSToomas Soome char volume_id [ISODCL ( 49, 80)]; /* dchars */ 147*4a5d661aSToomas Soome char unused2 [ISODCL ( 81, 88)]; 148*4a5d661aSToomas Soome char volume_space_size [ISODCL ( 89, 96)]; /* 733 */ 149*4a5d661aSToomas Soome char unused3 [ISODCL ( 97, 128)]; 150*4a5d661aSToomas Soome char volume_set_size [ISODCL (129, 132)]; /* 723 */ 151*4a5d661aSToomas Soome char volume_sequence_number [ISODCL (133, 136)]; /* 723 */ 152*4a5d661aSToomas Soome char logical_block_size [ISODCL (137, 140)]; /* 723 */ 153*4a5d661aSToomas Soome char path_table_size [ISODCL (141, 148)]; /* 733 */ 154*4a5d661aSToomas Soome char type_l_path_table [ISODCL (149, 152)]; /* 731 */ 155*4a5d661aSToomas Soome char opt_type_l_path_table [ISODCL (153, 156)]; /* 731 */ 156*4a5d661aSToomas Soome char unknown2 [ISODCL (157, 160)]; /* 731 */ 157*4a5d661aSToomas Soome char unknown3 [ISODCL (161, 164)]; /* 731 */ 158*4a5d661aSToomas Soome char type_m_path_table [ISODCL (165, 168)]; /* 732 */ 159*4a5d661aSToomas Soome char opt_type_m_path_table [ISODCL (169, 172)]; /* 732 */ 160*4a5d661aSToomas Soome char unknown4 [ISODCL (173, 176)]; /* 732 */ 161*4a5d661aSToomas Soome char unknown5 [ISODCL (177, 180)]; /* 732 */ 162*4a5d661aSToomas Soome char root_directory_record [ISODCL (181, 214)]; /* 9.1 */ 163*4a5d661aSToomas Soome char volume_set_id [ISODCL (215, 342)]; /* dchars */ 164*4a5d661aSToomas Soome char publisher_id [ISODCL (343, 470)]; /* achars */ 165*4a5d661aSToomas Soome char preparer_id [ISODCL (471, 598)]; /* achars */ 166*4a5d661aSToomas Soome char application_id [ISODCL (599, 726)]; /* achars */ 167*4a5d661aSToomas Soome char copyright_id [ISODCL (727, 790)]; /* achars */ 168*4a5d661aSToomas Soome char creation_date [ISODCL (791, 806)]; /* ? */ 169*4a5d661aSToomas Soome char modification_date [ISODCL (807, 822)]; /* ? */ 170*4a5d661aSToomas Soome char expiration_date [ISODCL (823, 838)]; /* ? */ 171*4a5d661aSToomas Soome char effective_date [ISODCL (839, 854)]; /* ? */ 172*4a5d661aSToomas Soome char file_structure_version [ISODCL (855, 855)]; /* 711 */ 173*4a5d661aSToomas Soome char unused4 [ISODCL (856, 2048)]; 174*4a5d661aSToomas Soome }; 175*4a5d661aSToomas Soome 176*4a5d661aSToomas Soome struct iso_directory_record { 177*4a5d661aSToomas Soome char length [ISODCL (1, 1)]; /* 711 */ 178*4a5d661aSToomas Soome char ext_attr_length [ISODCL (2, 2)]; /* 711 */ 179*4a5d661aSToomas Soome u_char extent [ISODCL (3, 10)]; /* 733 */ 180*4a5d661aSToomas Soome u_char size [ISODCL (11, 18)]; /* 733 */ 181*4a5d661aSToomas Soome char date [ISODCL (19, 25)]; /* 7 by 711 */ 182*4a5d661aSToomas Soome char flags [ISODCL (26, 26)]; 183*4a5d661aSToomas Soome char file_unit_size [ISODCL (27, 27)]; /* 711 */ 184*4a5d661aSToomas Soome char interleave [ISODCL (28, 28)]; /* 711 */ 185*4a5d661aSToomas Soome char volume_sequence_number [ISODCL (29, 32)]; /* 723 */ 186*4a5d661aSToomas Soome char name_len [ISODCL (33, 33)]; /* 711 */ 187*4a5d661aSToomas Soome char name [1]; /* XXX */ 188*4a5d661aSToomas Soome }; 189*4a5d661aSToomas Soome /* can't take sizeof(iso_directory_record), because of possible alignment 190*4a5d661aSToomas Soome of the last entry (34 instead of 33) */ 191*4a5d661aSToomas Soome #define ISO_DIRECTORY_RECORD_SIZE 33 192*4a5d661aSToomas Soome 193*4a5d661aSToomas Soome struct iso_extended_attributes { 194*4a5d661aSToomas Soome u_char owner [ISODCL (1, 4)]; /* 723 */ 195*4a5d661aSToomas Soome u_char group [ISODCL (5, 8)]; /* 723 */ 196*4a5d661aSToomas Soome u_char perm [ISODCL (9, 10)]; /* 9.5.3 */ 197*4a5d661aSToomas Soome char ctime [ISODCL (11, 27)]; /* 8.4.26.1 */ 198*4a5d661aSToomas Soome char mtime [ISODCL (28, 44)]; /* 8.4.26.1 */ 199*4a5d661aSToomas Soome char xtime [ISODCL (45, 61)]; /* 8.4.26.1 */ 200*4a5d661aSToomas Soome char ftime [ISODCL (62, 78)]; /* 8.4.26.1 */ 201*4a5d661aSToomas Soome char recfmt [ISODCL (79, 79)]; /* 711 */ 202*4a5d661aSToomas Soome char recattr [ISODCL (80, 80)]; /* 711 */ 203*4a5d661aSToomas Soome u_char reclen [ISODCL (81, 84)]; /* 723 */ 204*4a5d661aSToomas Soome char system_id [ISODCL (85, 116)]; /* achars */ 205*4a5d661aSToomas Soome char system_use [ISODCL (117, 180)]; 206*4a5d661aSToomas Soome char version [ISODCL (181, 181)]; /* 711 */ 207*4a5d661aSToomas Soome char len_esc [ISODCL (182, 182)]; /* 711 */ 208*4a5d661aSToomas Soome char reserved [ISODCL (183, 246)]; 209*4a5d661aSToomas Soome u_char len_au [ISODCL (247, 250)]; /* 723 */ 210*4a5d661aSToomas Soome }; 211*4a5d661aSToomas Soome 212*4a5d661aSToomas Soome #ifdef _KERNEL 213*4a5d661aSToomas Soome 214*4a5d661aSToomas Soome /* CD-ROM Format type */ 215*4a5d661aSToomas Soome enum ISO_FTYPE { ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, 216*4a5d661aSToomas Soome ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA }; 217*4a5d661aSToomas Soome 218*4a5d661aSToomas Soome #ifndef ISOFSMNT_ROOT 219*4a5d661aSToomas Soome #define ISOFSMNT_ROOT 0 220*4a5d661aSToomas Soome #endif 221*4a5d661aSToomas Soome 222*4a5d661aSToomas Soome struct iso_mnt { 223*4a5d661aSToomas Soome uint64_t im_flags; 224*4a5d661aSToomas Soome 225*4a5d661aSToomas Soome struct mount *im_mountp; 226*4a5d661aSToomas Soome struct cdev *im_dev; 227*4a5d661aSToomas Soome struct vnode *im_devvp; 228*4a5d661aSToomas Soome 229*4a5d661aSToomas Soome struct g_consumer *im_cp; 230*4a5d661aSToomas Soome struct bufobj *im_bo; 231*4a5d661aSToomas Soome 232*4a5d661aSToomas Soome int logical_block_size; 233*4a5d661aSToomas Soome int im_bshift; 234*4a5d661aSToomas Soome int im_bmask; 235*4a5d661aSToomas Soome 236*4a5d661aSToomas Soome int volume_space_size; 237*4a5d661aSToomas Soome 238*4a5d661aSToomas Soome char root[ISODCL (157, 190)]; 239*4a5d661aSToomas Soome int root_extent; 240*4a5d661aSToomas Soome int root_size; 241*4a5d661aSToomas Soome enum ISO_FTYPE iso_ftype; 242*4a5d661aSToomas Soome 243*4a5d661aSToomas Soome int rr_skip; 244*4a5d661aSToomas Soome int rr_skip0; 245*4a5d661aSToomas Soome 246*4a5d661aSToomas Soome int joliet_level; 247*4a5d661aSToomas Soome 248*4a5d661aSToomas Soome void *im_d2l; 249*4a5d661aSToomas Soome void *im_l2d; 250*4a5d661aSToomas Soome }; 251*4a5d661aSToomas Soome 252*4a5d661aSToomas Soome struct ifid { 253*4a5d661aSToomas Soome u_short ifid_len; 254*4a5d661aSToomas Soome u_short ifid_pad; 255*4a5d661aSToomas Soome int ifid_ino; 256*4a5d661aSToomas Soome long ifid_start; 257*4a5d661aSToomas Soome }; 258*4a5d661aSToomas Soome 259*4a5d661aSToomas Soome #define VFSTOISOFS(mp) ((struct iso_mnt *)((mp)->mnt_data)) 260*4a5d661aSToomas Soome 261*4a5d661aSToomas Soome #define blkoff(imp, loc) ((loc) & (imp)->im_bmask) 262*4a5d661aSToomas Soome #define lblktosize(imp, blk) ((blk) << (imp)->im_bshift) 263*4a5d661aSToomas Soome #define lblkno(imp, loc) ((loc) >> (imp)->im_bshift) 264*4a5d661aSToomas Soome #define blksize(imp, ip, lbn) ((imp)->logical_block_size) 265*4a5d661aSToomas Soome 266*4a5d661aSToomas Soome int cd9660_vget_internal(struct mount *, ino_t, int, struct vnode **, int, 267*4a5d661aSToomas Soome struct iso_directory_record *); 268*4a5d661aSToomas Soome #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \ 269*4a5d661aSToomas Soome size_t, struct proc *))eopnotsupp) 270*4a5d661aSToomas Soome 271*4a5d661aSToomas Soome extern struct vop_vector cd9660_vnodeops; 272*4a5d661aSToomas Soome extern struct vop_vector cd9660_fifoops; 273*4a5d661aSToomas Soome 274*4a5d661aSToomas Soome int isochar(u_char *, u_char *, int, u_short *, int *, int, void *); 275*4a5d661aSToomas Soome int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *); 276*4a5d661aSToomas Soome void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *); 277*4a5d661aSToomas Soome ino_t isodirino(struct iso_directory_record *, struct iso_mnt *); 278*4a5d661aSToomas Soome u_short sgetrune(const char *, size_t, char const **, int, void *); 279*4a5d661aSToomas Soome 280*4a5d661aSToomas Soome #endif /* _KERNEL */ 281*4a5d661aSToomas Soome 282*4a5d661aSToomas Soome /* 283*4a5d661aSToomas Soome * The isonum_xxx functions are inlined anyway, and could come handy even 284*4a5d661aSToomas Soome * outside the kernel. Thus we don't hide them here. 285*4a5d661aSToomas Soome */ 286*4a5d661aSToomas Soome 287*4a5d661aSToomas Soome /* 288*4a5d661aSToomas Soome * 7xy 289*4a5d661aSToomas Soome * x -> 1 = 8 bits, 2 = 16 bits, 3 = 32 bits 290*4a5d661aSToomas Soome * y -> 1 = little-endian, 2 = big-endian, 3 = both (le then be) 291*4a5d661aSToomas Soome */ 292*4a5d661aSToomas Soome 293*4a5d661aSToomas Soome static __inline uint8_t 294*4a5d661aSToomas Soome isonum_711(const unsigned char *p) 295*4a5d661aSToomas Soome { 296*4a5d661aSToomas Soome 297*4a5d661aSToomas Soome return (p[0]); 298*4a5d661aSToomas Soome } 299*4a5d661aSToomas Soome 300*4a5d661aSToomas Soome static __inline int8_t 301*4a5d661aSToomas Soome isonum_712(const unsigned char *p) 302*4a5d661aSToomas Soome { 303*4a5d661aSToomas Soome 304*4a5d661aSToomas Soome return ((signed char)p[0]); 305*4a5d661aSToomas Soome } 306*4a5d661aSToomas Soome 307*4a5d661aSToomas Soome static __inline uint8_t 308*4a5d661aSToomas Soome isonum_713(const unsigned char *p) 309*4a5d661aSToomas Soome { 310*4a5d661aSToomas Soome 311*4a5d661aSToomas Soome return (p[0]); 312*4a5d661aSToomas Soome } 313*4a5d661aSToomas Soome 314*4a5d661aSToomas Soome static __inline uint16_t 315*4a5d661aSToomas Soome isonum_721(const unsigned char *p) 316*4a5d661aSToomas Soome { 317*4a5d661aSToomas Soome 318*4a5d661aSToomas Soome return (p[0] | p[1] << 8); 319*4a5d661aSToomas Soome } 320*4a5d661aSToomas Soome 321*4a5d661aSToomas Soome static __inline uint16_t 322*4a5d661aSToomas Soome isonum_722(const unsigned char *p) 323*4a5d661aSToomas Soome { 324*4a5d661aSToomas Soome 325*4a5d661aSToomas Soome return (p[1] | p[0] << 8); 326*4a5d661aSToomas Soome } 327*4a5d661aSToomas Soome 328*4a5d661aSToomas Soome static __inline uint16_t 329*4a5d661aSToomas Soome isonum_723(const unsigned char *p) 330*4a5d661aSToomas Soome { 331*4a5d661aSToomas Soome 332*4a5d661aSToomas Soome return (p[0] | p[1] << 8); 333*4a5d661aSToomas Soome } 334*4a5d661aSToomas Soome 335*4a5d661aSToomas Soome static __inline uint32_t 336*4a5d661aSToomas Soome isonum_731(const unsigned char *p) 337*4a5d661aSToomas Soome { 338*4a5d661aSToomas Soome 339*4a5d661aSToomas Soome return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24); 340*4a5d661aSToomas Soome } 341*4a5d661aSToomas Soome 342*4a5d661aSToomas Soome static __inline uint32_t 343*4a5d661aSToomas Soome isonum_732(const unsigned char *p) 344*4a5d661aSToomas Soome { 345*4a5d661aSToomas Soome 346*4a5d661aSToomas Soome return (p[3] | p[2] << 8 | p[1] << 16 | p[0] << 24); 347*4a5d661aSToomas Soome } 348*4a5d661aSToomas Soome 349*4a5d661aSToomas Soome static __inline uint32_t 350*4a5d661aSToomas Soome isonum_733(const unsigned char *p) 351*4a5d661aSToomas Soome { 352*4a5d661aSToomas Soome 353*4a5d661aSToomas Soome return (p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24); 354*4a5d661aSToomas Soome } 355*4a5d661aSToomas Soome 356*4a5d661aSToomas Soome /* 357*4a5d661aSToomas Soome * Associated files have a leading '='. 358*4a5d661aSToomas Soome */ 359*4a5d661aSToomas Soome #define ASSOCCHAR '=' 360