14246 sed regression test 7.7 fails due to mediated dictionaries
[illumos-gate.git] / usr / src / uts / common / sys / fs / hsfs_susp.h
blobc8337922bed631b0ea9e3f1236604cca226a4cdd
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 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #define DEBUGGING_ALL 0
35 #define DEBUGGING 0
36 #define DPRINTF if (DEBUGGING) printf
37 #define DPRINTF_ALL if (DEBUGGING_ALL) printf
40 * return values from SUA parsing
42 #define SUA_NULL_POINTER -1
43 #define END_OF_SUA_PARSING -2
44 #define END_OF_SUA -3
45 #define GET_CONTINUATION -4
46 #define SUA_ENOMEM -5
47 #define SUA_EINVAL -6
48 #define RELOC_DIR -7 /* actually for rrip */
51 * For dealing with implemented bits...
52 * These here expect the fsp and a bit as an agument
54 #define SET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) |= (0x01L) << (y))
55 #define UNSET_IMPL_BIT(fsp, y) ((fsp->hsfs_ext_impl) &= ~((0x01L) << (y)))
56 #define IS_IMPL_BIT_SET(fsp, y) ((fsp->hsfs_ext_impl) & ((0x01L) << (y)))
58 #define HAVE_SUSP 0 /* have a SUSP */
59 #define HAVE_PROHIBITED 1 /* prohibited file/dir type in fs */
62 * For dealing with implemented bits...
63 * These here expect just the fsp->hsfs_ext_impl
65 #define SET_SUSP_BIT(fsp) (SET_IMPL_BIT((fsp), HAVE_SUSP))
66 #define UNSET_SUSP_BIT(fsp) (UNSET_IMPL_BIT((fsp), HAVE_SUSP))
67 #define IS_SUSP_IMPLEMENTED(fsp) (IS_IMPL_BIT_SET(fsp, 0) ? 1 : 0)
69 #define SUSP_VERSION 1
72 * SUSP signagure definitions
74 #define SUSP_SP "SP"
75 #define SUSP_CE "CE"
76 #define SUSP_PD "PD"
77 #define SUSP_ER "ER"
78 #define SUSP_ST "ST"
81 * Generic System Use Field (SUF) Macros and declarations
84 #define SUF_SIG_LEN 2 /* length of signatures */
85 #define SUF_MIN_LEN 4 /* minimum length of a */
86 /* signature field */
88 #define SUF_LEN(x) *(SUF_len(x)) /* SUF length */
89 #define SUF_len(x) (&((uchar_t *)x)[2]) /* SUF length */
91 #define SUF_VER(x) *(SUF_ver(x)) /* SUF version */
92 #define SUF_ver(x) (&((uchar_t *)x)[3]) /* SUF version */
95 * Extension Reference Macros
98 #define ER_ID_LEN(x) *(ER_id_len(x)) /* Extension ref id length */
99 #define ER_id_len(x) (&((uchar_t *)x)[4]) /* Extension ref id length */
102 #define ER_DES_LEN(x) *(ER_des_len(x)) /* Extension ref description */
103 /* length */
104 #define ER_des_len(x) (&((uchar_t *)x)[5]) /* Extension ref description */
105 /* length */
107 #define ER_SRC_LEN(x) *(ER_src_len(x)) /* Extension ref source */
108 /* description length */
110 #define ER_src_len(x) (&((uchar_t *)x)[6]) /* Extension ref source */
111 /* description length */
114 #define ER_EXT_VER(x) *(ER_ext_ver(x)) /* Extension ref description */
115 /* length */
116 #define ER_ext_ver(x) (&((uchar_t *)x)[7]) /* Extension ref description */
117 /* length */
119 #define ER_EXT_ID_LOC 8 /* location where the ER id */
120 /* string begins */
122 #define ER_ext_id(x) (&((uchar_t *)x)[ER_EXT_ID_LOC])
123 /* extension id string */
125 #define ER_ext_des(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x)])
126 /* ext. description string */
128 #define ER_ext_src(x) (&((uchar_t *)x)[ER_EXT_ID_LOC + ER_ID_LEN(x) + \
129 ER_DES_LEN(x)])
130 /* ext. source string */
134 * Continuation Area Macros
136 #define CE_BLK_LOC(x) BOTH_INT(CE_blk_loc(x)) /* cont. starting block */
137 #define CE_blk_loc(x) (&((uchar_t *)x)[4]) /* cont. starting block */
139 #define CE_OFFSET(x) BOTH_INT(CE_offset(x)) /* cont. offset */
140 #define CE_offset(x) (&((uchar_t *)x)[12]) /* cont. offset */
142 #define CE_CONT_LEN(x) BOTH_INT(CE_cont_len(x)) /* continuation len */
143 #define CE_cont_len(x) (&((uchar_t *)x)[20]) /* continuation len */
147 * Sharing Protocol (SP) Macros
149 #define SP_CHK_BYTE_1(x) *(SP_chk_byte_1(x)) /* check bytes */
150 #define SP_chk_byte_1(x) (&((uchar_t *)x)[4]) /* check bytes */
152 #define SP_CHK_BYTE_2(x) *(SP_chk_byte_2(x)) /* check bytes */
153 #define SP_chk_byte_2(x) (&((uchar_t *)x)[5]) /* check bytes */
155 #define SUSP_CHECK_BYTE_1 (uchar_t)0xBE /* check for 0xBE */
156 #define SUSP_CHECK_BYTE_2 (uchar_t)0xEF /* check for 0xEF */
158 #define CHECK_BYTES_OK(x) ((SP_CHK_BYTE_1(x) == SUSP_CHECK_BYTE_1) && \
159 (SP_CHK_BYTE_2(x) == SUSP_CHECK_BYTE_2))
161 #define SP_SUA_OFFSET(x) *(SP_sua_offset(x)) /* SUA bytes to skip */
162 #define SP_sua_offset(x) (&((uchar_t *)x)[6]) /* SUA bytes to skip */
167 * Forward declarations
170 #ifdef _KERNEL
172 extern uchar_t *share_protocol();
173 extern uchar_t *share_ext_ref();
174 extern uchar_t *share_continue();
175 extern uchar_t *share_padding();
176 extern uchar_t *share_stop();
178 #endif
181 * Extension signature structure, to corrolate the handler functions
182 * with the signatures
184 struct extension_signature_struct {
185 char *ext_signature; /* extension signature */
186 uchar_t *(*sig_handler)(); /* extension handler function */
189 typedef struct extension_signature_struct ext_signature_t;
193 * Extension name structure, to corrolate the extensions with their own
194 * signature tables.
196 struct extension_name_struct {
197 char *extension_name; /* ER field identifier */
198 ushort_t ext_version; /* version # of extensions */
199 ext_signature_t *signature_table; /* pointer to signature */
200 /* table for appropriate */
201 /* extension */
204 typedef struct extension_name_struct extension_name_t;
207 * Extern declaration for all supported extensions
209 struct cont_info_struct {
210 uint_t cont_lbn; /* location of cont */
211 uint_t cont_offset; /* offset into cont */
212 uint_t cont_len; /* len of cont */
215 typedef struct cont_info_struct cont_info_t;
218 * Structure for passing arguments to sig_handler()'s. Since there are
219 * so many sig_handler()'s, it would be slower to pass multiple
220 * arguments to all of them. It would also ease maintainance
222 struct sig_args_struct {
223 uchar_t *dirp; /* pointer to ISO dir entry */
224 uchar_t *name_p; /* dir entry name */
225 int *name_len_p; /* dir entry name length */
226 short flags; /* misc flags */
227 ulong_t name_flags; /* misc flags */
228 uchar_t *SUF_ptr; /* pointer to current SUF */
229 struct hs_direntry *hdp; /* directory entry */
230 struct hsfs *fsp; /* file system */
231 cont_info_t *cont_info_p; /* continuation area */
234 typedef struct sig_args_struct sig_args_t;
238 * Extern declaration for all supported extensions
241 #ifdef _KERNEL
243 extern ext_signature_t rrip_signature_table[];
244 extern ext_signature_t susp_signature_table[];
245 extern extension_name_t extension_name_table[];
247 extern ext_signature_t *susp_sp;
249 extern int parse_sua(uchar_t *, int *name_len_p, int *, uchar_t *, uint_t,
250 struct hs_direntry *, struct hsfs *, uchar_t *, int search_num);
252 #endif /* _KERNEL */
254 #ifdef __cplusplus
256 #endif
258 #endif /* _SYS_FS_HSFS_SUSP_H */