Print this page
7127 remove -Wno-missing-braces from Makefile.uts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/fs/hsfs/hsfs_susp.c
+++ new/usr/src/uts/common/fs/hsfs/hsfs_susp.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License, Version 1.0 only
6 6 * (the "License"). You may not use this file except in compliance
7 7 * with the License.
8 8 *
9 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 * or http://www.opensolaris.org/os/licensing.
11 11 * See the License for the specific language governing permissions
12 12 * and limitations under the License.
13 13 *
14 14 * When distributing Covered Code, include this CDDL HEADER in each
15 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 * If applicable, add the following below this CDDL HEADER, with the
17 17 * fields enclosed by brackets "[]" replaced with your own identifying
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
18 18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 19 *
20 20 * CDDL HEADER END
21 21 */
22 22 /*
23 23 * ISO 9660 System Use Sharing Protocol extension filesystem specifications
24 24 * Copyright (c) 1991,2000,2001 by Sun Microsystems, Inc.
25 25 * All rights reserved.
26 26 */
27 27
28 -#pragma ident "%Z%%M% %I% %E% SMI"
29 -
30 28 #include <sys/types.h>
31 29 #include <sys/t_lock.h>
32 30 #include <sys/param.h>
33 31 #include <sys/systm.h>
34 32 #include <sys/sysmacros.h>
35 33 #include <sys/kmem.h>
36 34 #include <sys/signal.h>
37 35 #include <sys/user.h>
38 36 #include <sys/proc.h>
39 37 #include <sys/disp.h>
40 38 #include <sys/buf.h>
41 39 #include <sys/pathname.h>
42 40 #include <sys/vfs.h>
43 41 #include <sys/vnode.h>
44 42 #include <sys/file.h>
45 43 #include <sys/uio.h>
46 44 #include <sys/conf.h>
47 45
48 46 #include <vm/page.h>
49 47
50 48 #include <sys/fs/hsfs_spec.h>
51 49 #include <sys/fs/hsfs_isospec.h>
52 50 #include <sys/fs/hsfs_node.h>
53 51 #include <sys/fs/hsfs_impl.h>
54 52 #include <sys/fs/hsfs_susp.h>
55 53 #include <sys/fs/hsfs_rrip.h>
56 54
57 55 #include <sys/statvfs.h>
58 56 #include <sys/mount.h>
59 57 #include <sys/swap.h>
60 58 #include <sys/errno.h>
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
61 59 #include <sys/debug.h>
62 60 #include "fs/fs_subr.h"
63 61 #include <sys/cmn_err.h>
64 62
65 63
66 64
67 65 /*
68 66 * Common Signatures for all SUSP
69 67 */
70 68 ext_signature_t susp_signature_table[ ] = {
71 - SUSP_SP, share_protocol, /* must be first in table */
72 - SUSP_CE, share_continue, /* must be second in table */
73 - SUSP_PD, share_padding,
74 - SUSP_ER, share_ext_ref,
75 - SUSP_ST, share_stop,
76 - (char *)NULL, NULL
69 + { SUSP_SP, share_protocol }, /* must be first in table */
70 + { SUSP_CE, share_continue }, /* must be second in table */
71 + { SUSP_PD, share_padding },
72 + { SUSP_ER, share_ext_ref },
73 + { SUSP_ST, share_stop },
74 + { NULL, NULL }
77 75 };
78 76
79 77 /*
80 78 * These are global pointers referring to the above table, so the
81 79 * positions must not change as marked on the right above.
82 80 */
83 81 ext_signature_t *susp_sp = &susp_signature_table[0];
84 82 ext_signature_t *susp_ce = &susp_signature_table[1];
85 83
86 84
87 85 /*
88 86 * ext name version implemented signature table
89 87 *
90 88 * the SUSP must be the first entry in the table.
91 89 * the RRIP must be the second entry in the table. We need to be able
92 90 * to check the RRIP bit being set, so we must know it's position.
93 91 * RRIP_BIT is set to 2 in rrip.h
94 92 */
95 93 extension_name_t extension_name_table[] = {
96 - "SUSP_1991A", SUSP_VERSION, susp_signature_table, /* #1 */
97 - RRIP_ER_EXT_ID, RRIP_EXT_VERSION, rrip_signature_table,
98 - (char *)NULL, 0, (ext_signature_t *)NULL
94 + { "SUSP_1991A", SUSP_VERSION, susp_signature_table }, /* #1 */
95 + { RRIP_ER_EXT_ID, RRIP_EXT_VERSION, rrip_signature_table },
96 + { NULL, 0, (ext_signature_t *)NULL }
99 97 };
100 98
101 99 extension_name_t *susp_ext_name = extension_name_table;
102 100
103 101 /*
104 102 * share_protocol()
105 103 *
106 104 * sig_handler() for SUSP signature "SP"
107 105 *
108 106 * This function looks for the "SP" signature field, which means that
109 107 * the SUSP is supported on the current CD-ROM. It looks for the word
110 108 * 0xBEEF in the signature. If that exists, the SUSP is implemented.
111 109 * The function will then set the implemented bit in the "SUSP" entry
112 110 * of the extention_name_table[]. If the bytes don't match, then we
113 111 * return a big fat NULL and treat this as an ISO 9660 CD-ROM.
114 112 */
115 113 uchar_t *
116 114 share_protocol(sig_args_t *sig_args_p)
117 115 {
118 116 uchar_t *sp_ptr = sig_args_p->SUF_ptr;
119 117
120 118 /* Let's check the check bytes */
121 119 if (!CHECK_BYTES_OK(sp_ptr))
122 120 return ((uchar_t *)NULL);
123 121
124 122 /*
125 123 * Ah, we have the go ahead, so let's set the implemented bit
126 124 * of the SUSP in the extension_name_table[]
127 125 */
128 126
129 127 if (SUSP_VERSION < SUF_VER(sp_ptr)) {
130 128 cmn_err(CE_NOTE,
131 129 "System Use Sharing Protocol ver. %d:not supported\n",
132 130 (int)SUF_VER(sp_ptr));
133 131 return ((uchar_t *)NULL);
134 132 }
135 133
136 134 SET_SUSP_BIT(sig_args_p->fsp);
137 135
138 136 sig_args_p->fsp->hsfs_sua_off = SP_SUA_OFFSET(sp_ptr);
139 137
140 138 return (sp_ptr + SUF_LEN(sp_ptr));
141 139 }
142 140
143 141 /*
144 142 * share_ext_ref()
145 143 *
146 144 * sig_handler() for SUSP signature "ER"
147 145 *
148 146 * This function looks for the "ER" signature field, which lists an
149 147 * extension that is implemented on the current CD-ROM. The function
150 148 * will then search through the extention_name_table[], looking for the
151 149 * extension reference in this SUF.
152 150 *
153 151 * If the correct extension reference is found, and the version number
154 152 * in the "ER" SUF is less than or equal to the version specified in
155 153 * the extension_name_table, the implemented bit will be set to 1.
156 154 *
157 155 * If the version number in the "ER" field is greater than that in the
158 156 * extension_name_table or no reference can be matched, the reference
159 157 * will be skipped the function will return the next field.
160 158 */
161 159 uchar_t *
162 160 share_ext_ref(sig_args_t *sig_args_p)
163 161 {
164 162 uchar_t *er_ptr = sig_args_p->SUF_ptr;
165 163 extension_name_t *extnp;
166 164 int index;
167 165
168 166 /*
169 167 * Find appropriate extension and signature table
170 168 */
171 169 for (extnp = extension_name_table, index = 0;
172 170 extnp->extension_name != (char *)NULL;
173 171 extnp++, index++) {
174 172 if (strncmp(extnp->extension_name,
175 173 (char *)ER_ext_id(er_ptr),
176 174 ER_ID_LEN(er_ptr)) == 0) {
177 175 SET_IMPL_BIT(sig_args_p->fsp, index);
178 176 }
179 177 }
180 178
181 179 return (er_ptr + SUF_LEN(er_ptr));
182 180 }
183 181
184 182 /*
185 183 * share_continue()
186 184 *
187 185 * sig_handler() for SUSP signature "CE"
188 186 *
189 187 * This function looks for the "CE" signature field. This means that
190 188 * the SUA is continued in another block on the CD-ROM. Because it is
191 189 * not a requirement that this "CE" field come at the end of the SUA,
192 190 * this function will only set up a structure containing the
193 191 * information needed to read the next SUA, somewhere on the disk.
194 192 *
195 193 * The end of the SUA is signaled by 2 NULL bytes, where the next
196 194 * signature would have been.
197 195 *
198 196 * This one will be tough to implement.
199 197 */
200 198 uchar_t *
201 199 share_continue(sig_args_t *sig_args_p)
202 200 {
203 201 uchar_t *ce_ptr = sig_args_p->SUF_ptr;
204 202
205 203 sig_args_p->cont_info_p->cont_lbn = CE_BLK_LOC(ce_ptr);
206 204 sig_args_p->cont_info_p->cont_offset = CE_OFFSET(ce_ptr);
207 205 sig_args_p->cont_info_p->cont_len = CE_CONT_LEN(ce_ptr);
208 206
209 207 return (ce_ptr + SUF_LEN(ce_ptr));
210 208 }
211 209
212 210
213 211 /*
214 212 * share_padding()
215 213 *
216 214 * sig_handler() for SUSP signature "PD"
217 215 *
218 216 * All this function is needed for is bypassing a certain number of
219 217 * bytes. So, we just advance past this field and we're set.
220 218 */
221 219 uchar_t *
222 220 share_padding(sig_args_t *sig_args_p)
223 221 {
224 222 uchar_t *pd_ptr = sig_args_p->SUF_ptr;
225 223
226 224 return (pd_ptr + SUF_LEN(pd_ptr));
227 225 }
228 226
229 227
230 228
231 229 /*
232 230 * share_stop()
233 231 *
234 232 * sig_handler() for SUSP signature "ST"
235 233 *
236 234 * All this is used for is signaling the end of an SUA.
237 235 * It fills the flag variable with the
238 236 */
239 237 uchar_t *
240 238 share_stop(sig_args_t *sig_args_p)
241 239 {
242 240 uchar_t *st_ptr = sig_args_p->SUF_ptr;
243 241
244 242 sig_args_p->flags = END_OF_SUA; /* stop parsing the SUA NOW!!!! */
245 243
246 244 return (st_ptr + SUF_LEN(st_ptr));
247 245 }
↓ open down ↓ |
139 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX