xref: /freebsd/sys/fs/cd9660/cd9660_vnops.c (revision c83ebe7781c6bff90fc64f692ee5a7f93af0a366)
1df8bae1dSRodney W. Grimes /*-
2df8bae1dSRodney W. Grimes  * Copyright (c) 1994
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley
6df8bae1dSRodney W. Grimes  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
7df8bae1dSRodney W. Grimes  * Support code is derived from software contributed to Berkeley
8df8bae1dSRodney W. Grimes  * by Atsushi Murai (amurai@spec.co.jp).
9df8bae1dSRodney W. Grimes  *
10df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
11df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
12df8bae1dSRodney W. Grimes  * are met:
13df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
15df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
16df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
17df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
18df8bae1dSRodney W. Grimes  * 3. All advertising materials mentioning features or use of this software
19df8bae1dSRodney W. Grimes  *    must display the following acknowledgement:
20df8bae1dSRodney W. Grimes  *	This product includes software developed by the University of
21df8bae1dSRodney W. Grimes  *	California, Berkeley and its contributors.
22df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
23df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
24df8bae1dSRodney W. Grimes  *    without specific prior written permission.
25df8bae1dSRodney W. Grimes  *
26df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
37df8bae1dSRodney W. Grimes  *
38df8bae1dSRodney W. Grimes  *	@(#)cd9660_vnops.c	8.3 (Berkeley) 1/23/94
39c83ebe77SJohn Dyson  * $Id: cd9660_vnops.c,v 1.15 1995/08/02 13:00:40 dfr Exp $
40df8bae1dSRodney W. Grimes  */
41df8bae1dSRodney W. Grimes 
42df8bae1dSRodney W. Grimes #include <sys/param.h>
43df8bae1dSRodney W. Grimes #include <sys/systm.h>
44df8bae1dSRodney W. Grimes #include <sys/namei.h>
45df8bae1dSRodney W. Grimes #include <sys/resourcevar.h>
46df8bae1dSRodney W. Grimes #include <sys/kernel.h>
47df8bae1dSRodney W. Grimes #include <sys/file.h>
48df8bae1dSRodney W. Grimes #include <sys/stat.h>
49df8bae1dSRodney W. Grimes #include <sys/buf.h>
50df8bae1dSRodney W. Grimes #include <sys/proc.h>
51df8bae1dSRodney W. Grimes #include <sys/conf.h>
52df8bae1dSRodney W. Grimes #include <sys/mount.h>
53df8bae1dSRodney W. Grimes #include <sys/vnode.h>
54df8bae1dSRodney W. Grimes #include <miscfs/specfs/specdev.h>
55df8bae1dSRodney W. Grimes #include <miscfs/fifofs/fifo.h>
56df8bae1dSRodney W. Grimes #include <sys/malloc.h>
57df8bae1dSRodney W. Grimes #include <sys/dir.h>
58df8bae1dSRodney W. Grimes 
59df8bae1dSRodney W. Grimes #include <isofs/cd9660/iso.h>
60df8bae1dSRodney W. Grimes #include <isofs/cd9660/cd9660_node.h>
61df8bae1dSRodney W. Grimes #include <isofs/cd9660/iso_rrip.h>
62df8bae1dSRodney W. Grimes 
63df8bae1dSRodney W. Grimes #if 0
64df8bae1dSRodney W. Grimes /*
65df8bae1dSRodney W. Grimes  * Mknod vnode call
66df8bae1dSRodney W. Grimes  *  Actually remap the device number
67df8bae1dSRodney W. Grimes  */
68df8bae1dSRodney W. Grimes cd9660_mknod(ndp, vap, cred, p)
69df8bae1dSRodney W. Grimes 	struct nameidata *ndp;
70df8bae1dSRodney W. Grimes 	struct ucred *cred;
71df8bae1dSRodney W. Grimes 	struct vattr *vap;
72df8bae1dSRodney W. Grimes 	struct proc *p;
73df8bae1dSRodney W. Grimes {
74df8bae1dSRodney W. Grimes #ifndef	ISODEVMAP
75df8bae1dSRodney W. Grimes 	free(ndp->ni_pnbuf, M_NAMEI);
76df8bae1dSRodney W. Grimes 	vput(ndp->ni_dvp);
77df8bae1dSRodney W. Grimes 	vput(ndp->ni_vp);
78df8bae1dSRodney W. Grimes 	return EINVAL;
79df8bae1dSRodney W. Grimes #else
80df8bae1dSRodney W. Grimes 	register struct vnode *vp;
81df8bae1dSRodney W. Grimes 	struct iso_node *ip;
82df8bae1dSRodney W. Grimes 	struct iso_dnode *dp;
83df8bae1dSRodney W. Grimes 	int error;
84df8bae1dSRodney W. Grimes 
85df8bae1dSRodney W. Grimes 	vp = ndp->ni_vp;
86df8bae1dSRodney W. Grimes 	ip = VTOI(vp);
87df8bae1dSRodney W. Grimes 
88df8bae1dSRodney W. Grimes 	if (ip->i_mnt->iso_ftype != ISO_FTYPE_RRIP
89df8bae1dSRodney W. Grimes 	    || vap->va_type != vp->v_type
90df8bae1dSRodney W. Grimes 	    || (vap->va_type != VCHR && vap->va_type != VBLK)) {
91df8bae1dSRodney W. Grimes 		free(ndp->ni_pnbuf, M_NAMEI);
92df8bae1dSRodney W. Grimes 		vput(ndp->ni_dvp);
93df8bae1dSRodney W. Grimes 		vput(ndp->ni_vp);
94df8bae1dSRodney W. Grimes 		return EINVAL;
95df8bae1dSRodney W. Grimes 	}
96df8bae1dSRodney W. Grimes 
97df8bae1dSRodney W. Grimes 	dp = iso_dmap(ip->i_dev,ip->i_number,1);
98df8bae1dSRodney W. Grimes 	if (ip->inode.iso_rdev == vap->va_rdev || vap->va_rdev == VNOVAL) {
99df8bae1dSRodney W. Grimes 		/* same as the unmapped one, delete the mapping */
100df8bae1dSRodney W. Grimes 		remque(dp);
101df8bae1dSRodney W. Grimes 		FREE(dp,M_CACHE);
102df8bae1dSRodney W. Grimes 	} else
103df8bae1dSRodney W. Grimes 		/* enter new mapping */
104df8bae1dSRodney W. Grimes 		dp->d_dev = vap->va_rdev;
105df8bae1dSRodney W. Grimes 
106df8bae1dSRodney W. Grimes 	/*
107df8bae1dSRodney W. Grimes 	 * Remove inode so that it will be reloaded by iget and
108df8bae1dSRodney W. Grimes 	 * checked to see if it is an alias of an existing entry
109df8bae1dSRodney W. Grimes 	 * in the inode cache.
110df8bae1dSRodney W. Grimes 	 */
111df8bae1dSRodney W. Grimes 	vput(vp);
112df8bae1dSRodney W. Grimes 	vp->v_type = VNON;
113df8bae1dSRodney W. Grimes 	vgone(vp);
114df8bae1dSRodney W. Grimes 	return (0);
115df8bae1dSRodney W. Grimes #endif
116df8bae1dSRodney W. Grimes }
117df8bae1dSRodney W. Grimes #endif
118df8bae1dSRodney W. Grimes 
119df8bae1dSRodney W. Grimes /*
120df8bae1dSRodney W. Grimes  * Open called.
121df8bae1dSRodney W. Grimes  *
122df8bae1dSRodney W. Grimes  * Nothing to do.
123df8bae1dSRodney W. Grimes  */
124df8bae1dSRodney W. Grimes /* ARGSUSED */
125df8bae1dSRodney W. Grimes int
126df8bae1dSRodney W. Grimes cd9660_open(ap)
127df8bae1dSRodney W. Grimes 	struct vop_open_args /* {
128df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
129df8bae1dSRodney W. Grimes 		int  a_mode;
130df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
131df8bae1dSRodney W. Grimes 		struct proc *a_p;
132df8bae1dSRodney W. Grimes 	} */ *ap;
133df8bae1dSRodney W. Grimes {
134df8bae1dSRodney W. Grimes 	return (0);
135df8bae1dSRodney W. Grimes }
136df8bae1dSRodney W. Grimes 
137df8bae1dSRodney W. Grimes /*
138df8bae1dSRodney W. Grimes  * Close called
139df8bae1dSRodney W. Grimes  *
140df8bae1dSRodney W. Grimes  * Update the times on the inode on writeable file systems.
141df8bae1dSRodney W. Grimes  */
142df8bae1dSRodney W. Grimes /* ARGSUSED */
143df8bae1dSRodney W. Grimes int
144df8bae1dSRodney W. Grimes cd9660_close(ap)
145df8bae1dSRodney W. Grimes 	struct vop_close_args /* {
146df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
147df8bae1dSRodney W. Grimes 		int  a_fflag;
148df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
149df8bae1dSRodney W. Grimes 		struct proc *a_p;
150df8bae1dSRodney W. Grimes 	} */ *ap;
151df8bae1dSRodney W. Grimes {
152df8bae1dSRodney W. Grimes 	return (0);
153df8bae1dSRodney W. Grimes }
154df8bae1dSRodney W. Grimes 
155df8bae1dSRodney W. Grimes /*
156df8bae1dSRodney W. Grimes  * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
157df8bae1dSRodney W. Grimes  * The mode is shifted to select the owner/group/other fields. The
158df8bae1dSRodney W. Grimes  * super user is granted all permissions.
159df8bae1dSRodney W. Grimes  */
160df8bae1dSRodney W. Grimes /* ARGSUSED */
16126f9a767SRodney W. Grimes int
162df8bae1dSRodney W. Grimes cd9660_access(ap)
163df8bae1dSRodney W. Grimes 	struct vop_access_args /* {
164df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
165df8bae1dSRodney W. Grimes 		int  a_mode;
166df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
167df8bae1dSRodney W. Grimes 		struct proc *a_p;
168df8bae1dSRodney W. Grimes 	} */ *ap;
169df8bae1dSRodney W. Grimes {
170df8bae1dSRodney W. Grimes 	return (0);
171df8bae1dSRodney W. Grimes }
172df8bae1dSRodney W. Grimes 
17326f9a767SRodney W. Grimes int
174df8bae1dSRodney W. Grimes cd9660_getattr(ap)
175df8bae1dSRodney W. Grimes 	struct vop_getattr_args /* {
176df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
177df8bae1dSRodney W. Grimes 		struct vattr *a_vap;
178df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
179df8bae1dSRodney W. Grimes 		struct proc *a_p;
180df8bae1dSRodney W. Grimes 	} */ *ap;
181df8bae1dSRodney W. Grimes 
182df8bae1dSRodney W. Grimes {
183df8bae1dSRodney W. Grimes 	struct vnode *vp = ap->a_vp;
184df8bae1dSRodney W. Grimes 	register struct vattr *vap = ap->a_vap;
185df8bae1dSRodney W. Grimes 	register struct iso_node *ip = VTOI(vp);
186df8bae1dSRodney W. Grimes 
187df8bae1dSRodney W. Grimes 	vap->va_fsid	= ip->i_dev;
188df8bae1dSRodney W. Grimes 	vap->va_fileid	= ip->i_number;
189df8bae1dSRodney W. Grimes 
190df8bae1dSRodney W. Grimes 	vap->va_mode	= ip->inode.iso_mode;
191df8bae1dSRodney W. Grimes 	vap->va_nlink	= ip->inode.iso_links;
192df8bae1dSRodney W. Grimes 	vap->va_uid	= ip->inode.iso_uid;
193df8bae1dSRodney W. Grimes 	vap->va_gid	= ip->inode.iso_gid;
194df8bae1dSRodney W. Grimes 	vap->va_atime	= ip->inode.iso_atime;
195df8bae1dSRodney W. Grimes 	vap->va_mtime	= ip->inode.iso_mtime;
196df8bae1dSRodney W. Grimes 	vap->va_ctime	= ip->inode.iso_ctime;
197df8bae1dSRodney W. Grimes 	vap->va_rdev	= ip->inode.iso_rdev;
198df8bae1dSRodney W. Grimes 
199df8bae1dSRodney W. Grimes 	vap->va_size	= (u_quad_t) ip->i_size;
200df8bae1dSRodney W. Grimes 	vap->va_flags	= 0;
201df8bae1dSRodney W. Grimes 	vap->va_gen = 1;
202df8bae1dSRodney W. Grimes 	vap->va_blocksize = ip->i_mnt->logical_block_size;
203df8bae1dSRodney W. Grimes 	vap->va_bytes	= (u_quad_t) ip->i_size;
204df8bae1dSRodney W. Grimes 	vap->va_type	= vp->v_type;
20594a8606fSDoug Rabson 	vap->va_filerev	= 0;
206df8bae1dSRodney W. Grimes 	return (0);
207df8bae1dSRodney W. Grimes }
208df8bae1dSRodney W. Grimes 
209df8bae1dSRodney W. Grimes #if ISO_DEFAULT_BLOCK_SIZE >= NBPG
210df8bae1dSRodney W. Grimes #ifdef DEBUG
211df8bae1dSRodney W. Grimes extern int doclusterread;
212df8bae1dSRodney W. Grimes #else
213df8bae1dSRodney W. Grimes #define doclusterread 1
214df8bae1dSRodney W. Grimes #endif
215df8bae1dSRodney W. Grimes #else
216df8bae1dSRodney W. Grimes /* XXX until cluster routines can handle block sizes less than one page */
217df8bae1dSRodney W. Grimes #define doclusterread 0
218df8bae1dSRodney W. Grimes #endif
219df8bae1dSRodney W. Grimes 
220df8bae1dSRodney W. Grimes /*
221df8bae1dSRodney W. Grimes  * Vnode op for reading.
222df8bae1dSRodney W. Grimes  */
22326f9a767SRodney W. Grimes int
224df8bae1dSRodney W. Grimes cd9660_read(ap)
225df8bae1dSRodney W. Grimes 	struct vop_read_args /* {
226df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
227df8bae1dSRodney W. Grimes 		struct uio *a_uio;
228df8bae1dSRodney W. Grimes 		int a_ioflag;
229df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
230df8bae1dSRodney W. Grimes 	} */ *ap;
231df8bae1dSRodney W. Grimes {
232df8bae1dSRodney W. Grimes 	struct vnode *vp = ap->a_vp;
233df8bae1dSRodney W. Grimes 	register struct uio *uio = ap->a_uio;
234df8bae1dSRodney W. Grimes 	register struct iso_node *ip = VTOI(vp);
235df8bae1dSRodney W. Grimes 	register struct iso_mnt *imp;
236df8bae1dSRodney W. Grimes 	struct buf *bp;
2371295d82eSGary Palmer 	daddr_t lbn, rablock;
238df8bae1dSRodney W. Grimes 	off_t diff;
239df8bae1dSRodney W. Grimes 	int rasize, error = 0;
240df8bae1dSRodney W. Grimes 	long size, n, on;
241df8bae1dSRodney W. Grimes 
242df8bae1dSRodney W. Grimes 	if (uio->uio_resid == 0)
243df8bae1dSRodney W. Grimes 		return (0);
244df8bae1dSRodney W. Grimes 	if (uio->uio_offset < 0)
245df8bae1dSRodney W. Grimes 		return (EINVAL);
246df8bae1dSRodney W. Grimes 	ip->i_flag |= IACC;
247df8bae1dSRodney W. Grimes 	imp = ip->i_mnt;
248df8bae1dSRodney W. Grimes 	do {
249df8bae1dSRodney W. Grimes 		lbn = iso_lblkno(imp, uio->uio_offset);
250df8bae1dSRodney W. Grimes 		on = iso_blkoff(imp, uio->uio_offset);
251df8bae1dSRodney W. Grimes 		n = min((unsigned)(imp->logical_block_size - on),
252df8bae1dSRodney W. Grimes 			uio->uio_resid);
253df8bae1dSRodney W. Grimes 		diff = (off_t)ip->i_size - uio->uio_offset;
254df8bae1dSRodney W. Grimes 		if (diff <= 0)
255df8bae1dSRodney W. Grimes 			return (0);
256df8bae1dSRodney W. Grimes 		if (diff < n)
257df8bae1dSRodney W. Grimes 			n = diff;
258df8bae1dSRodney W. Grimes 		size = iso_blksize(imp, ip, lbn);
259df8bae1dSRodney W. Grimes 		rablock = lbn + 1;
260df8bae1dSRodney W. Grimes 		if (doclusterread) {
261df8bae1dSRodney W. Grimes 			if (iso_lblktosize(imp, rablock) <= ip->i_size)
262df8bae1dSRodney W. Grimes 				error = cluster_read(vp, (off_t)ip->i_size,
263df8bae1dSRodney W. Grimes 						     lbn, size, NOCRED, &bp);
264df8bae1dSRodney W. Grimes 			else
265df8bae1dSRodney W. Grimes 				error = bread(vp, lbn, size, NOCRED, &bp);
266df8bae1dSRodney W. Grimes 		} else {
267df8bae1dSRodney W. Grimes 			if (vp->v_lastr + 1 == lbn &&
268df8bae1dSRodney W. Grimes 			    iso_lblktosize(imp, rablock) < ip->i_size) {
269df8bae1dSRodney W. Grimes 				rasize = iso_blksize(imp, ip, rablock);
270df8bae1dSRodney W. Grimes 				error = breadn(vp, lbn, size, &rablock,
271df8bae1dSRodney W. Grimes 					       &rasize, 1, NOCRED, &bp);
272df8bae1dSRodney W. Grimes 			} else
273df8bae1dSRodney W. Grimes 				error = bread(vp, lbn, size, NOCRED, &bp);
274df8bae1dSRodney W. Grimes 		}
275df8bae1dSRodney W. Grimes 		vp->v_lastr = lbn;
276df8bae1dSRodney W. Grimes 		n = min(n, size - bp->b_resid);
277df8bae1dSRodney W. Grimes 		if (error) {
278df8bae1dSRodney W. Grimes 			brelse(bp);
279df8bae1dSRodney W. Grimes 			return (error);
280df8bae1dSRodney W. Grimes 		}
281df8bae1dSRodney W. Grimes 
282df8bae1dSRodney W. Grimes 		error = uiomove(bp->b_un.b_addr + on, (int)n, uio);
283df8bae1dSRodney W. Grimes 		brelse(bp);
284df8bae1dSRodney W. Grimes 	} while (error == 0 && uio->uio_resid > 0 && n != 0);
285df8bae1dSRodney W. Grimes 	return (error);
286df8bae1dSRodney W. Grimes }
287df8bae1dSRodney W. Grimes 
288df8bae1dSRodney W. Grimes /* ARGSUSED */
289df8bae1dSRodney W. Grimes int
290df8bae1dSRodney W. Grimes cd9660_ioctl(ap)
291df8bae1dSRodney W. Grimes 	struct vop_ioctl_args /* {
292df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
293df8bae1dSRodney W. Grimes 		int  a_command;
294df8bae1dSRodney W. Grimes 		caddr_t	 a_data;
295df8bae1dSRodney W. Grimes 		int  a_fflag;
296df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
297df8bae1dSRodney W. Grimes 		struct proc *a_p;
298df8bae1dSRodney W. Grimes 	} */ *ap;
299df8bae1dSRodney W. Grimes {
300df8bae1dSRodney W. Grimes 	printf("You did ioctl for isofs !!\n");
301df8bae1dSRodney W. Grimes 	return (ENOTTY);
302df8bae1dSRodney W. Grimes }
303df8bae1dSRodney W. Grimes 
304df8bae1dSRodney W. Grimes /* ARGSUSED */
305df8bae1dSRodney W. Grimes int
306df8bae1dSRodney W. Grimes cd9660_select(ap)
307df8bae1dSRodney W. Grimes 	struct vop_select_args /* {
308df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
309df8bae1dSRodney W. Grimes 		int  a_which;
310df8bae1dSRodney W. Grimes 		int  a_fflags;
311df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
312df8bae1dSRodney W. Grimes 		struct proc *a_p;
313df8bae1dSRodney W. Grimes 	} */ *ap;
314df8bae1dSRodney W. Grimes {
315df8bae1dSRodney W. Grimes 
316df8bae1dSRodney W. Grimes 	/*
317df8bae1dSRodney W. Grimes 	 * We should really check to see if I/O is possible.
318df8bae1dSRodney W. Grimes 	 */
319df8bae1dSRodney W. Grimes 	return (1);
320df8bae1dSRodney W. Grimes }
321df8bae1dSRodney W. Grimes 
322df8bae1dSRodney W. Grimes /*
323df8bae1dSRodney W. Grimes  * Mmap a file
324df8bae1dSRodney W. Grimes  *
325df8bae1dSRodney W. Grimes  * NB Currently unsupported.
326df8bae1dSRodney W. Grimes  */
327df8bae1dSRodney W. Grimes /* ARGSUSED */
328df8bae1dSRodney W. Grimes int
329df8bae1dSRodney W. Grimes cd9660_mmap(ap)
330df8bae1dSRodney W. Grimes 	struct vop_mmap_args /* {
331df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
332df8bae1dSRodney W. Grimes 		int  a_fflags;
333df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
334df8bae1dSRodney W. Grimes 		struct proc *a_p;
335df8bae1dSRodney W. Grimes 	} */ *ap;
336df8bae1dSRodney W. Grimes {
337df8bae1dSRodney W. Grimes 
338df8bae1dSRodney W. Grimes 	return (EINVAL);
339df8bae1dSRodney W. Grimes }
340df8bae1dSRodney W. Grimes 
341df8bae1dSRodney W. Grimes /*
342df8bae1dSRodney W. Grimes  * Seek on a file
343df8bae1dSRodney W. Grimes  *
344df8bae1dSRodney W. Grimes  * Nothing to do, so just return.
345df8bae1dSRodney W. Grimes  */
346df8bae1dSRodney W. Grimes /* ARGSUSED */
347df8bae1dSRodney W. Grimes int
348df8bae1dSRodney W. Grimes cd9660_seek(ap)
349df8bae1dSRodney W. Grimes 	struct vop_seek_args /* {
350df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
351df8bae1dSRodney W. Grimes 		off_t  a_oldoff;
352df8bae1dSRodney W. Grimes 		off_t  a_newoff;
353df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
354df8bae1dSRodney W. Grimes 	} */ *ap;
355df8bae1dSRodney W. Grimes {
356df8bae1dSRodney W. Grimes 
357df8bae1dSRodney W. Grimes 	return (0);
358df8bae1dSRodney W. Grimes }
359df8bae1dSRodney W. Grimes 
360df8bae1dSRodney W. Grimes /*
361df8bae1dSRodney W. Grimes  * Structure for reading directories
362df8bae1dSRodney W. Grimes  */
363df8bae1dSRodney W. Grimes struct isoreaddir {
364df8bae1dSRodney W. Grimes 	struct dirent saveent;
365df8bae1dSRodney W. Grimes 	struct dirent assocent;
366df8bae1dSRodney W. Grimes 	struct dirent current;
367df8bae1dSRodney W. Grimes 	off_t saveoff;
368df8bae1dSRodney W. Grimes 	off_t assocoff;
369df8bae1dSRodney W. Grimes 	off_t curroff;
370df8bae1dSRodney W. Grimes 	struct uio *uio;
371df8bae1dSRodney W. Grimes 	off_t uio_off;
372df8bae1dSRodney W. Grimes 	u_int *cookiep;
373df8bae1dSRodney W. Grimes 	int ncookies;
374df8bae1dSRodney W. Grimes 	int eof;
375df8bae1dSRodney W. Grimes };
376df8bae1dSRodney W. Grimes 
377df8bae1dSRodney W. Grimes static int
378df8bae1dSRodney W. Grimes iso_uiodir(idp,dp,off)
379df8bae1dSRodney W. Grimes 	struct isoreaddir *idp;
380df8bae1dSRodney W. Grimes 	struct dirent *dp;
381df8bae1dSRodney W. Grimes 	off_t off;
382df8bae1dSRodney W. Grimes {
383df8bae1dSRodney W. Grimes 	int error;
384df8bae1dSRodney W. Grimes 
385df8bae1dSRodney W. Grimes 	dp->d_name[dp->d_namlen] = 0;
386df8bae1dSRodney W. Grimes 	dp->d_reclen = DIRSIZ(dp);
387df8bae1dSRodney W. Grimes 
388df8bae1dSRodney W. Grimes 	if (idp->uio->uio_resid < dp->d_reclen) {
389df8bae1dSRodney W. Grimes 		idp->eof = 0;
390df8bae1dSRodney W. Grimes 		return -1;
391df8bae1dSRodney W. Grimes 	}
392df8bae1dSRodney W. Grimes 
393df8bae1dSRodney W. Grimes 	if (idp->cookiep) {
394df8bae1dSRodney W. Grimes 		if (idp->ncookies <= 0) {
395df8bae1dSRodney W. Grimes 			idp->eof = 0;
396df8bae1dSRodney W. Grimes 			return -1;
397df8bae1dSRodney W. Grimes 		}
398df8bae1dSRodney W. Grimes 
399df8bae1dSRodney W. Grimes 		*idp->cookiep++ = off;
400df8bae1dSRodney W. Grimes 		--idp->ncookies;
401df8bae1dSRodney W. Grimes 	}
402df8bae1dSRodney W. Grimes 
4031295d82eSGary Palmer 	if ((error = uiomove((caddr_t)dp,dp->d_reclen,idp->uio)))
404df8bae1dSRodney W. Grimes 		return error;
405df8bae1dSRodney W. Grimes 	idp->uio_off = off;
406df8bae1dSRodney W. Grimes 	return 0;
407df8bae1dSRodney W. Grimes }
408df8bae1dSRodney W. Grimes 
409df8bae1dSRodney W. Grimes static int
410df8bae1dSRodney W. Grimes iso_shipdir(idp)
411df8bae1dSRodney W. Grimes 	struct isoreaddir *idp;
412df8bae1dSRodney W. Grimes {
413df8bae1dSRodney W. Grimes 	struct dirent *dp;
414df8bae1dSRodney W. Grimes 	int cl, sl, assoc;
415df8bae1dSRodney W. Grimes 	int error;
416df8bae1dSRodney W. Grimes 	char *cname, *sname;
417df8bae1dSRodney W. Grimes 
418df8bae1dSRodney W. Grimes 	cl = idp->current.d_namlen;
419df8bae1dSRodney W. Grimes 	cname = idp->current.d_name;
4201295d82eSGary Palmer assoc = (cl > 1) && (*cname == ASSOCCHAR);
4211295d82eSGary Palmer 	if (assoc) {
422df8bae1dSRodney W. Grimes 		cl--;
423df8bae1dSRodney W. Grimes 		cname++;
424df8bae1dSRodney W. Grimes 	}
425df8bae1dSRodney W. Grimes 
426df8bae1dSRodney W. Grimes 	dp = &idp->saveent;
427df8bae1dSRodney W. Grimes 	sname = dp->d_name;
428df8bae1dSRodney W. Grimes 	if (!(sl = dp->d_namlen)) {
429df8bae1dSRodney W. Grimes 		dp = &idp->assocent;
430df8bae1dSRodney W. Grimes 		sname = dp->d_name + 1;
431df8bae1dSRodney W. Grimes 		sl = dp->d_namlen - 1;
432df8bae1dSRodney W. Grimes 	}
433df8bae1dSRodney W. Grimes 	if (sl > 0) {
434df8bae1dSRodney W. Grimes 		if (sl != cl
435df8bae1dSRodney W. Grimes 		    || bcmp(sname,cname,sl)) {
436df8bae1dSRodney W. Grimes 			if (idp->assocent.d_namlen) {
4371295d82eSGary Palmer 				if ((error = iso_uiodir(idp,&idp->assocent,idp->assocoff)))
438df8bae1dSRodney W. Grimes 					return error;
439df8bae1dSRodney W. Grimes 				idp->assocent.d_namlen = 0;
440df8bae1dSRodney W. Grimes 			}
441df8bae1dSRodney W. Grimes 			if (idp->saveent.d_namlen) {
4421295d82eSGary Palmer 				if ((error = iso_uiodir(idp,&idp->saveent,idp->saveoff)))
443df8bae1dSRodney W. Grimes 					return error;
444df8bae1dSRodney W. Grimes 				idp->saveent.d_namlen = 0;
445df8bae1dSRodney W. Grimes 			}
446df8bae1dSRodney W. Grimes 		}
447df8bae1dSRodney W. Grimes 	}
448df8bae1dSRodney W. Grimes 	idp->current.d_reclen = DIRSIZ(&idp->current);
449df8bae1dSRodney W. Grimes 	if (assoc) {
450df8bae1dSRodney W. Grimes 		idp->assocoff = idp->curroff;
451df8bae1dSRodney W. Grimes 		bcopy(&idp->current,&idp->assocent,idp->current.d_reclen);
452df8bae1dSRodney W. Grimes 	} else {
453df8bae1dSRodney W. Grimes 		idp->saveoff = idp->curroff;
454df8bae1dSRodney W. Grimes 		bcopy(&idp->current,&idp->saveent,idp->current.d_reclen);
455df8bae1dSRodney W. Grimes 	}
456df8bae1dSRodney W. Grimes 	return 0;
457df8bae1dSRodney W. Grimes }
458df8bae1dSRodney W. Grimes 
459df8bae1dSRodney W. Grimes /*
460df8bae1dSRodney W. Grimes  * Vnode op for readdir
461df8bae1dSRodney W. Grimes  * XXX make sure everything still works now that eofflagp and cookiep
462df8bae1dSRodney W. Grimes  * are no longer args.
463df8bae1dSRodney W. Grimes  */
464df8bae1dSRodney W. Grimes int
465df8bae1dSRodney W. Grimes cd9660_readdir(ap)
466df8bae1dSRodney W. Grimes 	struct vop_readdir_args /* {
467df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
468df8bae1dSRodney W. Grimes 		struct uio *a_uio;
469df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
470df8bae1dSRodney W. Grimes 	} */ *ap;
471df8bae1dSRodney W. Grimes {
472df8bae1dSRodney W. Grimes 	register struct uio *uio = ap->a_uio;
473df8bae1dSRodney W. Grimes 	struct isoreaddir *idp;
474df8bae1dSRodney W. Grimes 	int entryoffsetinblock;
475df8bae1dSRodney W. Grimes 	int error = 0;
476df8bae1dSRodney W. Grimes 	int endsearch;
477df8bae1dSRodney W. Grimes 	struct iso_directory_record *ep;
478df8bae1dSRodney W. Grimes 	u_short elen;
479df8bae1dSRodney W. Grimes 	int reclen;
480988fa8efSJoerg Wunsch 	int isoflags;
481df8bae1dSRodney W. Grimes 	struct iso_mnt *imp;
482df8bae1dSRodney W. Grimes 	struct iso_node *ip;
483df8bae1dSRodney W. Grimes 	struct buf *bp = NULL;
48406e79831SDoug Rabson 	u_short tmplen;
4859abf4d6eSDoug Rabson 	int ncookies = 0;
4869abf4d6eSDoug Rabson 	u_int *cookies = NULL;
487df8bae1dSRodney W. Grimes 
488df8bae1dSRodney W. Grimes 	ip = VTOI(ap->a_vp);
489df8bae1dSRodney W. Grimes 	imp = ip->i_mnt;
490df8bae1dSRodney W. Grimes 
491df8bae1dSRodney W. Grimes 	MALLOC(idp,struct isoreaddir *,sizeof(*idp),M_TEMP,M_WAITOK);
492df8bae1dSRodney W. Grimes 	idp->saveent.d_namlen = 0;
493df8bae1dSRodney W. Grimes 	idp->assocent.d_namlen = 0;
494df8bae1dSRodney W. Grimes 	idp->uio = uio;
4959abf4d6eSDoug Rabson 	if (ap->a_ncookies != NULL) {
4969abf4d6eSDoug Rabson 		/*
4979abf4d6eSDoug Rabson 		 * Guess the number of cookies needed.
4989abf4d6eSDoug Rabson 		 */
4999abf4d6eSDoug Rabson 		ncookies = uio->uio_resid / 16;
5009abf4d6eSDoug Rabson 		MALLOC(cookies, u_int *, ncookies * sizeof(u_int), M_TEMP, M_WAITOK);
501df8bae1dSRodney W. Grimes 		idp->cookiep = cookies;
502df8bae1dSRodney W. Grimes 		idp->ncookies = ncookies;
5039abf4d6eSDoug Rabson 	} else
504df8bae1dSRodney W. Grimes 		idp->cookiep = 0;
5059abf4d6eSDoug Rabson 	idp->eof = 0;
506df8bae1dSRodney W. Grimes 	idp->curroff = uio->uio_offset;
507df8bae1dSRodney W. Grimes 
508df8bae1dSRodney W. Grimes 	entryoffsetinblock = iso_blkoff(imp, idp->curroff);
509df8bae1dSRodney W. Grimes 	if (entryoffsetinblock != 0) {
5101295d82eSGary Palmer 		if ((error = iso_blkatoff(ip, idp->curroff, &bp))) {
511df8bae1dSRodney W. Grimes 			FREE(idp,M_TEMP);
512df8bae1dSRodney W. Grimes 			return (error);
513df8bae1dSRodney W. Grimes 		}
514df8bae1dSRodney W. Grimes 	}
515df8bae1dSRodney W. Grimes 
516df8bae1dSRodney W. Grimes 	endsearch = ip->i_size;
517df8bae1dSRodney W. Grimes 
518df8bae1dSRodney W. Grimes 	while (idp->curroff < endsearch) {
519df8bae1dSRodney W. Grimes 		/*
520df8bae1dSRodney W. Grimes 		 * If offset is on a block boundary,
521df8bae1dSRodney W. Grimes 		 * read the next directory block.
522df8bae1dSRodney W. Grimes 		 * Release previous if it exists.
523df8bae1dSRodney W. Grimes 		 */
524df8bae1dSRodney W. Grimes 
525df8bae1dSRodney W. Grimes 		if (iso_blkoff(imp, idp->curroff) == 0) {
526df8bae1dSRodney W. Grimes 			if (bp != NULL)
527df8bae1dSRodney W. Grimes 				brelse(bp);
5281295d82eSGary Palmer 			if ((error = iso_blkatoff(ip, idp->curroff, &bp)))
529df8bae1dSRodney W. Grimes 				break;
530df8bae1dSRodney W. Grimes 			entryoffsetinblock = 0;
531df8bae1dSRodney W. Grimes 		}
532df8bae1dSRodney W. Grimes 		/*
533df8bae1dSRodney W. Grimes 		 * Get pointer to next entry.
534df8bae1dSRodney W. Grimes 		 */
535df8bae1dSRodney W. Grimes 
536df8bae1dSRodney W. Grimes 		ep = (struct iso_directory_record *)
537df8bae1dSRodney W. Grimes 			(bp->b_un.b_addr + entryoffsetinblock);
538df8bae1dSRodney W. Grimes 
539df8bae1dSRodney W. Grimes 		reclen = isonum_711 (ep->length);
540988fa8efSJoerg Wunsch 		isoflags = isonum_711(imp->iso_ftype == ISO_FTYPE_HIGH_SIERRA?
541988fa8efSJoerg Wunsch 				      &ep->date[6]: ep->flags);
542df8bae1dSRodney W. Grimes 		if (reclen == 0) {
543df8bae1dSRodney W. Grimes 			/* skip to next block, if any */
544df8bae1dSRodney W. Grimes 			idp->curroff = roundup (idp->curroff,
545df8bae1dSRodney W. Grimes 						imp->logical_block_size);
546df8bae1dSRodney W. Grimes 			continue;
547df8bae1dSRodney W. Grimes 		}
548df8bae1dSRodney W. Grimes 
549df8bae1dSRodney W. Grimes 		if (reclen < ISO_DIRECTORY_RECORD_SIZE) {
550df8bae1dSRodney W. Grimes 			error = EINVAL;
551df8bae1dSRodney W. Grimes 			/* illegal entry, stop */
552df8bae1dSRodney W. Grimes 			break;
553df8bae1dSRodney W. Grimes 		}
554df8bae1dSRodney W. Grimes 
555df8bae1dSRodney W. Grimes 		if (entryoffsetinblock + reclen > imp->logical_block_size) {
556df8bae1dSRodney W. Grimes 			error = EINVAL;
557df8bae1dSRodney W. Grimes 			/* illegal directory, so stop looking */
558df8bae1dSRodney W. Grimes 			break;
559df8bae1dSRodney W. Grimes 		}
560df8bae1dSRodney W. Grimes 
5611b9d1a09SPoul-Henning Kamp 		/* XXX: be more intelligent if we can */
5621b9d1a09SPoul-Henning Kamp 		idp->current.d_type = DT_UNKNOWN;
5631b9d1a09SPoul-Henning Kamp 
564df8bae1dSRodney W. Grimes 		idp->current.d_namlen = isonum_711 (ep->name_len);
565988fa8efSJoerg Wunsch 		if (isoflags & 2)
566df8bae1dSRodney W. Grimes 			isodirino(&idp->current.d_fileno,ep,imp);
567df8bae1dSRodney W. Grimes 		else
568df8bae1dSRodney W. Grimes 			idp->current.d_fileno = dbtob(bp->b_blkno) +
569df8bae1dSRodney W. Grimes 				idp->curroff;
570df8bae1dSRodney W. Grimes 
571df8bae1dSRodney W. Grimes 		if (reclen < ISO_DIRECTORY_RECORD_SIZE + idp->current.d_namlen) {
572df8bae1dSRodney W. Grimes 			error = EINVAL;
573df8bae1dSRodney W. Grimes 			/* illegal entry, stop */
574df8bae1dSRodney W. Grimes 			break;
575df8bae1dSRodney W. Grimes 		}
576df8bae1dSRodney W. Grimes 
577df8bae1dSRodney W. Grimes 		idp->curroff += reclen;
578df8bae1dSRodney W. Grimes 		/*
579df8bae1dSRodney W. Grimes 		 *
580df8bae1dSRodney W. Grimes 		 */
581df8bae1dSRodney W. Grimes 		switch (imp->iso_ftype) {
582df8bae1dSRodney W. Grimes 		case ISO_FTYPE_RRIP:
583df8bae1dSRodney W. Grimes 			cd9660_rrip_getname(ep,idp->current.d_name,
58406e79831SDoug Rabson 					   &tmplen,
585df8bae1dSRodney W. Grimes 					   &idp->current.d_fileno,imp);
58606e79831SDoug Rabson 			idp->current.d_namlen = tmplen;
587df8bae1dSRodney W. Grimes 			if (idp->current.d_namlen)
588df8bae1dSRodney W. Grimes 				error = iso_uiodir(idp,&idp->current,idp->curroff);
589df8bae1dSRodney W. Grimes 			break;
590988fa8efSJoerg Wunsch 		default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 || ISO_FTYPE_HIGH_SIERRA*/
591df8bae1dSRodney W. Grimes 			strcpy(idp->current.d_name,"..");
592df8bae1dSRodney W. Grimes 			switch (ep->name[0]) {
593df8bae1dSRodney W. Grimes 			case 0:
594df8bae1dSRodney W. Grimes 				idp->current.d_namlen = 1;
595df8bae1dSRodney W. Grimes 				error = iso_uiodir(idp,&idp->current,idp->curroff);
596df8bae1dSRodney W. Grimes 				break;
597df8bae1dSRodney W. Grimes 			case 1:
598df8bae1dSRodney W. Grimes 				idp->current.d_namlen = 2;
599df8bae1dSRodney W. Grimes 				error = iso_uiodir(idp,&idp->current,idp->curroff);
600df8bae1dSRodney W. Grimes 				break;
601df8bae1dSRodney W. Grimes 			default:
602df8bae1dSRodney W. Grimes 				isofntrans(ep->name,idp->current.d_namlen,
603df8bae1dSRodney W. Grimes 					   idp->current.d_name, &elen,
604df8bae1dSRodney W. Grimes 					   imp->iso_ftype == ISO_FTYPE_9660,
605988fa8efSJoerg Wunsch 					   isoflags & 4);
606df8bae1dSRodney W. Grimes 				idp->current.d_namlen = (u_char)elen;
607df8bae1dSRodney W. Grimes 				if (imp->iso_ftype == ISO_FTYPE_DEFAULT)
608df8bae1dSRodney W. Grimes 					error = iso_shipdir(idp);
609df8bae1dSRodney W. Grimes 				else
610df8bae1dSRodney W. Grimes 					error = iso_uiodir(idp,&idp->current,idp->curroff);
611df8bae1dSRodney W. Grimes 				break;
612df8bae1dSRodney W. Grimes 			}
613df8bae1dSRodney W. Grimes 		}
614df8bae1dSRodney W. Grimes 		if (error)
615df8bae1dSRodney W. Grimes 			break;
616df8bae1dSRodney W. Grimes 
617df8bae1dSRodney W. Grimes 		entryoffsetinblock += reclen;
618df8bae1dSRodney W. Grimes 	}
619df8bae1dSRodney W. Grimes 
620df8bae1dSRodney W. Grimes 	if (!error && imp->iso_ftype == ISO_FTYPE_DEFAULT) {
621df8bae1dSRodney W. Grimes 		idp->current.d_namlen = 0;
622df8bae1dSRodney W. Grimes 		error = iso_shipdir(idp);
623df8bae1dSRodney W. Grimes 	}
624df8bae1dSRodney W. Grimes 	if (error < 0)
625df8bae1dSRodney W. Grimes 		error = 0;
626df8bae1dSRodney W. Grimes 
6279abf4d6eSDoug Rabson 	if (ap->a_ncookies != NULL) {
6289abf4d6eSDoug Rabson 		if (error)
6299abf4d6eSDoug Rabson 			FREE(cookies, M_TEMP);
6309abf4d6eSDoug Rabson 		else {
6319abf4d6eSDoug Rabson 			/*
6329abf4d6eSDoug Rabson 			 * Work out the number of cookies actually used.
6339abf4d6eSDoug Rabson 			 */
6349abf4d6eSDoug Rabson 			*ap->a_ncookies = ncookies - idp->ncookies;
6359abf4d6eSDoug Rabson 			*ap->a_cookies = cookies;
6369abf4d6eSDoug Rabson 		}
6379abf4d6eSDoug Rabson 	}
6389abf4d6eSDoug Rabson 
639df8bae1dSRodney W. Grimes 	if (bp)
640df8bae1dSRodney W. Grimes 		brelse (bp);
641df8bae1dSRodney W. Grimes 
642df8bae1dSRodney W. Grimes 	uio->uio_offset = idp->uio_off;
6439abf4d6eSDoug Rabson 	if (ap->a_eofflag)
6449abf4d6eSDoug Rabson 	    *ap->a_eofflag = idp->eof;
645df8bae1dSRodney W. Grimes 
646df8bae1dSRodney W. Grimes 	FREE(idp,M_TEMP);
647df8bae1dSRodney W. Grimes 
648df8bae1dSRodney W. Grimes 	return (error);
649df8bae1dSRodney W. Grimes }
650df8bae1dSRodney W. Grimes 
651df8bae1dSRodney W. Grimes /*
652df8bae1dSRodney W. Grimes  * Return target name of a symbolic link
653df8bae1dSRodney W. Grimes  * Shouldn't we get the parent vnode and read the data from there?
654df8bae1dSRodney W. Grimes  * This could eventually result in deadlocks in cd9660_lookup.
655df8bae1dSRodney W. Grimes  * But otherwise the block read here is in the block buffer two times.
656df8bae1dSRodney W. Grimes  */
657df8bae1dSRodney W. Grimes typedef struct iso_directory_record ISODIR;
658df8bae1dSRodney W. Grimes typedef struct iso_node		    ISONODE;
659df8bae1dSRodney W. Grimes typedef struct iso_mnt		    ISOMNT;
660df8bae1dSRodney W. Grimes int
661df8bae1dSRodney W. Grimes cd9660_readlink(ap)
662df8bae1dSRodney W. Grimes 	struct vop_readlink_args /* {
663df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
664df8bae1dSRodney W. Grimes 		struct uio *a_uio;
665df8bae1dSRodney W. Grimes 		struct ucred *a_cred;
666df8bae1dSRodney W. Grimes 	} */ *ap;
667df8bae1dSRodney W. Grimes {
668df8bae1dSRodney W. Grimes 	ISONODE	*ip;
669df8bae1dSRodney W. Grimes 	ISODIR	*dirp;
670df8bae1dSRodney W. Grimes 	ISOMNT	*imp;
671df8bae1dSRodney W. Grimes 	struct	buf *bp;
672df8bae1dSRodney W. Grimes 	u_short	symlen;
673df8bae1dSRodney W. Grimes 	int	error;
674df8bae1dSRodney W. Grimes 	char	*symname;
675df8bae1dSRodney W. Grimes 
676df8bae1dSRodney W. Grimes 	ip  = VTOI(ap->a_vp);
677df8bae1dSRodney W. Grimes 	imp = ip->i_mnt;
678df8bae1dSRodney W. Grimes 
679df8bae1dSRodney W. Grimes 	if (imp->iso_ftype != ISO_FTYPE_RRIP)
680df8bae1dSRodney W. Grimes 		return EINVAL;
681df8bae1dSRodney W. Grimes 
682df8bae1dSRodney W. Grimes 	/*
683df8bae1dSRodney W. Grimes 	 * Get parents directory record block that this inode included.
684df8bae1dSRodney W. Grimes 	 */
685df8bae1dSRodney W. Grimes 	error = bread(imp->im_devvp,
68606e79831SDoug Rabson 		      iso_dblkno(imp, ip->i_number),
687df8bae1dSRodney W. Grimes 		      imp->logical_block_size,
688df8bae1dSRodney W. Grimes 		      NOCRED,
689df8bae1dSRodney W. Grimes 		      &bp);
690df8bae1dSRodney W. Grimes 	if (error) {
691df8bae1dSRodney W. Grimes 		brelse(bp);
692df8bae1dSRodney W. Grimes 		return EINVAL;
693df8bae1dSRodney W. Grimes 	}
694df8bae1dSRodney W. Grimes 
695df8bae1dSRodney W. Grimes 	/*
696df8bae1dSRodney W. Grimes 	 * Setup the directory pointer for this inode
697df8bae1dSRodney W. Grimes 	 */
698df8bae1dSRodney W. Grimes 	dirp = (ISODIR *)(bp->b_un.b_addr + (ip->i_number & imp->im_bmask));
699df8bae1dSRodney W. Grimes #ifdef DEBUG
700df8bae1dSRodney W. Grimes 	printf("lbn=%d,off=%d,bsize=%d,DEV_BSIZE=%d, dirp= %08x, b_addr=%08x, offset=%08x(%08x)\n",
701df8bae1dSRodney W. Grimes 	       (daddr_t)(ip->i_number >> imp->im_bshift),
702df8bae1dSRodney W. Grimes 	       ip->i_number & imp->im_bmask,
703df8bae1dSRodney W. Grimes 	       imp->logical_block_size,
704df8bae1dSRodney W. Grimes 	       DEV_BSIZE,
705df8bae1dSRodney W. Grimes 	       dirp,
706df8bae1dSRodney W. Grimes 	       bp->b_un.b_addr,
707df8bae1dSRodney W. Grimes 	       ip->i_number,
708df8bae1dSRodney W. Grimes 	       ip->i_number & imp->im_bmask );
709df8bae1dSRodney W. Grimes #endif
710df8bae1dSRodney W. Grimes 
711df8bae1dSRodney W. Grimes 	/*
712df8bae1dSRodney W. Grimes 	 * Just make sure, we have a right one....
713df8bae1dSRodney W. Grimes 	 *   1: Check not cross boundary on block
714df8bae1dSRodney W. Grimes 	 */
715df8bae1dSRodney W. Grimes 	if ((ip->i_number & imp->im_bmask) + isonum_711(dirp->length)
716df8bae1dSRodney W. Grimes 	    > imp->logical_block_size) {
717df8bae1dSRodney W. Grimes 		brelse(bp);
718df8bae1dSRodney W. Grimes 		return EINVAL;
719df8bae1dSRodney W. Grimes 	}
720df8bae1dSRodney W. Grimes 
721df8bae1dSRodney W. Grimes 	/*
722df8bae1dSRodney W. Grimes 	 * Now get a buffer
723df8bae1dSRodney W. Grimes 	 * Abuse a namei buffer for now.
724df8bae1dSRodney W. Grimes 	 */
725df8bae1dSRodney W. Grimes 	MALLOC(symname,char *,MAXPATHLEN,M_NAMEI,M_WAITOK);
726df8bae1dSRodney W. Grimes 
727df8bae1dSRodney W. Grimes 	/*
728df8bae1dSRodney W. Grimes 	 * Ok, we just gathering a symbolic name in SL record.
729df8bae1dSRodney W. Grimes 	 */
730df8bae1dSRodney W. Grimes 	if (cd9660_rrip_getsymname(dirp,symname,&symlen,imp) == 0) {
731df8bae1dSRodney W. Grimes 		FREE(symname,M_NAMEI);
732df8bae1dSRodney W. Grimes 		brelse(bp);
733df8bae1dSRodney W. Grimes 		return EINVAL;
734df8bae1dSRodney W. Grimes 	}
735df8bae1dSRodney W. Grimes 	/*
736df8bae1dSRodney W. Grimes 	 * Don't forget before you leave from home ;-)
737df8bae1dSRodney W. Grimes 	 */
738df8bae1dSRodney W. Grimes 	brelse(bp);
739df8bae1dSRodney W. Grimes 
740df8bae1dSRodney W. Grimes 	/*
741df8bae1dSRodney W. Grimes 	 * return with the symbolic name to caller's.
742df8bae1dSRodney W. Grimes 	 */
743df8bae1dSRodney W. Grimes 	error = uiomove(symname,symlen,ap->a_uio);
744df8bae1dSRodney W. Grimes 
745df8bae1dSRodney W. Grimes 	FREE(symname,M_NAMEI);
746df8bae1dSRodney W. Grimes 
747df8bae1dSRodney W. Grimes 	return error;
748df8bae1dSRodney W. Grimes }
749df8bae1dSRodney W. Grimes 
750df8bae1dSRodney W. Grimes /*
751df8bae1dSRodney W. Grimes  * Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
752df8bae1dSRodney W. Grimes  * done. If a buffer has been saved in anticipation of a CREATE, delete it.
753df8bae1dSRodney W. Grimes  */
754df8bae1dSRodney W. Grimes int
755df8bae1dSRodney W. Grimes cd9660_abortop(ap)
756df8bae1dSRodney W. Grimes 	struct vop_abortop_args /* {
757df8bae1dSRodney W. Grimes 		struct vnode *a_dvp;
758df8bae1dSRodney W. Grimes 		struct componentname *a_cnp;
759df8bae1dSRodney W. Grimes 	} */ *ap;
760df8bae1dSRodney W. Grimes {
761df8bae1dSRodney W. Grimes 	if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
762df8bae1dSRodney W. Grimes 		FREE(ap->a_cnp->cn_pnbuf, M_NAMEI);
763df8bae1dSRodney W. Grimes 	return 0;
764df8bae1dSRodney W. Grimes }
765df8bae1dSRodney W. Grimes 
766df8bae1dSRodney W. Grimes /*
767df8bae1dSRodney W. Grimes  * Lock an inode.
768df8bae1dSRodney W. Grimes  */
769df8bae1dSRodney W. Grimes int
770df8bae1dSRodney W. Grimes cd9660_lock(ap)
771df8bae1dSRodney W. Grimes 	struct vop_lock_args /* {
772df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
773df8bae1dSRodney W. Grimes 	} */ *ap;
774df8bae1dSRodney W. Grimes {
775df8bae1dSRodney W. Grimes 	register struct iso_node *ip = VTOI(ap->a_vp);
776df8bae1dSRodney W. Grimes 
777df8bae1dSRodney W. Grimes 	ISO_ILOCK(ip);
778df8bae1dSRodney W. Grimes 	return 0;
779df8bae1dSRodney W. Grimes }
780df8bae1dSRodney W. Grimes 
781df8bae1dSRodney W. Grimes /*
782df8bae1dSRodney W. Grimes  * Unlock an inode.
783df8bae1dSRodney W. Grimes  */
784df8bae1dSRodney W. Grimes int
785df8bae1dSRodney W. Grimes cd9660_unlock(ap)
786df8bae1dSRodney W. Grimes 	struct vop_unlock_args /* {
787df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
788df8bae1dSRodney W. Grimes 	} */ *ap;
789df8bae1dSRodney W. Grimes {
790df8bae1dSRodney W. Grimes 	register struct iso_node *ip = VTOI(ap->a_vp);
791df8bae1dSRodney W. Grimes 
792df8bae1dSRodney W. Grimes 	if (!(ip->i_flag & ILOCKED))
793df8bae1dSRodney W. Grimes 		panic("cd9660_unlock NOT LOCKED");
794df8bae1dSRodney W. Grimes 	ISO_IUNLOCK(ip);
795df8bae1dSRodney W. Grimes 	return 0;
796df8bae1dSRodney W. Grimes }
797df8bae1dSRodney W. Grimes 
798df8bae1dSRodney W. Grimes /*
799df8bae1dSRodney W. Grimes  * Check for a locked inode.
800df8bae1dSRodney W. Grimes  */
801df8bae1dSRodney W. Grimes int
802df8bae1dSRodney W. Grimes cd9660_islocked(ap)
803df8bae1dSRodney W. Grimes 	struct vop_islocked_args /* {
804df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
805df8bae1dSRodney W. Grimes 	} */ *ap;
806df8bae1dSRodney W. Grimes {
807df8bae1dSRodney W. Grimes 
808df8bae1dSRodney W. Grimes 	if (VTOI(ap->a_vp)->i_flag & ILOCKED)
809df8bae1dSRodney W. Grimes 		return 1;
810df8bae1dSRodney W. Grimes 	return 0;
811df8bae1dSRodney W. Grimes }
812df8bae1dSRodney W. Grimes 
813df8bae1dSRodney W. Grimes /*
814df8bae1dSRodney W. Grimes  * Calculate the logical to physical mapping if not done already,
815df8bae1dSRodney W. Grimes  * then call the device strategy routine.
816df8bae1dSRodney W. Grimes  */
817df8bae1dSRodney W. Grimes int
818df8bae1dSRodney W. Grimes cd9660_strategy(ap)
819df8bae1dSRodney W. Grimes 	struct vop_strategy_args /* {
820df8bae1dSRodney W. Grimes 		struct buf *a_bp;
821df8bae1dSRodney W. Grimes 	} */ *ap;
822df8bae1dSRodney W. Grimes {
823df8bae1dSRodney W. Grimes 	register struct buf *bp = ap->a_bp;
824df8bae1dSRodney W. Grimes 	register struct vnode *vp = bp->b_vp;
825df8bae1dSRodney W. Grimes 	register struct iso_node *ip;
826df8bae1dSRodney W. Grimes 	int error;
827df8bae1dSRodney W. Grimes 
828df8bae1dSRodney W. Grimes 	ip = VTOI(vp);
829df8bae1dSRodney W. Grimes 	if (vp->v_type == VBLK || vp->v_type == VCHR)
830df8bae1dSRodney W. Grimes 		panic("cd9660_strategy: spec");
831df8bae1dSRodney W. Grimes 	if (bp->b_blkno == bp->b_lblkno) {
8321295d82eSGary Palmer 		if ((error =
833c83ebe77SJohn Dyson 		    VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL, NULL))) {
834df8bae1dSRodney W. Grimes 			bp->b_error = error;
835df8bae1dSRodney W. Grimes 			bp->b_flags |= B_ERROR;
836df8bae1dSRodney W. Grimes 			biodone(bp);
837df8bae1dSRodney W. Grimes 			return (error);
838df8bae1dSRodney W. Grimes 		}
839df8bae1dSRodney W. Grimes 		if ((long)bp->b_blkno == -1)
840df8bae1dSRodney W. Grimes 			clrbuf(bp);
841df8bae1dSRodney W. Grimes 	}
842df8bae1dSRodney W. Grimes 	if ((long)bp->b_blkno == -1) {
843df8bae1dSRodney W. Grimes 		biodone(bp);
844df8bae1dSRodney W. Grimes 		return (0);
845df8bae1dSRodney W. Grimes 	}
846df8bae1dSRodney W. Grimes 	vp = ip->i_devvp;
847df8bae1dSRodney W. Grimes 	bp->b_dev = vp->v_rdev;
848df8bae1dSRodney W. Grimes 	VOCALL (vp->v_op, VOFFSET(vop_strategy), ap);
849df8bae1dSRodney W. Grimes 	return (0);
850df8bae1dSRodney W. Grimes }
851df8bae1dSRodney W. Grimes 
852df8bae1dSRodney W. Grimes /*
853df8bae1dSRodney W. Grimes  * Print out the contents of an inode.
854df8bae1dSRodney W. Grimes  */
855df8bae1dSRodney W. Grimes int
856df8bae1dSRodney W. Grimes cd9660_print(ap)
857df8bae1dSRodney W. Grimes 	struct vop_print_args /* {
858df8bae1dSRodney W. Grimes 		struct vnode *a_vp;
859df8bae1dSRodney W. Grimes 	} */ *ap;
860df8bae1dSRodney W. Grimes {
861df8bae1dSRodney W. Grimes 	printf("tag VT_ISOFS, isofs vnode\n");
862df8bae1dSRodney W. Grimes 	return 0;
863df8bae1dSRodney W. Grimes }
864df8bae1dSRodney W. Grimes 
865df8bae1dSRodney W. Grimes /*
866df8bae1dSRodney W. Grimes  * Unsupported operation
867df8bae1dSRodney W. Grimes  */
868df8bae1dSRodney W. Grimes int
869df8bae1dSRodney W. Grimes cd9660_enotsupp()
870df8bae1dSRodney W. Grimes {
871df8bae1dSRodney W. Grimes 
872df8bae1dSRodney W. Grimes 	return (EOPNOTSUPP);
873df8bae1dSRodney W. Grimes }
874df8bae1dSRodney W. Grimes 
875df8bae1dSRodney W. Grimes /*
876df8bae1dSRodney W. Grimes  * Global vfs data structures for isofs
877df8bae1dSRodney W. Grimes  */
878df8bae1dSRodney W. Grimes #define cd9660_create \
879df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_create_args *)))cd9660_enotsupp)
880df8bae1dSRodney W. Grimes #define cd9660_mknod ((int (*) __P((struct  vop_mknod_args *)))cd9660_enotsupp)
881df8bae1dSRodney W. Grimes #define cd9660_setattr \
882df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_setattr_args *)))cd9660_enotsupp)
883df8bae1dSRodney W. Grimes #define cd9660_write ((int (*) __P((struct  vop_write_args *)))cd9660_enotsupp)
884df8bae1dSRodney W. Grimes #define cd9660_fsync ((int (*) __P((struct  vop_fsync_args *)))nullop)
885df8bae1dSRodney W. Grimes #define cd9660_remove \
886df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_remove_args *)))cd9660_enotsupp)
887df8bae1dSRodney W. Grimes #define cd9660_link ((int (*) __P((struct  vop_link_args *)))cd9660_enotsupp)
888df8bae1dSRodney W. Grimes #define cd9660_rename \
889df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_rename_args *)))cd9660_enotsupp)
890df8bae1dSRodney W. Grimes #define cd9660_mkdir ((int (*) __P((struct  vop_mkdir_args *)))cd9660_enotsupp)
891df8bae1dSRodney W. Grimes #define cd9660_rmdir ((int (*) __P((struct  vop_rmdir_args *)))cd9660_enotsupp)
892df8bae1dSRodney W. Grimes #define cd9660_symlink \
893df8bae1dSRodney W. Grimes 	((int (*) __P((struct vop_symlink_args *)))cd9660_enotsupp)
894df8bae1dSRodney W. Grimes #define cd9660_pathconf \
895df8bae1dSRodney W. Grimes 	((int (*) __P((struct vop_pathconf_args *)))cd9660_enotsupp)
896df8bae1dSRodney W. Grimes #define cd9660_advlock \
897df8bae1dSRodney W. Grimes 	((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp)
898df8bae1dSRodney W. Grimes #define cd9660_blkatoff \
899df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_blkatoff_args *)))cd9660_enotsupp)
900df8bae1dSRodney W. Grimes #define cd9660_valloc ((int(*) __P(( \
901df8bae1dSRodney W. Grimes 		struct vnode *pvp, \
902df8bae1dSRodney W. Grimes 		int mode, \
903df8bae1dSRodney W. Grimes 		struct ucred *cred, \
904df8bae1dSRodney W. Grimes 		struct vnode **vpp))) cd9660_enotsupp)
905df8bae1dSRodney W. Grimes #define cd9660_vfree ((int (*) __P((struct  vop_vfree_args *)))cd9660_enotsupp)
906df8bae1dSRodney W. Grimes #define cd9660_truncate \
907df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_truncate_args *)))cd9660_enotsupp)
908df8bae1dSRodney W. Grimes #define cd9660_update \
909df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_update_args *)))cd9660_enotsupp)
910df8bae1dSRodney W. Grimes #define cd9660_bwrite \
911df8bae1dSRodney W. Grimes 	((int (*) __P((struct  vop_bwrite_args *)))cd9660_enotsupp)
912df8bae1dSRodney W. Grimes 
913df8bae1dSRodney W. Grimes /*
914df8bae1dSRodney W. Grimes  * Global vfs data structures for nfs
915df8bae1dSRodney W. Grimes  */
916df8bae1dSRodney W. Grimes int (**cd9660_vnodeop_p)();
917df8bae1dSRodney W. Grimes struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
918df8bae1dSRodney W. Grimes 	{ &vop_default_desc, vn_default_error },
919df8bae1dSRodney W. Grimes 	{ &vop_lookup_desc, cd9660_lookup },	/* lookup */
920df8bae1dSRodney W. Grimes 	{ &vop_create_desc, cd9660_create },	/* create */
921df8bae1dSRodney W. Grimes 	{ &vop_mknod_desc, cd9660_mknod },	/* mknod */
922df8bae1dSRodney W. Grimes 	{ &vop_open_desc, cd9660_open },	/* open */
923df8bae1dSRodney W. Grimes 	{ &vop_close_desc, cd9660_close },	/* close */
924df8bae1dSRodney W. Grimes 	{ &vop_access_desc, cd9660_access },	/* access */
925df8bae1dSRodney W. Grimes 	{ &vop_getattr_desc, cd9660_getattr },	/* getattr */
926df8bae1dSRodney W. Grimes 	{ &vop_setattr_desc, cd9660_setattr },	/* setattr */
927df8bae1dSRodney W. Grimes 	{ &vop_read_desc, cd9660_read },	/* read */
928df8bae1dSRodney W. Grimes 	{ &vop_write_desc, cd9660_write },	/* write */
929df8bae1dSRodney W. Grimes 	{ &vop_ioctl_desc, cd9660_ioctl },	/* ioctl */
930df8bae1dSRodney W. Grimes 	{ &vop_select_desc, cd9660_select },	/* select */
931df8bae1dSRodney W. Grimes 	{ &vop_mmap_desc, cd9660_mmap },	/* mmap */
932df8bae1dSRodney W. Grimes 	{ &vop_fsync_desc, cd9660_fsync },	/* fsync */
933df8bae1dSRodney W. Grimes 	{ &vop_seek_desc, cd9660_seek },	/* seek */
934df8bae1dSRodney W. Grimes 	{ &vop_remove_desc, cd9660_remove },	/* remove */
935df8bae1dSRodney W. Grimes 	{ &vop_link_desc, cd9660_link },	/* link */
936df8bae1dSRodney W. Grimes 	{ &vop_rename_desc, cd9660_rename },	/* rename */
937df8bae1dSRodney W. Grimes 	{ &vop_mkdir_desc, cd9660_mkdir },	/* mkdir */
938df8bae1dSRodney W. Grimes 	{ &vop_rmdir_desc, cd9660_rmdir },	/* rmdir */
939df8bae1dSRodney W. Grimes 	{ &vop_symlink_desc, cd9660_symlink },	/* symlink */
940df8bae1dSRodney W. Grimes 	{ &vop_readdir_desc, cd9660_readdir },	/* readdir */
941df8bae1dSRodney W. Grimes 	{ &vop_readlink_desc, cd9660_readlink },/* readlink */
942df8bae1dSRodney W. Grimes 	{ &vop_abortop_desc, cd9660_abortop },	/* abortop */
943df8bae1dSRodney W. Grimes 	{ &vop_inactive_desc, cd9660_inactive },/* inactive */
944df8bae1dSRodney W. Grimes 	{ &vop_reclaim_desc, cd9660_reclaim },	/* reclaim */
945df8bae1dSRodney W. Grimes 	{ &vop_lock_desc, cd9660_lock },	/* lock */
946df8bae1dSRodney W. Grimes 	{ &vop_unlock_desc, cd9660_unlock },	/* unlock */
947df8bae1dSRodney W. Grimes 	{ &vop_bmap_desc, cd9660_bmap },	/* bmap */
948df8bae1dSRodney W. Grimes 	{ &vop_strategy_desc, cd9660_strategy },/* strategy */
949df8bae1dSRodney W. Grimes 	{ &vop_print_desc, cd9660_print },	/* print */
950df8bae1dSRodney W. Grimes 	{ &vop_islocked_desc, cd9660_islocked },/* islocked */
951df8bae1dSRodney W. Grimes 	{ &vop_pathconf_desc, cd9660_pathconf },/* pathconf */
952df8bae1dSRodney W. Grimes 	{ &vop_advlock_desc, cd9660_advlock },	/* advlock */
953df8bae1dSRodney W. Grimes 	{ &vop_blkatoff_desc, cd9660_blkatoff },/* blkatoff */
954df8bae1dSRodney W. Grimes 	{ &vop_valloc_desc, cd9660_valloc },	/* valloc */
955df8bae1dSRodney W. Grimes 	{ &vop_vfree_desc, cd9660_vfree },	/* vfree */
956df8bae1dSRodney W. Grimes 	{ &vop_truncate_desc, cd9660_truncate },/* truncate */
957df8bae1dSRodney W. Grimes 	{ &vop_update_desc, cd9660_update },	/* update */
958df8bae1dSRodney W. Grimes 	{ &vop_bwrite_desc, vn_bwrite },
959df8bae1dSRodney W. Grimes 	{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
960df8bae1dSRodney W. Grimes };
961df8bae1dSRodney W. Grimes struct vnodeopv_desc cd9660_vnodeop_opv_desc =
962df8bae1dSRodney W. Grimes 	{ &cd9660_vnodeop_p, cd9660_vnodeop_entries };
963c901836cSGarrett Wollman VNODEOP_SET(cd9660_vnodeop_opv_desc);
964df8bae1dSRodney W. Grimes 
965df8bae1dSRodney W. Grimes /*
966df8bae1dSRodney W. Grimes  * Special device vnode ops
967df8bae1dSRodney W. Grimes  */
968df8bae1dSRodney W. Grimes int (**cd9660_specop_p)();
969df8bae1dSRodney W. Grimes struct vnodeopv_entry_desc cd9660_specop_entries[] = {
970df8bae1dSRodney W. Grimes 	{ &vop_default_desc, vn_default_error },
971df8bae1dSRodney W. Grimes 	{ &vop_lookup_desc, spec_lookup },	/* lookup */
972df8bae1dSRodney W. Grimes 	{ &vop_create_desc, cd9660_create },	/* create */
973df8bae1dSRodney W. Grimes 	{ &vop_mknod_desc, cd9660_mknod },	/* mknod */
974df8bae1dSRodney W. Grimes 	{ &vop_open_desc, spec_open },		/* open */
975df8bae1dSRodney W. Grimes 	{ &vop_close_desc, spec_close },	/* close */
976df8bae1dSRodney W. Grimes 	{ &vop_access_desc, cd9660_access },	/* access */
977df8bae1dSRodney W. Grimes 	{ &vop_getattr_desc, cd9660_getattr },	/* getattr */
978df8bae1dSRodney W. Grimes 	{ &vop_setattr_desc, cd9660_setattr },	/* setattr */
979df8bae1dSRodney W. Grimes 	{ &vop_read_desc, spec_read },		/* read */
980df8bae1dSRodney W. Grimes 	{ &vop_write_desc, spec_write },	/* write */
981df8bae1dSRodney W. Grimes 	{ &vop_ioctl_desc, spec_ioctl },	/* ioctl */
982df8bae1dSRodney W. Grimes 	{ &vop_select_desc, spec_select },	/* select */
983df8bae1dSRodney W. Grimes 	{ &vop_mmap_desc, spec_mmap },		/* mmap */
984df8bae1dSRodney W. Grimes 	{ &vop_fsync_desc, spec_fsync },	/* fsync */
985df8bae1dSRodney W. Grimes 	{ &vop_seek_desc, spec_seek },		/* seek */
986df8bae1dSRodney W. Grimes 	{ &vop_remove_desc, cd9660_remove },	/* remove */
987df8bae1dSRodney W. Grimes 	{ &vop_link_desc, cd9660_link },	/* link */
988df8bae1dSRodney W. Grimes 	{ &vop_rename_desc, cd9660_rename },	/* rename */
989df8bae1dSRodney W. Grimes 	{ &vop_mkdir_desc, cd9660_mkdir },	/* mkdir */
990df8bae1dSRodney W. Grimes 	{ &vop_rmdir_desc, cd9660_rmdir },	/* rmdir */
991df8bae1dSRodney W. Grimes 	{ &vop_symlink_desc, cd9660_symlink },	/* symlink */
992df8bae1dSRodney W. Grimes 	{ &vop_readdir_desc, spec_readdir },	/* readdir */
993df8bae1dSRodney W. Grimes 	{ &vop_readlink_desc, spec_readlink },	/* readlink */
994df8bae1dSRodney W. Grimes 	{ &vop_abortop_desc, spec_abortop },	/* abortop */
995df8bae1dSRodney W. Grimes 	{ &vop_inactive_desc, cd9660_inactive },/* inactive */
996df8bae1dSRodney W. Grimes 	{ &vop_reclaim_desc, cd9660_reclaim },	/* reclaim */
997df8bae1dSRodney W. Grimes 	{ &vop_lock_desc, cd9660_lock },	/* lock */
998df8bae1dSRodney W. Grimes 	{ &vop_unlock_desc, cd9660_unlock },	/* unlock */
999df8bae1dSRodney W. Grimes 	{ &vop_bmap_desc, spec_bmap },		/* bmap */
10004a565df5SPoul-Henning Kamp 	{ &vop_strategy_desc, spec_strategy },  /* strategy */
1001df8bae1dSRodney W. Grimes 	{ &vop_print_desc, cd9660_print },	/* print */
1002df8bae1dSRodney W. Grimes 	{ &vop_islocked_desc, cd9660_islocked },/* islocked */
1003df8bae1dSRodney W. Grimes 	{ &vop_pathconf_desc, spec_pathconf },	/* pathconf */
1004df8bae1dSRodney W. Grimes 	{ &vop_advlock_desc, spec_advlock },	/* advlock */
1005df8bae1dSRodney W. Grimes 	{ &vop_blkatoff_desc, spec_blkatoff },	/* blkatoff */
1006df8bae1dSRodney W. Grimes 	{ &vop_valloc_desc, spec_valloc },	/* valloc */
1007df8bae1dSRodney W. Grimes 	{ &vop_vfree_desc, spec_vfree },	/* vfree */
1008df8bae1dSRodney W. Grimes 	{ &vop_truncate_desc, spec_truncate },	/* truncate */
1009df8bae1dSRodney W. Grimes 	{ &vop_update_desc, cd9660_update },	/* update */
1010df8bae1dSRodney W. Grimes 	{ &vop_bwrite_desc, vn_bwrite },
1011df8bae1dSRodney W. Grimes 	{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
1012df8bae1dSRodney W. Grimes };
1013df8bae1dSRodney W. Grimes struct vnodeopv_desc cd9660_specop_opv_desc =
1014df8bae1dSRodney W. Grimes 	{ &cd9660_specop_p, cd9660_specop_entries };
1015c901836cSGarrett Wollman VNODEOP_SET(cd9660_specop_opv_desc);
1016df8bae1dSRodney W. Grimes 
1017df8bae1dSRodney W. Grimes int (**cd9660_fifoop_p)();
1018df8bae1dSRodney W. Grimes struct vnodeopv_entry_desc cd9660_fifoop_entries[] = {
1019df8bae1dSRodney W. Grimes 	{ &vop_default_desc, vn_default_error },
1020df8bae1dSRodney W. Grimes 	{ &vop_lookup_desc, fifo_lookup },	/* lookup */
1021df8bae1dSRodney W. Grimes 	{ &vop_create_desc, cd9660_create },	/* create */
1022df8bae1dSRodney W. Grimes 	{ &vop_mknod_desc, cd9660_mknod },	/* mknod */
1023df8bae1dSRodney W. Grimes 	{ &vop_open_desc, fifo_open },		/* open */
1024df8bae1dSRodney W. Grimes 	{ &vop_close_desc, fifo_close },	/* close */
1025df8bae1dSRodney W. Grimes 	{ &vop_access_desc, cd9660_access },	/* access */
1026df8bae1dSRodney W. Grimes 	{ &vop_getattr_desc, cd9660_getattr },	/* getattr */
1027df8bae1dSRodney W. Grimes 	{ &vop_setattr_desc, cd9660_setattr },	/* setattr */
1028df8bae1dSRodney W. Grimes 	{ &vop_read_desc, fifo_read },		/* read */
1029df8bae1dSRodney W. Grimes 	{ &vop_write_desc, fifo_write },	/* write */
1030df8bae1dSRodney W. Grimes 	{ &vop_ioctl_desc, fifo_ioctl },	/* ioctl */
1031df8bae1dSRodney W. Grimes 	{ &vop_select_desc, fifo_select },	/* select */
1032df8bae1dSRodney W. Grimes 	{ &vop_mmap_desc, fifo_mmap },		/* mmap */
1033df8bae1dSRodney W. Grimes 	{ &vop_fsync_desc, fifo_fsync },	/* fsync */
1034df8bae1dSRodney W. Grimes 	{ &vop_seek_desc, fifo_seek },		/* seek */
1035df8bae1dSRodney W. Grimes 	{ &vop_remove_desc, cd9660_remove },	/* remove */
1036df8bae1dSRodney W. Grimes 	{ &vop_link_desc, cd9660_link },	/* link */
1037df8bae1dSRodney W. Grimes 	{ &vop_rename_desc, cd9660_rename },	/* rename */
1038df8bae1dSRodney W. Grimes 	{ &vop_mkdir_desc, cd9660_mkdir },	/* mkdir */
1039df8bae1dSRodney W. Grimes 	{ &vop_rmdir_desc, cd9660_rmdir },	/* rmdir */
1040df8bae1dSRodney W. Grimes 	{ &vop_symlink_desc, cd9660_symlink },	/* symlink */
1041df8bae1dSRodney W. Grimes 	{ &vop_readdir_desc, fifo_readdir },	/* readdir */
1042df8bae1dSRodney W. Grimes 	{ &vop_readlink_desc, fifo_readlink },	/* readlink */
1043df8bae1dSRodney W. Grimes 	{ &vop_abortop_desc, fifo_abortop },	/* abortop */
1044df8bae1dSRodney W. Grimes 	{ &vop_inactive_desc, cd9660_inactive },/* inactive */
1045df8bae1dSRodney W. Grimes 	{ &vop_reclaim_desc, cd9660_reclaim },	/* reclaim */
1046df8bae1dSRodney W. Grimes 	{ &vop_lock_desc, cd9660_lock },	/* lock */
1047df8bae1dSRodney W. Grimes 	{ &vop_unlock_desc, cd9660_unlock },	/* unlock */
1048df8bae1dSRodney W. Grimes 	{ &vop_bmap_desc, fifo_bmap },		/* bmap */
1049df8bae1dSRodney W. Grimes 	{ &vop_strategy_desc, fifo_badop },	/* strategy */
1050df8bae1dSRodney W. Grimes 	{ &vop_print_desc, cd9660_print },	/* print */
1051df8bae1dSRodney W. Grimes 	{ &vop_islocked_desc, cd9660_islocked },/* islocked */
1052df8bae1dSRodney W. Grimes 	{ &vop_pathconf_desc, fifo_pathconf },	/* pathconf */
1053df8bae1dSRodney W. Grimes 	{ &vop_advlock_desc, fifo_advlock },	/* advlock */
1054df8bae1dSRodney W. Grimes 	{ &vop_blkatoff_desc, fifo_blkatoff },	/* blkatoff */
1055df8bae1dSRodney W. Grimes 	{ &vop_valloc_desc, fifo_valloc },	/* valloc */
1056df8bae1dSRodney W. Grimes 	{ &vop_vfree_desc, fifo_vfree },	/* vfree */
1057df8bae1dSRodney W. Grimes 	{ &vop_truncate_desc, fifo_truncate },	/* truncate */
1058df8bae1dSRodney W. Grimes 	{ &vop_update_desc, cd9660_update },	/* update */
1059df8bae1dSRodney W. Grimes 	{ &vop_bwrite_desc, vn_bwrite },
1060df8bae1dSRodney W. Grimes 	{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
1061df8bae1dSRodney W. Grimes };
1062df8bae1dSRodney W. Grimes struct vnodeopv_desc cd9660_fifoop_opv_desc =
1063df8bae1dSRodney W. Grimes 	{ &cd9660_fifoop_p, cd9660_fifoop_entries };
1064c901836cSGarrett Wollman 
1065c901836cSGarrett Wollman VNODEOP_SET(cd9660_fifoop_opv_desc);
1066