cd9660_vfsops.c revision 1.58 1 1.58 ad /* $NetBSD: cd9660_vfsops.c,v 1.58 2008/04/29 18:18:08 ad Exp $ */
2 1.1 jdolecek
3 1.1 jdolecek /*-
4 1.1 jdolecek * Copyright (c) 1994
5 1.1 jdolecek * The Regents of the University of California. All rights reserved.
6 1.1 jdolecek *
7 1.1 jdolecek * This code is derived from software contributed to Berkeley
8 1.1 jdolecek * by Pace Willisson (pace (at) blitz.com). The Rock Ridge Extension
9 1.1 jdolecek * Support code is derived from software contributed to Berkeley
10 1.1 jdolecek * by Atsushi Murai (amurai (at) spec.co.jp).
11 1.1 jdolecek *
12 1.1 jdolecek * Redistribution and use in source and binary forms, with or without
13 1.1 jdolecek * modification, are permitted provided that the following conditions
14 1.1 jdolecek * are met:
15 1.1 jdolecek * 1. Redistributions of source code must retain the above copyright
16 1.1 jdolecek * notice, this list of conditions and the following disclaimer.
17 1.1 jdolecek * 2. Redistributions in binary form must reproduce the above copyright
18 1.1 jdolecek * notice, this list of conditions and the following disclaimer in the
19 1.1 jdolecek * documentation and/or other materials provided with the distribution.
20 1.9 agc * 3. Neither the name of the University nor the names of its contributors
21 1.1 jdolecek * may be used to endorse or promote products derived from this software
22 1.1 jdolecek * without specific prior written permission.
23 1.1 jdolecek *
24 1.1 jdolecek * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 1.1 jdolecek * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 1.1 jdolecek * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 1.1 jdolecek * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 1.1 jdolecek * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 1.1 jdolecek * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 1.1 jdolecek * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1 jdolecek * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1 jdolecek * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1 jdolecek * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1 jdolecek * SUCH DAMAGE.
35 1.1 jdolecek *
36 1.1 jdolecek * @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
37 1.1 jdolecek */
38 1.1 jdolecek
39 1.1 jdolecek #include <sys/cdefs.h>
40 1.58 ad __KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.58 2008/04/29 18:18:08 ad Exp $");
41 1.1 jdolecek
42 1.1 jdolecek #if defined(_KERNEL_OPT)
43 1.1 jdolecek #include "opt_compat_netbsd.h"
44 1.1 jdolecek #endif
45 1.1 jdolecek
46 1.1 jdolecek #include <sys/param.h>
47 1.10 atatat #include <sys/sysctl.h>
48 1.1 jdolecek #include <sys/systm.h>
49 1.1 jdolecek #include <sys/namei.h>
50 1.1 jdolecek #include <sys/proc.h>
51 1.1 jdolecek #include <sys/kernel.h>
52 1.1 jdolecek #include <sys/vnode.h>
53 1.55 dholland #include <miscfs/genfs/genfs.h>
54 1.1 jdolecek #include <miscfs/specfs/specdev.h>
55 1.1 jdolecek #include <sys/mount.h>
56 1.1 jdolecek #include <sys/buf.h>
57 1.1 jdolecek #include <sys/file.h>
58 1.1 jdolecek #include <sys/disklabel.h>
59 1.1 jdolecek #include <sys/device.h>
60 1.1 jdolecek #include <sys/ioctl.h>
61 1.1 jdolecek #include <sys/cdio.h>
62 1.1 jdolecek #include <sys/errno.h>
63 1.1 jdolecek #include <sys/malloc.h>
64 1.1 jdolecek #include <sys/pool.h>
65 1.1 jdolecek #include <sys/stat.h>
66 1.1 jdolecek #include <sys/conf.h>
67 1.18 jdolecek #include <sys/dirent.h>
68 1.32 elad #include <sys/kauth.h>
69 1.1 jdolecek
70 1.1 jdolecek #include <fs/cd9660/iso.h>
71 1.1 jdolecek #include <fs/cd9660/cd9660_extern.h>
72 1.1 jdolecek #include <fs/cd9660/iso_rrip.h>
73 1.1 jdolecek #include <fs/cd9660/cd9660_node.h>
74 1.1 jdolecek #include <fs/cd9660/cd9660_mount.h>
75 1.2 thorpej
76 1.41 pooka MALLOC_JUSTDEFINE(M_ISOFSMNT, "ISOFS mount", "ISOFS mount structure");
77 1.1 jdolecek
78 1.1 jdolecek extern const struct vnodeopv_desc cd9660_vnodeop_opv_desc;
79 1.1 jdolecek extern const struct vnodeopv_desc cd9660_specop_opv_desc;
80 1.1 jdolecek extern const struct vnodeopv_desc cd9660_fifoop_opv_desc;
81 1.1 jdolecek
82 1.1 jdolecek const struct vnodeopv_desc * const cd9660_vnodeopv_descs[] = {
83 1.1 jdolecek &cd9660_vnodeop_opv_desc,
84 1.1 jdolecek &cd9660_specop_opv_desc,
85 1.1 jdolecek &cd9660_fifoop_opv_desc,
86 1.1 jdolecek NULL,
87 1.1 jdolecek };
88 1.1 jdolecek
89 1.1 jdolecek struct vfsops cd9660_vfsops = {
90 1.1 jdolecek MOUNT_CD9660,
91 1.43 dsl sizeof (struct iso_args),
92 1.1 jdolecek cd9660_mount,
93 1.1 jdolecek cd9660_start,
94 1.1 jdolecek cd9660_unmount,
95 1.1 jdolecek cd9660_root,
96 1.50 pooka (void *)eopnotsupp,
97 1.12 christos cd9660_statvfs,
98 1.1 jdolecek cd9660_sync,
99 1.1 jdolecek cd9660_vget,
100 1.1 jdolecek cd9660_fhtovp,
101 1.1 jdolecek cd9660_vptofh,
102 1.1 jdolecek cd9660_init,
103 1.1 jdolecek cd9660_reinit,
104 1.1 jdolecek cd9660_done,
105 1.1 jdolecek cd9660_mountroot,
106 1.15 hannken (int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
107 1.20 thorpej vfs_stdextattrctl,
108 1.46 pooka (void *)eopnotsupp, /* vfs_suspendctl */
109 1.55 dholland genfs_renamelock_enter,
110 1.55 dholland genfs_renamelock_exit,
111 1.58 ad (void *)eopnotsupp,
112 1.1 jdolecek cd9660_vnodeopv_descs,
113 1.35 christos 0, /* refcount */
114 1.35 christos { NULL, NULL } /* list */
115 1.1 jdolecek };
116 1.23 thorpej VFS_ATTACH(cd9660_vfsops);
117 1.1 jdolecek
118 1.24 yamt static const struct genfs_ops cd9660_genfsops = {
119 1.24 yamt .gop_size = genfs_size,
120 1.1 jdolecek };
121 1.1 jdolecek
122 1.1 jdolecek /*
123 1.1 jdolecek * Called by vfs_mountroot when iso is going to be mounted as root.
124 1.1 jdolecek *
125 1.1 jdolecek * Name is updated by mount(8) after booting.
126 1.1 jdolecek */
127 1.1 jdolecek #define ROOTNAME "root_device"
128 1.1 jdolecek
129 1.26 xtraeme static int iso_makemp(struct iso_mnt *isomp, struct buf *bp, int *ea_len);
130 1.26 xtraeme static int iso_mountfs(struct vnode *devvp, struct mount *mp,
131 1.30 christos struct lwp *l, struct iso_args *argp);
132 1.1 jdolecek
133 1.1 jdolecek int
134 1.57 matt cd9660_mountroot(void)
135 1.1 jdolecek {
136 1.1 jdolecek struct mount *mp;
137 1.50 pooka struct lwp *l = curlwp;
138 1.1 jdolecek int error;
139 1.1 jdolecek struct iso_args args;
140 1.1 jdolecek
141 1.31 thorpej if (device_class(root_device) != DV_DISK)
142 1.1 jdolecek return (ENODEV);
143 1.22 perry
144 1.1 jdolecek if ((error = vfs_rootmountalloc(MOUNT_CD9660, "root_device", &mp))
145 1.1 jdolecek != 0) {
146 1.1 jdolecek vrele(rootvp);
147 1.1 jdolecek return (error);
148 1.1 jdolecek }
149 1.1 jdolecek
150 1.1 jdolecek args.flags = ISOFSMNT_ROOT;
151 1.30 christos if ((error = iso_mountfs(rootvp, mp, l, &args)) != 0) {
152 1.56 ad vfs_unbusy(mp, false);
153 1.49 ad vfs_destroy(mp);
154 1.1 jdolecek return (error);
155 1.1 jdolecek }
156 1.49 ad mutex_enter(&mountlist_lock);
157 1.1 jdolecek CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list);
158 1.49 ad mutex_exit(&mountlist_lock);
159 1.50 pooka (void)cd9660_statvfs(mp, &mp->mnt_stat);
160 1.56 ad vfs_unbusy(mp, false);
161 1.1 jdolecek return (0);
162 1.1 jdolecek }
163 1.1 jdolecek
164 1.1 jdolecek /*
165 1.1 jdolecek * VFS Operations.
166 1.1 jdolecek *
167 1.1 jdolecek * mount system call
168 1.1 jdolecek */
169 1.1 jdolecek int
170 1.57 matt cd9660_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
171 1.1 jdolecek {
172 1.50 pooka struct lwp *l = curlwp;
173 1.47 pooka struct nameidata nd;
174 1.1 jdolecek struct vnode *devvp;
175 1.43 dsl struct iso_args *args = data;
176 1.1 jdolecek int error;
177 1.28 dyoung struct iso_mnt *imp = VFSTOISOFS(mp);
178 1.22 perry
179 1.43 dsl if (*data_len < sizeof *args)
180 1.43 dsl return EINVAL;
181 1.43 dsl
182 1.1 jdolecek if (mp->mnt_flag & MNT_GETARGS) {
183 1.1 jdolecek if (imp == NULL)
184 1.1 jdolecek return EIO;
185 1.43 dsl args->fspec = NULL;
186 1.43 dsl args->flags = imp->im_flags;
187 1.43 dsl *data_len = sizeof (*args);
188 1.43 dsl return 0;
189 1.1 jdolecek }
190 1.22 perry
191 1.1 jdolecek if ((mp->mnt_flag & MNT_RDONLY) == 0)
192 1.1 jdolecek return (EROFS);
193 1.22 perry
194 1.43 dsl if ((mp->mnt_flag & MNT_UPDATE) && args->fspec == NULL)
195 1.27 jmmv return EINVAL;
196 1.27 jmmv
197 1.1 jdolecek /*
198 1.1 jdolecek * Not an update, or updating the name: look up the name
199 1.1 jdolecek * and verify that it refers to a sensible block device.
200 1.1 jdolecek */
201 1.52 pooka NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec);
202 1.47 pooka if ((error = namei(&nd)) != 0)
203 1.1 jdolecek return (error);
204 1.47 pooka devvp = nd.ni_vp;
205 1.1 jdolecek
206 1.1 jdolecek if (devvp->v_type != VBLK) {
207 1.1 jdolecek vrele(devvp);
208 1.1 jdolecek return ENOTBLK;
209 1.1 jdolecek }
210 1.1 jdolecek if (bdevsw_lookup(devvp->v_rdev) == NULL) {
211 1.1 jdolecek vrele(devvp);
212 1.1 jdolecek return ENXIO;
213 1.1 jdolecek }
214 1.1 jdolecek /*
215 1.1 jdolecek * If mount by non-root, then verify that user has necessary
216 1.1 jdolecek * permissions on the device.
217 1.1 jdolecek */
218 1.34 ad if (kauth_authorize_generic(l->l_cred, KAUTH_GENERIC_ISSUSER, NULL) != 0) {
219 1.1 jdolecek vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
220 1.50 pooka error = VOP_ACCESS(devvp, VREAD, l->l_cred);
221 1.1 jdolecek VOP_UNLOCK(devvp, 0);
222 1.1 jdolecek if (error) {
223 1.1 jdolecek vrele(devvp);
224 1.1 jdolecek return (error);
225 1.1 jdolecek }
226 1.1 jdolecek }
227 1.21 mycroft if ((mp->mnt_flag & MNT_UPDATE) == 0) {
228 1.50 pooka error = VOP_OPEN(devvp, FREAD, FSCRED);
229 1.21 mycroft if (error)
230 1.21 mycroft goto fail;
231 1.43 dsl error = iso_mountfs(devvp, mp, l, args);
232 1.21 mycroft if (error) {
233 1.21 mycroft vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
234 1.50 pooka (void)VOP_CLOSE(devvp, FREAD, NOCRED);
235 1.21 mycroft VOP_UNLOCK(devvp, 0);
236 1.21 mycroft goto fail;
237 1.21 mycroft }
238 1.21 mycroft } else {
239 1.21 mycroft vrele(devvp);
240 1.1 jdolecek if (devvp != imp->im_devvp)
241 1.21 mycroft return (EINVAL); /* needs translation */
242 1.1 jdolecek }
243 1.43 dsl return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
244 1.44 pooka mp->mnt_op->vfs_name, mp, l);
245 1.21 mycroft
246 1.21 mycroft fail:
247 1.21 mycroft vrele(devvp);
248 1.21 mycroft return (error);
249 1.1 jdolecek }
250 1.1 jdolecek
251 1.1 jdolecek /*
252 1.1 jdolecek * Make a mount point from a volume descriptor
253 1.1 jdolecek */
254 1.1 jdolecek static int
255 1.57 matt iso_makemp(struct iso_mnt *isomp, struct buf *bp, int *ea_len)
256 1.1 jdolecek {
257 1.1 jdolecek struct iso_primary_descriptor *pri;
258 1.1 jdolecek int logical_block_size;
259 1.1 jdolecek struct iso_directory_record *rootp;
260 1.1 jdolecek
261 1.1 jdolecek pri = (struct iso_primary_descriptor *)bp->b_data;
262 1.22 perry
263 1.1 jdolecek logical_block_size = isonum_723 (pri->logical_block_size);
264 1.22 perry
265 1.1 jdolecek if (logical_block_size < DEV_BSIZE || logical_block_size > MAXBSIZE
266 1.1 jdolecek || (logical_block_size & (logical_block_size - 1)) != 0)
267 1.1 jdolecek return -1;
268 1.22 perry
269 1.1 jdolecek rootp = (struct iso_directory_record *)pri->root_directory_record;
270 1.22 perry
271 1.1 jdolecek isomp->logical_block_size = logical_block_size;
272 1.1 jdolecek isomp->volume_space_size = isonum_733 (pri->volume_space_size);
273 1.1 jdolecek memcpy(isomp->root, rootp, sizeof(isomp->root));
274 1.1 jdolecek isomp->root_extent = isonum_733 (rootp->extent);
275 1.1 jdolecek isomp->root_size = isonum_733 (rootp->size);
276 1.1 jdolecek isomp->im_joliet_level = 0;
277 1.22 perry
278 1.1 jdolecek isomp->im_bmask = logical_block_size - 1;
279 1.1 jdolecek isomp->im_bshift = 0;
280 1.1 jdolecek while ((1 << isomp->im_bshift) < isomp->logical_block_size)
281 1.1 jdolecek isomp->im_bshift++;
282 1.1 jdolecek
283 1.1 jdolecek if (ea_len != NULL)
284 1.1 jdolecek *ea_len = isonum_711(rootp->ext_attr_length);
285 1.1 jdolecek
286 1.1 jdolecek return 0;
287 1.1 jdolecek }
288 1.1 jdolecek
289 1.1 jdolecek /*
290 1.1 jdolecek * Common code for mount and mountroot
291 1.1 jdolecek */
292 1.1 jdolecek static int
293 1.57 matt iso_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l,
294 1.57 matt struct iso_args *argp)
295 1.1 jdolecek {
296 1.1 jdolecek struct iso_mnt *isomp = (struct iso_mnt *)0;
297 1.1 jdolecek struct buf *bp = NULL, *pribp = NULL, *supbp = NULL;
298 1.1 jdolecek dev_t dev = devvp->v_rdev;
299 1.1 jdolecek int error = EINVAL;
300 1.1 jdolecek int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
301 1.1 jdolecek int iso_bsize;
302 1.1 jdolecek int iso_blknum;
303 1.1 jdolecek int joliet_level;
304 1.1 jdolecek struct iso_volume_descriptor *vdp;
305 1.1 jdolecek struct iso_supplementary_descriptor *sup;
306 1.1 jdolecek int sess = 0;
307 1.1 jdolecek int ext_attr_length;
308 1.1 jdolecek struct disklabel label;
309 1.1 jdolecek
310 1.1 jdolecek if (!ronly)
311 1.1 jdolecek return EROFS;
312 1.22 perry
313 1.21 mycroft /* Flush out any old buffers remaining from a previous use. */
314 1.34 ad if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
315 1.1 jdolecek return (error);
316 1.22 perry
317 1.1 jdolecek /* This is the "logical sector size". The standard says this
318 1.1 jdolecek * should be 2048 or the physical sector size on the device,
319 1.1 jdolecek * whichever is greater. For now, we'll just use a constant.
320 1.1 jdolecek */
321 1.1 jdolecek iso_bsize = ISO_DEFAULT_BLOCK_SIZE;
322 1.1 jdolecek
323 1.50 pooka error = VOP_IOCTL(devvp, DIOCGDINFO, &label, FREAD, FSCRED);
324 1.1 jdolecek if (!error &&
325 1.1 jdolecek label.d_partitions[DISKPART(dev)].p_fstype == FS_ISO9660) {
326 1.1 jdolecek /* XXX more sanity checks? */
327 1.1 jdolecek sess = label.d_partitions[DISKPART(dev)].p_cdsession;
328 1.1 jdolecek } else {
329 1.1 jdolecek /* fallback to old method */
330 1.50 pooka error = VOP_IOCTL(devvp, CDIOREADMSADDR, &sess, 0, FSCRED);
331 1.1 jdolecek if (error)
332 1.1 jdolecek sess = 0; /* never mind */
333 1.1 jdolecek }
334 1.4 christos #ifdef ISO_DEBUG
335 1.1 jdolecek printf("isofs: session offset (part %d) %d\n", DISKPART(dev), sess);
336 1.1 jdolecek #endif
337 1.1 jdolecek
338 1.1 jdolecek for (iso_blknum = 16; iso_blknum < 100; iso_blknum++) {
339 1.1 jdolecek if ((error = bread(devvp, (iso_blknum+sess) * btodb(iso_bsize),
340 1.1 jdolecek iso_bsize, NOCRED, &bp)) != 0)
341 1.1 jdolecek goto out;
342 1.22 perry
343 1.1 jdolecek vdp = (struct iso_volume_descriptor *)bp->b_data;
344 1.1 jdolecek if (memcmp(vdp->id, ISO_STANDARD_ID, sizeof(vdp->id)) != 0) {
345 1.1 jdolecek error = EINVAL;
346 1.1 jdolecek goto out;
347 1.1 jdolecek }
348 1.1 jdolecek
349 1.1 jdolecek switch (isonum_711(vdp->type)) {
350 1.1 jdolecek case ISO_VD_PRIMARY:
351 1.1 jdolecek if (pribp == NULL) {
352 1.1 jdolecek pribp = bp;
353 1.1 jdolecek bp = NULL;
354 1.1 jdolecek }
355 1.1 jdolecek break;
356 1.1 jdolecek
357 1.1 jdolecek case ISO_VD_SUPPLEMENTARY:
358 1.1 jdolecek if (supbp == NULL) {
359 1.1 jdolecek supbp = bp;
360 1.1 jdolecek bp = NULL;
361 1.1 jdolecek }
362 1.1 jdolecek break;
363 1.1 jdolecek
364 1.1 jdolecek default:
365 1.1 jdolecek break;
366 1.1 jdolecek }
367 1.1 jdolecek
368 1.1 jdolecek if (isonum_711 (vdp->type) == ISO_VD_END) {
369 1.48 ad brelse(bp, 0);
370 1.1 jdolecek bp = NULL;
371 1.1 jdolecek break;
372 1.1 jdolecek }
373 1.1 jdolecek
374 1.1 jdolecek if (bp != NULL) {
375 1.48 ad brelse(bp, 0);
376 1.1 jdolecek bp = NULL;
377 1.1 jdolecek }
378 1.1 jdolecek }
379 1.1 jdolecek
380 1.1 jdolecek if (pribp == NULL) {
381 1.1 jdolecek error = EINVAL;
382 1.1 jdolecek goto out;
383 1.1 jdolecek }
384 1.1 jdolecek
385 1.1 jdolecek isomp = malloc(sizeof *isomp, M_ISOFSMNT, M_WAITOK);
386 1.3 dsl memset(isomp, 0, sizeof *isomp);
387 1.1 jdolecek if (iso_makemp(isomp, pribp, &ext_attr_length) == -1) {
388 1.1 jdolecek error = EINVAL;
389 1.1 jdolecek goto out;
390 1.1 jdolecek }
391 1.1 jdolecek
392 1.1 jdolecek isomp->volume_space_size += sess;
393 1.1 jdolecek
394 1.48 ad brelse(pribp, BC_AGE);
395 1.1 jdolecek pribp = NULL;
396 1.22 perry
397 1.1 jdolecek mp->mnt_data = isomp;
398 1.12 christos mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)dev;
399 1.12 christos mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_CD9660);
400 1.12 christos mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
401 1.18 jdolecek mp->mnt_stat.f_namemax = MAXNAMLEN;
402 1.1 jdolecek mp->mnt_flag |= MNT_LOCAL;
403 1.53 ad mp->mnt_iflag |= IMNT_MPSAFE;
404 1.1 jdolecek mp->mnt_dev_bshift = iso_bsize;
405 1.1 jdolecek mp->mnt_fs_bshift = isomp->im_bshift;
406 1.1 jdolecek isomp->im_mountp = mp;
407 1.1 jdolecek isomp->im_dev = dev;
408 1.1 jdolecek isomp->im_devvp = devvp;
409 1.22 perry
410 1.1 jdolecek /* Check the Rock Ridge Extension support */
411 1.1 jdolecek if (!(argp->flags & ISOFSMNT_NORRIP)) {
412 1.1 jdolecek struct iso_directory_record *rootp;
413 1.1 jdolecek
414 1.1 jdolecek if ((error = bread(isomp->im_devvp,
415 1.1 jdolecek (isomp->root_extent + ext_attr_length) <<
416 1.1 jdolecek (isomp->im_bshift - DEV_BSHIFT),
417 1.1 jdolecek isomp->logical_block_size, NOCRED,
418 1.1 jdolecek &bp)) != 0)
419 1.1 jdolecek goto out;
420 1.22 perry
421 1.1 jdolecek rootp = (struct iso_directory_record *)bp->b_data;
422 1.22 perry
423 1.1 jdolecek if ((isomp->rr_skip = cd9660_rrip_offset(rootp,isomp)) < 0) {
424 1.1 jdolecek argp->flags |= ISOFSMNT_NORRIP;
425 1.1 jdolecek } else {
426 1.1 jdolecek argp->flags &= ~ISOFSMNT_GENS;
427 1.1 jdolecek }
428 1.22 perry
429 1.1 jdolecek /*
430 1.1 jdolecek * The contents are valid,
431 1.1 jdolecek * but they will get reread as part of another vnode, so...
432 1.1 jdolecek */
433 1.48 ad brelse(bp, BC_AGE);
434 1.1 jdolecek bp = NULL;
435 1.1 jdolecek }
436 1.1 jdolecek isomp->im_flags = argp->flags & (ISOFSMNT_NORRIP | ISOFSMNT_GENS |
437 1.1 jdolecek ISOFSMNT_EXTATT | ISOFSMNT_NOJOLIET | ISOFSMNT_RRCASEINS);
438 1.1 jdolecek
439 1.1 jdolecek if (isomp->im_flags & ISOFSMNT_GENS)
440 1.1 jdolecek isomp->iso_ftype = ISO_FTYPE_9660;
441 1.1 jdolecek else if (isomp->im_flags & ISOFSMNT_NORRIP) {
442 1.1 jdolecek isomp->iso_ftype = ISO_FTYPE_DEFAULT;
443 1.1 jdolecek if (argp->flags & ISOFSMNT_NOCASETRANS)
444 1.1 jdolecek isomp->im_flags |= ISOFSMNT_NOCASETRANS;
445 1.22 perry } else
446 1.1 jdolecek isomp->iso_ftype = ISO_FTYPE_RRIP;
447 1.1 jdolecek
448 1.1 jdolecek /* Check the Joliet Extension support */
449 1.1 jdolecek if ((argp->flags & ISOFSMNT_NORRIP) != 0 &&
450 1.1 jdolecek (argp->flags & ISOFSMNT_NOJOLIET) == 0 &&
451 1.1 jdolecek supbp != NULL) {
452 1.1 jdolecek joliet_level = 0;
453 1.1 jdolecek sup = (struct iso_supplementary_descriptor *)supbp->b_data;
454 1.1 jdolecek
455 1.1 jdolecek if ((isonum_711(sup->flags) & 1) == 0) {
456 1.1 jdolecek if (memcmp(sup->escape, "%/@", 3) == 0)
457 1.1 jdolecek joliet_level = 1;
458 1.1 jdolecek if (memcmp(sup->escape, "%/C", 3) == 0)
459 1.1 jdolecek joliet_level = 2;
460 1.1 jdolecek if (memcmp(sup->escape, "%/E", 3) == 0)
461 1.1 jdolecek joliet_level = 3;
462 1.1 jdolecek }
463 1.1 jdolecek if (joliet_level != 0) {
464 1.1 jdolecek if (iso_makemp(isomp, supbp, NULL) == -1) {
465 1.1 jdolecek error = EINVAL;
466 1.1 jdolecek goto out;
467 1.1 jdolecek }
468 1.1 jdolecek isomp->im_joliet_level = joliet_level;
469 1.1 jdolecek }
470 1.1 jdolecek }
471 1.1 jdolecek
472 1.1 jdolecek if (supbp != NULL) {
473 1.48 ad brelse(supbp, 0);
474 1.1 jdolecek supbp = NULL;
475 1.1 jdolecek }
476 1.22 perry
477 1.37 drochner devvp->v_specmountpoint = mp;
478 1.37 drochner
479 1.1 jdolecek return 0;
480 1.1 jdolecek out:
481 1.1 jdolecek if (bp)
482 1.48 ad brelse(bp, 0);
483 1.1 jdolecek if (pribp)
484 1.48 ad brelse(pribp, 0);
485 1.1 jdolecek if (supbp)
486 1.48 ad brelse(supbp, 0);
487 1.1 jdolecek if (isomp) {
488 1.3 dsl free(isomp, M_ISOFSMNT);
489 1.1 jdolecek mp->mnt_data = NULL;
490 1.1 jdolecek }
491 1.1 jdolecek return error;
492 1.1 jdolecek }
493 1.1 jdolecek
494 1.1 jdolecek /*
495 1.1 jdolecek * Make a filesystem operational.
496 1.1 jdolecek * Nothing to do at the moment.
497 1.1 jdolecek */
498 1.1 jdolecek /* ARGSUSED */
499 1.1 jdolecek int
500 1.50 pooka cd9660_start(struct mount *mp, int flags)
501 1.1 jdolecek {
502 1.1 jdolecek return 0;
503 1.1 jdolecek }
504 1.1 jdolecek
505 1.1 jdolecek /*
506 1.1 jdolecek * unmount system call
507 1.1 jdolecek */
508 1.1 jdolecek int
509 1.57 matt cd9660_unmount(struct mount *mp, int mntflags)
510 1.1 jdolecek {
511 1.1 jdolecek struct iso_mnt *isomp;
512 1.1 jdolecek int error, flags = 0;
513 1.22 perry
514 1.1 jdolecek if (mntflags & MNT_FORCE)
515 1.1 jdolecek flags |= FORCECLOSE;
516 1.1 jdolecek if ((error = vflush(mp, NULLVP, flags)) != 0)
517 1.1 jdolecek return (error);
518 1.1 jdolecek
519 1.1 jdolecek isomp = VFSTOISOFS(mp);
520 1.1 jdolecek
521 1.1 jdolecek if (isomp->im_devvp->v_type != VBAD)
522 1.1 jdolecek isomp->im_devvp->v_specmountpoint = NULL;
523 1.1 jdolecek
524 1.1 jdolecek vn_lock(isomp->im_devvp, LK_EXCLUSIVE | LK_RETRY);
525 1.50 pooka error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED);
526 1.1 jdolecek vput(isomp->im_devvp);
527 1.3 dsl free(isomp, M_ISOFSMNT);
528 1.1 jdolecek mp->mnt_data = NULL;
529 1.1 jdolecek mp->mnt_flag &= ~MNT_LOCAL;
530 1.1 jdolecek return (error);
531 1.1 jdolecek }
532 1.1 jdolecek
533 1.1 jdolecek /*
534 1.1 jdolecek * Return root of a filesystem
535 1.1 jdolecek */
536 1.1 jdolecek int
537 1.57 matt cd9660_root(struct mount *mp, struct vnode **vpp)
538 1.1 jdolecek {
539 1.1 jdolecek struct iso_mnt *imp = VFSTOISOFS(mp);
540 1.1 jdolecek struct iso_directory_record *dp =
541 1.1 jdolecek (struct iso_directory_record *)imp->root;
542 1.1 jdolecek ino_t ino = isodirino(dp, imp);
543 1.22 perry
544 1.1 jdolecek /*
545 1.1 jdolecek * With RRIP we must use the `.' entry of the root directory.
546 1.1 jdolecek * Simply tell vget, that it's a relocated directory.
547 1.1 jdolecek */
548 1.1 jdolecek return (cd9660_vget_internal(mp, ino, vpp,
549 1.7 thorpej imp->iso_ftype == ISO_FTYPE_RRIP, dp));
550 1.1 jdolecek }
551 1.1 jdolecek
552 1.1 jdolecek /*
553 1.1 jdolecek * Get file system statistics.
554 1.1 jdolecek */
555 1.1 jdolecek int
556 1.57 matt cd9660_statvfs(struct mount *mp, struct statvfs *sbp)
557 1.1 jdolecek {
558 1.1 jdolecek struct iso_mnt *isomp;
559 1.22 perry
560 1.1 jdolecek isomp = VFSTOISOFS(mp);
561 1.1 jdolecek
562 1.1 jdolecek sbp->f_bsize = isomp->logical_block_size;
563 1.12 christos sbp->f_frsize = sbp->f_bsize;
564 1.1 jdolecek sbp->f_iosize = sbp->f_bsize; /* XXX */
565 1.1 jdolecek sbp->f_blocks = isomp->volume_space_size;
566 1.1 jdolecek sbp->f_bfree = 0; /* total free blocks */
567 1.1 jdolecek sbp->f_bavail = 0; /* blocks free for non superuser */
568 1.12 christos sbp->f_bresvd = 0; /* total reserved blocks */
569 1.1 jdolecek sbp->f_files = 0; /* total files */
570 1.1 jdolecek sbp->f_ffree = 0; /* free file nodes */
571 1.25 jmmv sbp->f_favail = 0; /* free file nodes for non superuser */
572 1.12 christos sbp->f_fresvd = 0; /* reserved file nodes */
573 1.12 christos copy_statvfs_info(sbp, mp);
574 1.1 jdolecek /* Use the first spare for flags: */
575 1.1 jdolecek sbp->f_spare[0] = isomp->im_flags;
576 1.1 jdolecek return 0;
577 1.1 jdolecek }
578 1.1 jdolecek
579 1.1 jdolecek /* ARGSUSED */
580 1.1 jdolecek int
581 1.57 matt cd9660_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
582 1.1 jdolecek {
583 1.57 matt return 0;
584 1.1 jdolecek }
585 1.1 jdolecek
586 1.1 jdolecek /*
587 1.1 jdolecek * File handle to vnode
588 1.1 jdolecek *
589 1.1 jdolecek * Have to be really careful about stale file handles:
590 1.1 jdolecek * - check that the inode number is in range
591 1.1 jdolecek * - call iget() to get the locked inode
592 1.1 jdolecek * - check for an unallocated inode (i_mode == 0)
593 1.1 jdolecek * - check that the generation number matches
594 1.1 jdolecek */
595 1.1 jdolecek
596 1.1 jdolecek struct ifid {
597 1.1 jdolecek ushort ifid_len;
598 1.1 jdolecek ushort ifid_pad;
599 1.1 jdolecek int ifid_ino;
600 1.1 jdolecek long ifid_start;
601 1.1 jdolecek };
602 1.1 jdolecek
603 1.1 jdolecek /* ARGSUSED */
604 1.1 jdolecek int
605 1.57 matt cd9660_fhtovp(struct mount *mp, struct fid *fhp, struct vnode **vpp)
606 1.1 jdolecek {
607 1.33 martin struct ifid ifh;
608 1.1 jdolecek struct iso_node *ip;
609 1.1 jdolecek struct vnode *nvp;
610 1.1 jdolecek int error;
611 1.22 perry
612 1.33 martin if (fhp->fid_len != sizeof(ifh))
613 1.33 martin return EINVAL;
614 1.33 martin
615 1.33 martin memcpy(&ifh, fhp, sizeof(ifh));
616 1.1 jdolecek #ifdef ISOFS_DBG
617 1.1 jdolecek printf("fhtovp: ino %d, start %ld\n",
618 1.33 martin ifh.ifid_ino, ifh.ifid_start);
619 1.1 jdolecek #endif
620 1.22 perry
621 1.33 martin if ((error = VFS_VGET(mp, ifh.ifid_ino, &nvp)) != 0) {
622 1.1 jdolecek *vpp = NULLVP;
623 1.1 jdolecek return (error);
624 1.1 jdolecek }
625 1.1 jdolecek ip = VTOI(nvp);
626 1.1 jdolecek if (ip->inode.iso_mode == 0) {
627 1.1 jdolecek vput(nvp);
628 1.1 jdolecek *vpp = NULLVP;
629 1.1 jdolecek return (ESTALE);
630 1.1 jdolecek }
631 1.1 jdolecek *vpp = nvp;
632 1.1 jdolecek return (0);
633 1.1 jdolecek }
634 1.1 jdolecek
635 1.1 jdolecek int
636 1.57 matt cd9660_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
637 1.1 jdolecek {
638 1.1 jdolecek
639 1.1 jdolecek /*
640 1.1 jdolecek * XXXX
641 1.1 jdolecek * It would be nice if we didn't always set the `relocated' flag
642 1.1 jdolecek * and force the extra read, but I don't want to think about fixing
643 1.1 jdolecek * that right now.
644 1.1 jdolecek */
645 1.1 jdolecek return (cd9660_vget_internal(mp, ino, vpp,
646 1.1 jdolecek #if 0
647 1.1 jdolecek VFSTOISOFS(mp)->iso_ftype == ISO_FTYPE_RRIP,
648 1.1 jdolecek #else
649 1.1 jdolecek 0,
650 1.1 jdolecek #endif
651 1.7 thorpej NULL));
652 1.1 jdolecek }
653 1.1 jdolecek
654 1.1 jdolecek int
655 1.57 matt cd9660_vget_internal(struct mount *mp, ino_t ino, struct vnode **vpp,
656 1.57 matt int relocated, struct iso_directory_record *isodir)
657 1.1 jdolecek {
658 1.1 jdolecek struct iso_mnt *imp;
659 1.1 jdolecek struct iso_node *ip;
660 1.1 jdolecek struct buf *bp;
661 1.54 ad struct vnode *vp;
662 1.1 jdolecek dev_t dev;
663 1.1 jdolecek int error;
664 1.1 jdolecek
665 1.1 jdolecek imp = VFSTOISOFS(mp);
666 1.1 jdolecek dev = imp->im_dev;
667 1.51 ad
668 1.51 ad retry:
669 1.51 ad if ((*vpp = cd9660_ihashget(dev, ino, LK_EXCLUSIVE)) != NULLVP)
670 1.1 jdolecek return (0);
671 1.1 jdolecek
672 1.1 jdolecek /* Allocate a new vnode/iso_node. */
673 1.1 jdolecek if ((error = getnewvnode(VT_ISOFS, mp, cd9660_vnodeop_p, &vp)) != 0) {
674 1.1 jdolecek *vpp = NULLVP;
675 1.1 jdolecek return (error);
676 1.1 jdolecek }
677 1.1 jdolecek ip = pool_get(&cd9660_node_pool, PR_WAITOK);
678 1.51 ad
679 1.51 ad /*
680 1.51 ad * If someone beat us to it, put back the freshly allocated
681 1.51 ad * vnode/inode pair and retry.
682 1.51 ad */
683 1.51 ad mutex_enter(&cd9660_hashlock);
684 1.51 ad if (cd9660_ihashget(dev, ino, 0) != NULL) {
685 1.51 ad mutex_exit(&cd9660_hashlock);
686 1.51 ad ungetnewvnode(vp);
687 1.51 ad pool_put(&cd9660_node_pool, ip);
688 1.51 ad goto retry;
689 1.51 ad }
690 1.51 ad
691 1.3 dsl memset(ip, 0, sizeof(struct iso_node));
692 1.1 jdolecek vp->v_data = ip;
693 1.1 jdolecek ip->i_vnode = vp;
694 1.1 jdolecek ip->i_dev = dev;
695 1.1 jdolecek ip->i_number = ino;
696 1.51 ad ip->i_mnt = imp;
697 1.51 ad ip->i_devvp = imp->im_devvp;
698 1.51 ad genfs_node_init(vp, &cd9660_genfsops);
699 1.1 jdolecek
700 1.1 jdolecek /*
701 1.1 jdolecek * Put it onto its hash chain and lock it so that other requests for
702 1.1 jdolecek * this inode will block if they arrive while we are sleeping waiting
703 1.1 jdolecek * for old data structures to be purged or for the contents of the
704 1.1 jdolecek * disk portion of this inode to be read.
705 1.1 jdolecek */
706 1.1 jdolecek cd9660_ihashins(ip);
707 1.51 ad mutex_exit(&cd9660_hashlock);
708 1.1 jdolecek
709 1.1 jdolecek if (isodir == 0) {
710 1.1 jdolecek int lbn, off;
711 1.1 jdolecek
712 1.1 jdolecek lbn = lblkno(imp, ino);
713 1.1 jdolecek if (lbn >= imp->volume_space_size) {
714 1.1 jdolecek vput(vp);
715 1.1 jdolecek printf("fhtovp: lbn exceed volume space %d\n", lbn);
716 1.1 jdolecek return (ESTALE);
717 1.1 jdolecek }
718 1.22 perry
719 1.1 jdolecek off = blkoff(imp, ino);
720 1.1 jdolecek if (off + ISO_DIRECTORY_RECORD_SIZE > imp->logical_block_size) {
721 1.1 jdolecek vput(vp);
722 1.1 jdolecek printf("fhtovp: crosses block boundary %d\n",
723 1.1 jdolecek off + ISO_DIRECTORY_RECORD_SIZE);
724 1.1 jdolecek return (ESTALE);
725 1.1 jdolecek }
726 1.22 perry
727 1.1 jdolecek error = bread(imp->im_devvp,
728 1.1 jdolecek lbn << (imp->im_bshift - DEV_BSHIFT),
729 1.1 jdolecek imp->logical_block_size, NOCRED, &bp);
730 1.1 jdolecek if (error) {
731 1.1 jdolecek vput(vp);
732 1.48 ad brelse(bp, 0);
733 1.1 jdolecek printf("fhtovp: bread error %d\n",error);
734 1.1 jdolecek return (error);
735 1.1 jdolecek }
736 1.40 christos isodir = (struct iso_directory_record *)((char *)bp->b_data + off);
737 1.1 jdolecek
738 1.1 jdolecek if (off + isonum_711(isodir->length) >
739 1.1 jdolecek imp->logical_block_size) {
740 1.1 jdolecek vput(vp);
741 1.1 jdolecek if (bp != 0)
742 1.48 ad brelse(bp, 0);
743 1.1 jdolecek printf("fhtovp: directory crosses block boundary %d[off=%d/len=%d]\n",
744 1.1 jdolecek off +isonum_711(isodir->length), off,
745 1.1 jdolecek isonum_711(isodir->length));
746 1.1 jdolecek return (ESTALE);
747 1.1 jdolecek }
748 1.22 perry
749 1.1 jdolecek #if 0
750 1.1 jdolecek if (isonum_733(isodir->extent) +
751 1.1 jdolecek isonum_711(isodir->ext_attr_length) != ifhp->ifid_start) {
752 1.1 jdolecek if (bp != 0)
753 1.48 ad brelse(bp, 0);
754 1.1 jdolecek printf("fhtovp: file start miss %d vs %d\n",
755 1.1 jdolecek isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length),
756 1.1 jdolecek ifhp->ifid_start);
757 1.1 jdolecek return (ESTALE);
758 1.1 jdolecek }
759 1.1 jdolecek #endif
760 1.1 jdolecek } else
761 1.1 jdolecek bp = 0;
762 1.1 jdolecek
763 1.1 jdolecek VREF(ip->i_devvp);
764 1.1 jdolecek
765 1.1 jdolecek if (relocated) {
766 1.1 jdolecek /*
767 1.1 jdolecek * On relocated directories we must
768 1.1 jdolecek * read the `.' entry out of a dir.
769 1.1 jdolecek */
770 1.1 jdolecek ip->iso_start = ino >> imp->im_bshift;
771 1.1 jdolecek if (bp != 0)
772 1.48 ad brelse(bp, 0);
773 1.29 yamt if ((error = cd9660_blkatoff(vp, (off_t)0, NULL, &bp)) != 0) {
774 1.1 jdolecek vput(vp);
775 1.1 jdolecek return (error);
776 1.1 jdolecek }
777 1.1 jdolecek isodir = (struct iso_directory_record *)bp->b_data;
778 1.1 jdolecek }
779 1.1 jdolecek
780 1.1 jdolecek ip->iso_extent = isonum_733(isodir->extent);
781 1.1 jdolecek ip->i_size = isonum_733(isodir->size);
782 1.1 jdolecek ip->iso_start = isonum_711(isodir->ext_attr_length) + ip->iso_extent;
783 1.22 perry
784 1.1 jdolecek /*
785 1.1 jdolecek * Setup time stamp, attribute
786 1.1 jdolecek */
787 1.1 jdolecek vp->v_type = VNON;
788 1.1 jdolecek switch (imp->iso_ftype) {
789 1.1 jdolecek default: /* ISO_FTYPE_9660 */
790 1.1 jdolecek {
791 1.1 jdolecek struct buf *bp2;
792 1.1 jdolecek int off;
793 1.1 jdolecek if ((imp->im_flags & ISOFSMNT_EXTATT)
794 1.1 jdolecek && (off = isonum_711(isodir->ext_attr_length)))
795 1.29 yamt cd9660_blkatoff(vp, (off_t)-(off << imp->im_bshift),
796 1.29 yamt NULL, &bp2);
797 1.1 jdolecek else
798 1.1 jdolecek bp2 = NULL;
799 1.1 jdolecek cd9660_defattr(isodir, ip, bp2);
800 1.1 jdolecek cd9660_deftstamp(isodir, ip, bp2);
801 1.1 jdolecek if (bp2)
802 1.48 ad brelse(bp2, 0);
803 1.1 jdolecek break;
804 1.1 jdolecek }
805 1.1 jdolecek case ISO_FTYPE_RRIP:
806 1.1 jdolecek cd9660_rrip_analyze(isodir, ip, imp);
807 1.1 jdolecek break;
808 1.1 jdolecek }
809 1.1 jdolecek
810 1.1 jdolecek if (bp != 0)
811 1.48 ad brelse(bp, 0);
812 1.1 jdolecek
813 1.1 jdolecek /*
814 1.1 jdolecek * Initialize the associated vnode
815 1.1 jdolecek */
816 1.1 jdolecek switch (vp->v_type = IFTOVT(ip->inode.iso_mode)) {
817 1.1 jdolecek case VFIFO:
818 1.1 jdolecek vp->v_op = cd9660_fifoop_p;
819 1.1 jdolecek break;
820 1.1 jdolecek case VCHR:
821 1.1 jdolecek case VBLK:
822 1.1 jdolecek /*
823 1.1 jdolecek * if device, look at device number table for translation
824 1.1 jdolecek */
825 1.1 jdolecek vp->v_op = cd9660_specop_p;
826 1.54 ad spec_node_init(vp, ip->inode.iso_rdev);
827 1.1 jdolecek break;
828 1.1 jdolecek case VLNK:
829 1.1 jdolecek case VNON:
830 1.1 jdolecek case VSOCK:
831 1.1 jdolecek case VDIR:
832 1.1 jdolecek case VBAD:
833 1.1 jdolecek break;
834 1.1 jdolecek case VREG:
835 1.1 jdolecek uvm_vnp_setsize(vp, ip->i_size);
836 1.1 jdolecek break;
837 1.1 jdolecek }
838 1.22 perry
839 1.45 pooka if (vp->v_type != VREG)
840 1.45 pooka uvm_vnp_setsize(vp, 0);
841 1.45 pooka
842 1.1 jdolecek if (ip->iso_extent == imp->root_extent)
843 1.49 ad vp->v_vflag |= VV_ROOT;
844 1.1 jdolecek
845 1.1 jdolecek /*
846 1.1 jdolecek * XXX need generation number?
847 1.1 jdolecek */
848 1.22 perry
849 1.1 jdolecek *vpp = vp;
850 1.1 jdolecek return (0);
851 1.1 jdolecek }
852 1.1 jdolecek
853 1.1 jdolecek /*
854 1.1 jdolecek * Vnode pointer to File handle
855 1.1 jdolecek */
856 1.1 jdolecek /* ARGSUSED */
857 1.1 jdolecek int
858 1.57 matt cd9660_vptofh(struct vnode *vp, struct fid *fhp, size_t *fh_size)
859 1.1 jdolecek {
860 1.1 jdolecek struct iso_node *ip = VTOI(vp);
861 1.33 martin struct ifid ifh;
862 1.22 perry
863 1.33 martin if (*fh_size < sizeof(struct ifid)) {
864 1.33 martin *fh_size = sizeof(struct ifid);
865 1.33 martin return E2BIG;
866 1.33 martin }
867 1.33 martin *fh_size = sizeof(struct ifid);
868 1.33 martin
869 1.33 martin memset(&ifh, 0, sizeof(ifh));
870 1.33 martin ifh.ifid_len = sizeof(struct ifid);
871 1.33 martin ifh.ifid_ino = ip->i_number;
872 1.33 martin ifh.ifid_start = ip->iso_start;
873 1.33 martin memcpy(fhp, &ifh, sizeof(ifh));
874 1.22 perry
875 1.1 jdolecek #ifdef ISOFS_DBG
876 1.1 jdolecek printf("vptofh: ino %d, start %ld\n",
877 1.33 martin ifh.ifid_ino,ifh.ifid_start);
878 1.1 jdolecek #endif
879 1.1 jdolecek return 0;
880 1.1 jdolecek }
881 1.1 jdolecek
882 1.10 atatat SYSCTL_SETUP(sysctl_vfs_cd9660_setup, "sysctl vfs.cd9660 subtree setup")
883 1.1 jdolecek {
884 1.10 atatat
885 1.11 atatat sysctl_createv(clog, 0, NULL, NULL,
886 1.11 atatat CTLFLAG_PERMANENT, CTLTYPE_NODE, "vfs", NULL,
887 1.10 atatat NULL, 0, NULL, 0,
888 1.10 atatat CTL_VFS, CTL_EOL);
889 1.11 atatat sysctl_createv(clog, 0, NULL, NULL,
890 1.14 atatat CTLFLAG_PERMANENT, CTLTYPE_NODE, "cd9660",
891 1.14 atatat SYSCTL_DESCR("ISO-9660 file system"),
892 1.10 atatat NULL, 0, NULL, 0,
893 1.10 atatat CTL_VFS, 14, CTL_EOL);
894 1.19 jdolecek
895 1.19 jdolecek sysctl_createv(clog, 0, NULL, NULL,
896 1.19 jdolecek CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
897 1.22 perry CTLTYPE_INT, "utf8_joliet",
898 1.19 jdolecek SYSCTL_DESCR("Encode Joliet file names to UTF-8"),
899 1.19 jdolecek NULL, 0, &cd9660_utf8_joliet, 0,
900 1.19 jdolecek CTL_VFS, 14, CD9660_UTF8_JOLIET, CTL_EOL);
901 1.19 jdolecek
902 1.1 jdolecek }
903