Move core man pages 1M -> 8
[unleashed.git] / include / sys / fs / hsfs_susp.h
blobe2f3030d67d4a90186ee5c64c0f0ae41fdc874d6
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * ISO 9660 RRIP extension filesystem specifications
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_FS_HSFS_SUSP_H
28 #define _SYS_FS_HSFS_SUSP_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #define DEBUGGING_ALL 0
37 #define DEBUGGING 0
38 #define DPRINTF if (DEBUGGING) printf
39 #define DPRINTF_ALL if (DEBUGGING_ALL) printf
42 * return values from SUA parsing
44 #define SUA_NULL_POINTER -1
45 #define END_OF_SUA_PARSING -2
46 #define END_OF_SUA -3
47 #define GET_CONTINUATION -4
48 #define SUA_ENOMEM -5
49 #define SUA_EINVAL -6
50 #define RELOC_DIR -7 /* actually for rrip */
53 * For dealing with implemented bits...
54 * These here expect the fsp and a bit as an agument
56 #define SET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) |= (0x01L) << (y))
57 #define UNSET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) &= ~((0x01L) << (y)))
58 #define IS_IMPL_BIT_SET(fsp, y) ((fsp->hsfs_ext_impl) & ((0x01L) << (y)))
60 #define HAVE_SUSP 0 /* have a SUSP */
61 #define HAVE_PROHIBITED 1 /* prohibited file/dir type in fs */
64 * For dealing with implemented bits...
65 * These here expect just the fsp->hsfs_ext_impl
67 #define SET_SUSP_BIT(fsp) (SET_IMPL_BIT((fsp), HAVE_SUSP))
68 #define UNSET_SUSP_BIT(fsp) (UNSET_IMPL_BIT((fsp), HAVE_SUSP))
69 #define IS_SUSP_IMPLEMENTED(fsp) (IS_IMPL_BIT_SET(fsp, 0) ? 1 : 0)
71 #define SUSP_VERSION 1
74 * SUSP signagure definitions
76 #define SUSP_SP "SP"
77 #define SUSP_CE "CE"
78 #define SUSP_PD "PD"
79 #define SUSP_ER "ER"
80 #define SUSP_ST "ST"
83 * Generic System Use Field (SUF) Macros and declarations
86 #define SUF_SIG_LEN 2 /* length of signatures */
87 #define SUF_MIN_LEN 4 /* minimum length of a */
88 /* signature field */
90 #define SUF_LEN(x) *(SUF_len(x)) /* SUF length */
91 #define SUF_len(x) (&((uchar_t *)x)[2]) /* SUF length */
93 #define SUF_VER(x) *(SUF_ver(x)) /* SUF version */
94 #define SUF_ver(x) (&((uchar_t *)x)[3]) /* SUF version */
97 * Extension Reference Macros
100 #define ER_ID_LEN(x) *(ER_id_len(x)) /* Extension ref id length */
101 #define ER_id_len(x) (&((uchar_t *)x)[4]) /* Extension ref id length */
104 #define ER_DES_LEN(x) *(ER_des_len(x)) /* Extension ref description */
105 /* length */
106 #define ER_des_len(x) (&((uchar_t *)x)[5]) /* Extension ref description */
107 /* length */
109 #define ER_SRC_LEN(x) *(ER_src_len(x)) /* Extension ref source */
110 /* description length */
112 #define ER_src_len(x) (&((uchar_t *)x)[6]) /* Extension ref source */
113 /* description length */
116 #define ER_EXT_VER(x) *(ER_ext_ver(x)) /* Extension ref description */
117 /* length */
118 #define ER_ext_ver(x) (&((uchar_t *)x)[7]) /* Extension ref description */
119 /* length */
121 #define ER_EXT_ID_LOC 8 /* location where the ER id */
122 /* string begins */
124 #define ER_ext_id(x) (&((uchar_t *)x)[ER_EXT_ID_LOC])
125 /* extension id string */
127 #define ER_ext_des(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x)])
128 /* ext. description string */
130 #define ER_ext_src(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x) + \
131 ER_DES_LEN(x)])
132 /* ext. source string */
136 * Continuation Area Macros
138 #define CE_BLK_LOC(x) BOTH_INT(CE_blk_loc(x)) /* cont. starting block */
139 #define CE_blk_loc(x) (&((uchar_t *)x)[4]) /* cont. starting block */
141 #define CE_OFFSET(x) BOTH_INT(CE_offset(x)) /* cont. offset */
142 #define CE_offset(x) (&((uchar_t *)x)[12]) /* cont. offset */
144 #define CE_CONT_LEN(x) BOTH_INT(CE_cont_len(x)) /* continuation len */
145 #define CE_cont_len(x) (&((uchar_t *)x)[20]) /* continuation len */
149 * Sharing Protocol (SP) Macros
151 #define SP_CHK_BYTE_1(x) *(SP_chk_byte_1(x)) /* check bytes */
152 #define SP_chk_byte_1(x) (&((uchar_t *)x)[4]) /* check bytes */
154 #define SP_CHK_BYTE_2(x) *(SP_chk_byte_2(x)) /* check bytes */
155 #define SP_chk_byte_2(x) (&((uchar_t *)x)[5]) /* check bytes */
157 #define SUSP_CHECK_BYTE_1 (uchar_t)0xBE /* check for 0xBE */
158 #define SUSP_CHECK_BYTE_2 (uchar_t)0xEF /* check for 0xEF */
160 #define CHECK_BYTES_OK(x) ((SP_CHK_BYTE_1(x) == SUSP_CHECK_BYTE_1) && \
161 (SP_CHK_BYTE_2(x) == SUSP_CHECK_BYTE_2))
163 #define SP_SUA_OFFSET(x) *(SP_sua_offset(x)) /* SUA bytes to skip */
164 #define SP_sua_offset(x) (&((uchar_t *)x)[6]) /* SUA bytes to skip */
169 * Forward declarations
172 #ifdef _KERNEL
174 extern uchar_t *share_protocol();
175 extern uchar_t *share_ext_ref();
176 extern uchar_t *share_continue();
177 extern uchar_t *share_padding();
178 extern uchar_t *share_stop();
180 #endif
183 * Extension signature structure, to corrolate the handler functions
184 * with the signatures
186 struct extension_signature_struct {
187 char *ext_signature; /* extension signature */
188 uchar_t *(*sig_handler)(); /* extension handler function */
191 typedef struct extension_signature_struct ext_signature_t;
195 * Extension name structure, to corrolate the extensions with their own
196 * signature tables.
198 struct extension_name_struct {
199 char *extension_name; /* ER field identifier */
200 ushort_t ext_version; /* version # of extensions */
201 ext_signature_t *signature_table; /* pointer to signature */
202 /* table for appropriate */
203 /* extension */
206 typedef struct extension_name_struct extension_name_t;
209 * Extern declaration for all supported extensions
211 struct cont_info_struct {
212 uint_t cont_lbn; /* location of cont */
213 uint_t cont_offset; /* offset into cont */
214 uint_t cont_len; /* len of cont */
217 typedef struct cont_info_struct cont_info_t;
220 * Structure for passing arguments to sig_handler()'s. Since there are
221 * so many sig_handler()'s, it would be slower to pass multiple
222 * arguments to all of them. It would also ease maintainance
224 struct sig_args_struct {
225 uchar_t *dirp; /* pointer to ISO dir entry */
226 uchar_t *name_p; /* dir entry name */
227 int *name_len_p; /* dir entry name length */
228 short flags; /* misc flags */
229 ulong_t name_flags; /* misc flags */
230 uchar_t *SUF_ptr; /* pointer to current SUF */
231 struct hs_direntry *hdp; /* directory entry */
232 struct hsfs *fsp; /* file system */
233 cont_info_t *cont_info_p; /* continuation area */
236 typedef struct sig_args_struct sig_args_t;
240 * Extern declaration for all supported extensions
243 #ifdef _KERNEL
245 extern ext_signature_t rrip_signature_table[];
246 extern ext_signature_t susp_signature_table[];
247 extern extension_name_t extension_name_table[];
249 extern ext_signature_t *susp_sp;
251 extern int parse_sua(uchar_t *, int *name_len_p, int *, uchar_t *, uint_t,
252 struct hs_direntry *, struct hsfs *, uchar_t *, int search_num);
254 #endif /* _KERNEL */
256 #ifdef __cplusplus
258 #endif
260 #endif /* _SYS_FS_HSFS_SUSP_H */