17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*d10b6702Sfrankho * Common Development and Distribution License (the "License"). 6*d10b6702Sfrankho * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 227c478bd9Sstevel@tonic-gate * ISO 9660 RRIP extension filesystem specifications 23*d10b6702Sfrankho * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 24*d10b6702Sfrankho * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_FS_HSFS_SUSP_H 287c478bd9Sstevel@tonic-gate #define _SYS_FS_HSFS_SUSP_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #define DEBUGGING_ALL 0 377c478bd9Sstevel@tonic-gate #define DEBUGGING 0 387c478bd9Sstevel@tonic-gate #define DPRINTF if (DEBUGGING) printf 397c478bd9Sstevel@tonic-gate #define DPRINTF_ALL if (DEBUGGING_ALL) printf 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * return values from SUA parsing 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate #define SUA_NULL_POINTER -1 457c478bd9Sstevel@tonic-gate #define END_OF_SUA_PARSING -2 467c478bd9Sstevel@tonic-gate #define END_OF_SUA -3 477c478bd9Sstevel@tonic-gate #define GET_CONTINUATION -4 487c478bd9Sstevel@tonic-gate #define SUA_ENOMEM -5 497c478bd9Sstevel@tonic-gate #define SUA_EINVAL -6 507c478bd9Sstevel@tonic-gate #define RELOC_DIR -7 /* actually for rrip */ 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* 537c478bd9Sstevel@tonic-gate * For dealing with implemented bits... 547c478bd9Sstevel@tonic-gate * These here expect the fsp and a bit as an agument 557c478bd9Sstevel@tonic-gate */ 567c478bd9Sstevel@tonic-gate #define SET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) |= (0x01L) << (y)) 577c478bd9Sstevel@tonic-gate #define UNSET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) &= ~((0x01L) << (y))) 587c478bd9Sstevel@tonic-gate #define IS_IMPL_BIT_SET(fsp, y) ((fsp->hsfs_ext_impl) & ((0x01L) << (y))) 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define HAVE_SUSP 0 /* have a SUSP */ 617c478bd9Sstevel@tonic-gate #define HAVE_PROHIBITED 1 /* prohibited file/dir type in fs */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate /* 647c478bd9Sstevel@tonic-gate * For dealing with implemented bits... 657c478bd9Sstevel@tonic-gate * These here expect just the fsp->hsfs_ext_impl 667c478bd9Sstevel@tonic-gate */ 677c478bd9Sstevel@tonic-gate #define SET_SUSP_BIT(fsp) (SET_IMPL_BIT((fsp), HAVE_SUSP)) 687c478bd9Sstevel@tonic-gate #define UNSET_SUSP_BIT(fsp) (UNSET_IMPL_BIT((fsp), HAVE_SUSP)) 697c478bd9Sstevel@tonic-gate #define IS_SUSP_IMPLEMENTED(fsp) (IS_IMPL_BIT_SET(fsp, 0) ? 1 : 0) 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define SUSP_VERSION 1 727c478bd9Sstevel@tonic-gate 737c478bd9Sstevel@tonic-gate /* 747c478bd9Sstevel@tonic-gate * SUSP signagure definitions 757c478bd9Sstevel@tonic-gate */ 767c478bd9Sstevel@tonic-gate #define SUSP_SP "SP" 777c478bd9Sstevel@tonic-gate #define SUSP_CE "CE" 787c478bd9Sstevel@tonic-gate #define SUSP_PD "PD" 797c478bd9Sstevel@tonic-gate #define SUSP_ER "ER" 807c478bd9Sstevel@tonic-gate #define SUSP_ST "ST" 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gate /* 837c478bd9Sstevel@tonic-gate * Generic System Use Field (SUF) Macros and declarations 847c478bd9Sstevel@tonic-gate */ 857c478bd9Sstevel@tonic-gate 867c478bd9Sstevel@tonic-gate #define SUF_SIG_LEN 2 /* length of signatures */ 877c478bd9Sstevel@tonic-gate #define SUF_MIN_LEN 4 /* minimum length of a */ 887c478bd9Sstevel@tonic-gate /* signature field */ 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate #define SUF_LEN(x) *(SUF_len(x)) /* SUF length */ 917c478bd9Sstevel@tonic-gate #define SUF_len(x) (&((uchar_t *)x)[2]) /* SUF length */ 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate #define SUF_VER(x) *(SUF_ver(x)) /* SUF version */ 947c478bd9Sstevel@tonic-gate #define SUF_ver(x) (&((uchar_t *)x)[3]) /* SUF version */ 957c478bd9Sstevel@tonic-gate 967c478bd9Sstevel@tonic-gate /* 977c478bd9Sstevel@tonic-gate * Extension Reference Macros 987c478bd9Sstevel@tonic-gate */ 997c478bd9Sstevel@tonic-gate 1007c478bd9Sstevel@tonic-gate #define ER_ID_LEN(x) *(ER_id_len(x)) /* Extension ref id length */ 1017c478bd9Sstevel@tonic-gate #define ER_id_len(x) (&((uchar_t *)x)[4]) /* Extension ref id length */ 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate #define ER_DES_LEN(x) *(ER_des_len(x)) /* Extension ref description */ 1057c478bd9Sstevel@tonic-gate /* length */ 1067c478bd9Sstevel@tonic-gate #define ER_des_len(x) (&((uchar_t *)x)[5]) /* Extension ref description */ 1077c478bd9Sstevel@tonic-gate /* length */ 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #define ER_SRC_LEN(x) *(ER_src_len(x)) /* Extension ref source */ 1107c478bd9Sstevel@tonic-gate /* description length */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define ER_src_len(x) (&((uchar_t *)x)[6]) /* Extension ref source */ 1137c478bd9Sstevel@tonic-gate /* description length */ 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate #define ER_EXT_VER(x) *(ER_ext_ver(x)) /* Extension ref description */ 1177c478bd9Sstevel@tonic-gate /* length */ 1187c478bd9Sstevel@tonic-gate #define ER_ext_ver(x) (&((uchar_t *)x)[7]) /* Extension ref description */ 1197c478bd9Sstevel@tonic-gate /* length */ 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate #define ER_EXT_ID_LOC 8 /* location where the ER id */ 1227c478bd9Sstevel@tonic-gate /* string begins */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate #define ER_ext_id(x) (&((uchar_t *)x)[ER_EXT_ID_LOC]) 1257c478bd9Sstevel@tonic-gate /* extension id string */ 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate #define ER_ext_des(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x)]) 1287c478bd9Sstevel@tonic-gate /* ext. description string */ 1297c478bd9Sstevel@tonic-gate 1307c478bd9Sstevel@tonic-gate #define ER_ext_src(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x) + \ 1317c478bd9Sstevel@tonic-gate ER_DES_LEN(x)]) 1327c478bd9Sstevel@tonic-gate /* ext. source string */ 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate /* 1367c478bd9Sstevel@tonic-gate * Continuation Area Macros 1377c478bd9Sstevel@tonic-gate */ 1387c478bd9Sstevel@tonic-gate #define CE_BLK_LOC(x) BOTH_INT(CE_blk_loc(x)) /* cont. starting block */ 1397c478bd9Sstevel@tonic-gate #define CE_blk_loc(x) (&((uchar_t *)x)[4]) /* cont. starting block */ 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate #define CE_OFFSET(x) BOTH_INT(CE_offset(x)) /* cont. offset */ 1427c478bd9Sstevel@tonic-gate #define CE_offset(x) (&((uchar_t *)x)[12]) /* cont. offset */ 1437c478bd9Sstevel@tonic-gate 1447c478bd9Sstevel@tonic-gate #define CE_CONT_LEN(x) BOTH_INT(CE_cont_len(x)) /* continuation len */ 1457c478bd9Sstevel@tonic-gate #define CE_cont_len(x) (&((uchar_t *)x)[20]) /* continuation len */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* 1497c478bd9Sstevel@tonic-gate * Sharing Protocol (SP) Macros 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate #define SP_CHK_BYTE_1(x) *(SP_chk_byte_1(x)) /* check bytes */ 1527c478bd9Sstevel@tonic-gate #define SP_chk_byte_1(x) (&((uchar_t *)x)[4]) /* check bytes */ 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate #define SP_CHK_BYTE_2(x) *(SP_chk_byte_2(x)) /* check bytes */ 1557c478bd9Sstevel@tonic-gate #define SP_chk_byte_2(x) (&((uchar_t *)x)[5]) /* check bytes */ 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate #define SUSP_CHECK_BYTE_1 (uchar_t)0xBE /* check for 0xBE */ 1587c478bd9Sstevel@tonic-gate #define SUSP_CHECK_BYTE_2 (uchar_t)0xEF /* check for 0xEF */ 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate #define CHECK_BYTES_OK(x) ((SP_CHK_BYTE_1(x) == SUSP_CHECK_BYTE_1) && \ 1617c478bd9Sstevel@tonic-gate (SP_CHK_BYTE_2(x) == SUSP_CHECK_BYTE_2)) 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #define SP_SUA_OFFSET(x) *(SP_sua_offset(x)) /* SUA bytes to skip */ 1647c478bd9Sstevel@tonic-gate #define SP_sua_offset(x) (&((uchar_t *)x)[6]) /* SUA bytes to skip */ 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate /* 1697c478bd9Sstevel@tonic-gate * Forward declarations 1707c478bd9Sstevel@tonic-gate */ 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #ifdef _KERNEL 1737c478bd9Sstevel@tonic-gate 1747c478bd9Sstevel@tonic-gate extern uchar_t *share_protocol(); 1757c478bd9Sstevel@tonic-gate extern uchar_t *share_ext_ref(); 1767c478bd9Sstevel@tonic-gate extern uchar_t *share_continue(); 1777c478bd9Sstevel@tonic-gate extern uchar_t *share_padding(); 1787c478bd9Sstevel@tonic-gate extern uchar_t *share_stop(); 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate #endif 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * Extension signature structure, to corrolate the handler functions 1847c478bd9Sstevel@tonic-gate * with the signatures 1857c478bd9Sstevel@tonic-gate */ 1867c478bd9Sstevel@tonic-gate struct extension_signature_struct { 1877c478bd9Sstevel@tonic-gate char *ext_signature; /* extension signature */ 1887c478bd9Sstevel@tonic-gate uchar_t *(*sig_handler)(); /* extension handler function */ 1897c478bd9Sstevel@tonic-gate }; 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate typedef struct extension_signature_struct ext_signature_t; 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate 1947c478bd9Sstevel@tonic-gate /* 1957c478bd9Sstevel@tonic-gate * Extension name structure, to corrolate the extensions with their own 1967c478bd9Sstevel@tonic-gate * signature tables. 1977c478bd9Sstevel@tonic-gate */ 1987c478bd9Sstevel@tonic-gate struct extension_name_struct { 1997c478bd9Sstevel@tonic-gate char *extension_name; /* ER field identifier */ 2007c478bd9Sstevel@tonic-gate ushort_t ext_version; /* version # of extensions */ 2017c478bd9Sstevel@tonic-gate ext_signature_t *signature_table; /* pointer to signature */ 2027c478bd9Sstevel@tonic-gate /* table for appropriate */ 2037c478bd9Sstevel@tonic-gate /* extension */ 2047c478bd9Sstevel@tonic-gate }; 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate typedef struct extension_name_struct extension_name_t; 2077c478bd9Sstevel@tonic-gate 2087c478bd9Sstevel@tonic-gate /* 2097c478bd9Sstevel@tonic-gate * Extern declaration for all supported extensions 2107c478bd9Sstevel@tonic-gate */ 2117c478bd9Sstevel@tonic-gate struct cont_info_struct { 2127c478bd9Sstevel@tonic-gate uint_t cont_lbn; /* location of cont */ 2137c478bd9Sstevel@tonic-gate uint_t cont_offset; /* offset into cont */ 2147c478bd9Sstevel@tonic-gate uint_t cont_len; /* len of cont */ 2157c478bd9Sstevel@tonic-gate }; 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate typedef struct cont_info_struct cont_info_t; 2187c478bd9Sstevel@tonic-gate 2197c478bd9Sstevel@tonic-gate /* 2207c478bd9Sstevel@tonic-gate * Structure for passing arguments to sig_handler()'s. Since there are 2217c478bd9Sstevel@tonic-gate * so many sig_handler()'s, it would be slower to pass multiple 2227c478bd9Sstevel@tonic-gate * arguments to all of them. It would also ease maintainance 2237c478bd9Sstevel@tonic-gate */ 2247c478bd9Sstevel@tonic-gate struct sig_args_struct { 2257c478bd9Sstevel@tonic-gate uchar_t *dirp; /* pointer to ISO dir entry */ 2267c478bd9Sstevel@tonic-gate uchar_t *name_p; /* dir entry name */ 2277c478bd9Sstevel@tonic-gate int *name_len_p; /* dir entry name length */ 2287c478bd9Sstevel@tonic-gate short flags; /* misc flags */ 2297c478bd9Sstevel@tonic-gate ulong_t name_flags; /* misc flags */ 2307c478bd9Sstevel@tonic-gate uchar_t *SUF_ptr; /* pointer to current SUF */ 2317c478bd9Sstevel@tonic-gate struct hs_direntry *hdp; /* directory entry */ 2327c478bd9Sstevel@tonic-gate struct hsfs *fsp; /* file system */ 2337c478bd9Sstevel@tonic-gate cont_info_t *cont_info_p; /* continuation area */ 2347c478bd9Sstevel@tonic-gate }; 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate typedef struct sig_args_struct sig_args_t; 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate /* 2407c478bd9Sstevel@tonic-gate * Extern declaration for all supported extensions 2417c478bd9Sstevel@tonic-gate */ 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate #ifdef _KERNEL 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate extern ext_signature_t rrip_signature_table[]; 2467c478bd9Sstevel@tonic-gate extern ext_signature_t susp_signature_table[]; 2477c478bd9Sstevel@tonic-gate extern extension_name_t extension_name_table[]; 2487c478bd9Sstevel@tonic-gate 2497c478bd9Sstevel@tonic-gate extern ext_signature_t *susp_sp; 2507c478bd9Sstevel@tonic-gate 251*d10b6702Sfrankho extern int parse_sua(uchar_t *, int *name_len_p, int *, uchar_t *, uint_t, 252*d10b6702Sfrankho struct hs_direntry *, struct hsfs *, uchar_t *, int search_num); 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate #endif /* _KERNEL */ 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2577c478bd9Sstevel@tonic-gate } 2587c478bd9Sstevel@tonic-gate #endif 2597c478bd9Sstevel@tonic-gate 2607c478bd9Sstevel@tonic-gate #endif /* _SYS_FS_HSFS_SUSP_H */ 261