2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
23 * @APPLE_LICENSE_HEADER_END@
25 /* $NetBSD: cd9660_vnops.c,v 1.22 1994/12/27 19:05:12 mycroft Exp $ */
29 * The Regents of the University of California. All rights reserved.
31 * This code is derived from software contributed to Berkeley
32 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
33 * Support code is derived from software contributed to Berkeley
34 * by Atsushi Murai (amurai@spec.co.jp).
36 * Redistribution and use in source and binary forms, with or without
37 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in the
43 * documentation and/or other materials provided with the distribution.
44 * 3. All advertising materials mentioning features or use of this software
45 * must display the following acknowledgement:
46 * This product includes software developed by the University of
47 * California, Berkeley and its contributors.
48 * 4. Neither the name of the University nor the names of its contributors
49 * may be used to endorse or promote products derived from this software
50 * without specific prior written permission.
52 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64 * @(#)cd9660_vnops.c 8.15 (Berkeley) 12/5/94
67 * 02-Feb-00 chw Add cd9660_copyfile to return error
68 * 29-Sep-98 djb Add cd9660_getattrlist VOP for VDI support.
69 * 15-sep-98 added cd9660_rmdir to do proper unlocking - chw
70 * 12-aug-98 added cd9660_remove which will do proper unlocking - chw
71 * 17-Feb-98 radar 1669467 - changed lock protocols to use the lock manager - chw
72 * 22-Jan-98 radar 1669467 - ISO 9660 CD support - jwc
75 #include <sys/param.h>
76 #include <sys/systm.h>
77 #include <sys/vnode.h>
78 #include <sys/mount.h>
79 #include <sys/namei.h>
80 #include <sys/resourcevar.h>
81 #include <sys/kernel.h>
87 #include <miscfs/specfs/specdev.h>
88 #include <miscfs/fifofs/fifo.h>
89 #include <sys/malloc.h>
92 #include <vfs/vfs_support.h>
95 #include <architecture/byte_order.h>
97 #include <isofs/cd9660/iso.h>
98 #include <isofs/cd9660/cd9660_node.h>
99 #include <isofs/cd9660/iso_rrip.h>
109 struct vop_open_args
/* {
112 struct ucred *a_cred;
122 * Update the times on the inode on writeable file systems.
127 struct vop_close_args
/* {
130 struct ucred *a_cred;
138 * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
139 * The mode is shifted to select the owner/group/other fields. The
140 * super user is granted all permissions.
145 struct vop_access_args
/* {
148 struct ucred *a_cred;
152 struct vnode
*vp
= ap
->a_vp
;
153 struct iso_node
*ip
= VTOI(vp
);
154 struct ucred
*cred
= ap
->a_cred
;
155 mode_t mask
, mode
= ap
->a_mode
;
160 * Disallow write attempts on read-only file systems;
161 * unless the file is a socket, fifo, or a block or
162 * character device resident on the file system.
165 switch (vp
->v_type
) {
176 /* If immutable bit set, nobody gets to write it. */
178 if ((mode
& VWRITE
) && (ip
->i_flag
& IMMUTABLE
))
181 /* Otherwise, user id 0 always gets access. */
182 if (cred
->cr_uid
== 0)
187 /* Otherwise, check the owner. */
188 if (cred
->cr_uid
== ip
->inode
.iso_uid
) {
195 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
198 /* Otherwise, check the groups. */
199 for (i
= 0, gp
= cred
->cr_groups
; i
< cred
->cr_ngroups
; i
++, gp
++)
200 if (ip
->inode
.iso_gid
== *gp
) {
207 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
210 /* Otherwise, check everyone else. */
217 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
222 struct vop_getattr_args
/* {
225 struct ucred *a_cred;
230 struct vnode
*vp
= ap
->a_vp
;
231 register struct vattr
*vap
= ap
->a_vap
;
232 register struct iso_node
*ip
= VTOI(vp
);
234 vap
->va_fsid
= ip
->i_dev
;
235 vap
->va_fileid
= ip
->i_number
;
237 vap
->va_mode
= ip
->inode
.iso_mode
;
238 vap
->va_nlink
= ip
->inode
.iso_links
;
239 vap
->va_uid
= ip
->inode
.iso_uid
;
240 vap
->va_gid
= ip
->inode
.iso_gid
;
241 vap
->va_atime
= ip
->inode
.iso_atime
;
242 vap
->va_mtime
= ip
->inode
.iso_mtime
;
243 vap
->va_ctime
= ip
->inode
.iso_ctime
;
244 vap
->va_rdev
= ip
->inode
.iso_rdev
;
246 vap
->va_size
= (u_quad_t
) ip
->i_size
;
247 if (ip
->i_size
== 0 && (vap
->va_mode
& S_IFMT
) == S_IFLNK
) {
248 struct vop_readlink_args rdlnk
;
253 MALLOC(cp
, char *, MAXPATHLEN
, M_TEMP
, M_WAITOK
);
255 aiov
.iov_len
= MAXPATHLEN
;
256 auio
.uio_iov
= &aiov
;
259 auio
.uio_rw
= UIO_READ
;
260 auio
.uio_segflg
= UIO_SYSSPACE
;
261 auio
.uio_procp
= ap
->a_p
;
262 auio
.uio_resid
= MAXPATHLEN
;
264 rdlnk
.a_vp
= ap
->a_vp
;
265 rdlnk
.a_cred
= ap
->a_cred
;
266 if (cd9660_readlink(&rdlnk
) == 0)
267 vap
->va_size
= MAXPATHLEN
- auio
.uio_resid
;
272 vap
->va_blocksize
= ip
->i_mnt
->logical_block_size
;
273 vap
->va_bytes
= (u_quad_t
) (ip
->i_size
+ ip
->i_rsrcsize
);
274 vap
->va_type
= vp
->v_type
;
281 * Vnode op for reading.
285 struct vop_read_args
/* {
289 struct ucred *a_cred;
292 struct vnode
*vp
= ap
->a_vp
;
293 register struct uio
*uio
= ap
->a_uio
;
294 register struct iso_node
*ip
= VTOI(vp
);
295 register struct iso_mnt
*imp
;
297 daddr_t lbn
, rablock
;
299 int rasize
, error
= 0;
301 int devBlockSize
= 0;
303 if (uio
->uio_resid
== 0)
305 if (uio
->uio_offset
< 0)
309 VOP_DEVBLOCKSIZE(ip
->i_devvp
, &devBlockSize
);
311 if (UBCISVALID(vp
)) {
313 * Copy any part of the Apple Double header.
315 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (uio
->uio_offset
< ADH_SIZE
)) {
316 apple_double_header_t header
;
319 if (uio
->uio_offset
< sizeof(apple_double_header_t
)) {
320 header
.magic
= APPLEDOUBLE_MAGIC
;
321 header
.version
= APPLEDOUBLE_VERSION
;
323 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
324 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
325 header
.entries
[0].length
= 32;
326 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
327 header
.entries
[1].offset
= ADH_SIZE
;
328 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
329 header
.finfo
.fdType
= ip
->i_FileType
;
330 header
.finfo
.fdCreator
= ip
->i_Creator
;
331 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
332 header
.finfo
.fdLocation
.v
= -1;
333 header
.finfo
.fdLocation
.h
= -1;
334 header
.finfo
.fdReserved
= 0;
336 bytes
= min(uio
->uio_resid
, sizeof(apple_double_header_t
) - uio
->uio_offset
);
337 error
= uiomove(((char *) &header
) + uio
->uio_offset
, bytes
, uio
);
341 if (uio
->uio_resid
&& uio
->uio_offset
< ADH_SIZE
) {
344 if (kmem_alloc(kernel_map
, (vm_offset_t
*)&buffer
, ADH_SIZE
)) {
347 bytes
= min(uio
->uio_resid
, ADH_SIZE
- uio
->uio_offset
);
348 error
= uiomove(((char *) buffer
) + uio
->uio_offset
, bytes
, uio
);
349 kmem_free(kernel_map
, (vm_offset_t
)buffer
, ADH_SIZE
);
354 if (uio
->uio_resid
> 0)
355 error
= cluster_read(vp
, uio
, (off_t
)ip
->i_size
, devBlockSize
, 0);
359 lbn
= lblkno(imp
, uio
->uio_offset
);
360 on
= blkoff(imp
, uio
->uio_offset
);
361 n
= min((u_int
)(imp
->logical_block_size
- on
),
363 diff
= (off_t
)ip
->i_size
- uio
->uio_offset
;
368 size
= blksize(imp
, ip
, lbn
);
371 if (vp
->v_lastr
+ 1 == lbn
&&
372 lblktosize(imp
, rablock
) < ip
->i_size
) {
373 rasize
= blksize(imp
, ip
, rablock
);
374 error
= breadn(vp
, lbn
, size
, &rablock
,
375 &rasize
, 1, NOCRED
, &bp
);
377 error
= bread(vp
, lbn
, size
, NOCRED
, &bp
);
380 n
= min(n
, size
- bp
->b_resid
);
386 error
= uiomove(bp
->b_data
+ on
, (int)n
, uio
);
387 if (n
+ on
== imp
->logical_block_size
||
388 uio
->uio_offset
== (off_t
)ip
->i_size
)
389 bp
->b_flags
|= B_AGE
;
391 } while (error
== 0 && uio
->uio_resid
> 0 && n
!= 0);
400 struct vop_ioctl_args
/* {
405 struct ucred *a_cred;
415 struct vop_select_args
/* {
419 struct ucred *a_cred;
425 * We should really check to see if I/O is possible.
433 * NB Currently unsupported.
438 struct vop_mmap_args
/* {
441 struct ucred *a_cred;
452 * Nothing to do, so just return.
457 struct vop_seek_args
/* {
461 struct ucred *a_cred;
469 * Structure for reading directories
472 struct dirent saveent
;
473 struct dirent current
;
484 iso_uiodir(idp
,dp
,off
)
485 struct isoreaddir
*idp
;
491 dp
->d_name
[dp
->d_namlen
] = 0;
492 dp
->d_reclen
= DIRSIZ(dp
);
494 if (idp
->uio
->uio_resid
< dp
->d_reclen
) {
501 if (*idp
->ncookies
<= 0) {
506 **idp
->cookies
++ = off
;
511 if ( (error
= uiomove( (caddr_t
)dp
, dp
->d_reclen
, idp
->uio
)) )
519 struct isoreaddir
*idp
;
526 cl
= idp
->current
.d_namlen
;
527 cname
= idp
->current
.d_name
;
534 || bcmp(sname
,cname
,sl
)) {
535 if (idp
->saveent
.d_namlen
) {
536 if ( (error
= iso_uiodir(idp
,&idp
->saveent
,idp
->saveoff
)) )
538 idp
->saveent
.d_namlen
= 0;
542 idp
->current
.d_reclen
= DIRSIZ(&idp
->current
);
543 idp
->saveoff
= idp
->curroff
;
544 bcopy(&idp
->current
,&idp
->saveent
,idp
->current
.d_reclen
);
549 * Vnode op for readdir
551 * Note that directories are sector aligned (2K) and
552 * that an entry can cross a logical block but not
557 struct vop_readdir_args
/* {
558 struct vnodeop_desc *a_desc;
561 struct ucred *a_cred;
567 register struct uio
*uio
= ap
->a_uio
;
568 off_t startingOffset
= uio
->uio_offset
;
570 struct isoreaddir
*idp
;
571 struct vnode
*vdp
= ap
->a_vp
;
574 struct buf
*bp
= NULL
;
575 struct iso_directory_record
*ep
;
576 int entryoffsetinblock
;
585 bmask
= imp
->im_sector_size
- 1;
587 MALLOC(idp
, struct isoreaddir
*, sizeof(*idp
), M_TEMP
, M_WAITOK
);
588 idp
->saveent
.d_namlen
= 0;
591 * Is it worth trying to figure out the type?
593 idp
->saveent
.d_type
= idp
->current
.d_type
= DT_UNKNOWN
;
596 idp
->curroff
= uio
->uio_offset
;
598 if ((entryoffsetinblock
= idp
->curroff
& bmask
) &&
599 (error
= VOP_BLKATOFF(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
))) {
603 endsearch
= dp
->i_size
;
605 while (idp
->curroff
< endsearch
) {
607 * If offset is on a block boundary,
608 * read the next directory block.
609 * Release previous if it exists.
611 if ((idp
->curroff
& bmask
) == 0) {
614 if ((error
= VOP_BLKATOFF(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
)))
616 entryoffsetinblock
= 0;
619 * Get pointer to next entry.
621 ep
= (struct iso_directory_record
*)
622 ((char *)bp
->b_data
+ entryoffsetinblock
);
624 reclen
= isonum_711(ep
->length
);
626 /* skip to next block, if any */
628 (idp
->curroff
& ~bmask
) + imp
->im_sector_size
;
632 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
) {
634 /* illegal entry, stop */
638 if (entryoffsetinblock
+ reclen
> imp
->im_sector_size
) {
640 /* illegal directory, so stop looking */
644 idp
->current
.d_namlen
= isonum_711(ep
->name_len
);
646 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
+ idp
->current
.d_namlen
) {
648 /* illegal entry, stop */
653 * Some poorly mastered discs have an incorrect directory
654 * file size. If the '.' entry has a better size (bigger)
655 * then use that instead.
657 if ((uio
->uio_offset
== 0) && (isonum_733(ep
->size
) > endsearch
)) {
658 dp
->i_size
= endsearch
= isonum_733(ep
->size
);
661 if ( isonum_711(ep
->flags
) & directoryBit
)
662 idp
->current
.d_fileno
= isodirino(ep
, imp
);
664 idp
->current
.d_fileno
= (bp
->b_blkno
<< imp
->im_bshift
) +
668 idp
->curroff
+= reclen
;
670 switch (imp
->iso_ftype
) {
672 cd9660_rrip_getname(ep
,idp
->current
.d_name
, &namelen
,
673 &idp
->current
.d_fileno
,imp
);
674 idp
->current
.d_namlen
= (u_char
)namelen
;
675 if (idp
->current
.d_namlen
)
676 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
679 case ISO_FTYPE_JOLIET
:
680 ucsfntrans((u_int16_t
*)ep
->name
, idp
->current
.d_namlen
,
681 idp
->current
.d_name
, &namelen
,
682 isonum_711(ep
->flags
) & directoryBit
,
683 isonum_711(ep
->flags
) & associatedBit
);
684 idp
->current
.d_namlen
= (u_char
)namelen
;
685 if (idp
->current
.d_namlen
)
686 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
689 default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
690 strcpy(idp
->current
.d_name
,"..");
691 switch (ep
->name
[0]) {
693 idp
->current
.d_namlen
= 1;
694 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
697 idp
->current
.d_namlen
= 2;
698 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
701 isofntrans(ep
->name
,idp
->current
.d_namlen
,
702 idp
->current
.d_name
, &namelen
,
703 imp
->iso_ftype
== ISO_FTYPE_9660
,
704 isonum_711(ep
->flags
) & associatedBit
);
705 idp
->current
.d_namlen
= (u_char
)namelen
;
706 if (imp
->iso_ftype
== ISO_FTYPE_DEFAULT
)
707 error
= iso_shipdir(idp
);
709 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
716 entryoffsetinblock
+= reclen
;
719 if (!error
&& imp
->iso_ftype
== ISO_FTYPE_DEFAULT
) {
720 idp
->current
.d_namlen
= 0;
721 error
= iso_shipdir(idp
);
724 if (!error
&& ap
->a_ncookies
) {
725 struct dirent
*dp
, *dpstart
;
731 * Only the NFS server uses cookies, and it loads the
732 * directory block into system space, so we can just look at
735 * We assume the entire transfer is done to a single contiguous buffer.
737 if (uio
->uio_segflg
!= UIO_SYSSPACE
|| uio
->uio_iovcnt
!= 1)
738 panic("ufs_readdir: lost in space");
741 * Make a first pass over the buffer just generated,
742 * counting the number of entries:
744 dpstart
= (struct dirent
*) (uio
->uio_iov
->iov_base
- (uio
->uio_offset
- startingOffset
));
745 for (dp
= dpstart
, bufferOffset
= startingOffset
, ncookies
= 0;
746 bufferOffset
< uio
->uio_offset
; ) {
747 if (dp
->d_reclen
== 0)
749 bufferOffset
+= dp
->d_reclen
;
751 dp
= (struct dirent
*)((caddr_t
)dp
+ dp
->d_reclen
);
753 lost
+= uio
->uio_offset
- bufferOffset
;
754 uio
->uio_offset
= bufferOffset
;
757 * Allocate a buffer to hold the cookies requested:
759 MALLOC(cookies
, u_long
*, ncookies
* sizeof(u_long
), M_TEMP
, M_WAITOK
);
760 *ap
->a_ncookies
= ncookies
;
761 *ap
->a_cookies
= cookies
;
764 * Fill in the offsets for each entry in the buffer just allocated:
766 for (bufferOffset
= startingOffset
, dp
= dpstart
; bufferOffset
< uio
->uio_offset
; ) {
767 *(cookies
++) = bufferOffset
;
768 bufferOffset
+= dp
->d_reclen
;
769 dp
= (struct dirent
*)((caddr_t
)dp
+ dp
->d_reclen
);
779 uio
->uio_offset
= idp
->uio_off
;
780 *ap
->a_eofflag
= idp
->eofflag
;
788 * Return target name of a symbolic link
789 * Shouldn't we get the parent vnode and read the data from there?
790 * This could eventually result in deadlocks in cd9660_lookup.
791 * But otherwise the block read here is in the block buffer two times.
793 typedef struct iso_directory_record ISODIR
;
794 typedef struct iso_node ISONODE
;
795 typedef struct iso_mnt ISOMNT
;
798 struct vop_readlink_args
/* {
801 struct ucred *a_cred;
817 if (imp
->iso_ftype
!= ISO_FTYPE_RRIP
)
821 * Get parents directory record block that this inode included.
823 error
= bread(imp
->im_devvp
,
824 (ip
->i_number
>> imp
->im_bshift
),
825 imp
->logical_block_size
, NOCRED
, &bp
);
832 * Setup the directory pointer for this inode
834 dirp
= (ISODIR
*)(bp
->b_data
+ (ip
->i_number
& imp
->im_bmask
));
837 * Just make sure, we have a right one....
838 * 1: Check not cross boundary on block
840 if ((ip
->i_number
& imp
->im_bmask
) + isonum_711(dirp
->length
)
841 > imp
->logical_block_size
) {
848 * Abuse a namei buffer for now.
850 if (uio
->uio_segflg
== UIO_SYSSPACE
)
851 symname
= uio
->uio_iov
->iov_base
;
853 MALLOC_ZONE(symname
, char *, MAXPATHLEN
, M_NAMEI
, M_WAITOK
);
856 * Ok, we just gathering a symbolic name in SL record.
858 if (cd9660_rrip_getsymname(dirp
, symname
, &symlen
, imp
) == 0) {
859 if (uio
->uio_segflg
!= UIO_SYSSPACE
)
860 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
865 * Don't forget before you leave from home ;-)
870 * return with the symbolic name to caller's.
872 if (uio
->uio_segflg
!= UIO_SYSSPACE
) {
873 error
= uiomove(symname
, symlen
, uio
);
874 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
877 uio
->uio_resid
-= symlen
;
878 uio
->uio_iov
->iov_base
+= symlen
;
879 uio
->uio_iov
->iov_len
-= symlen
;
889 struct vop_lock_args
/* {
895 struct vnode
*vp
= ap
->a_vp
;
897 if (VTOI(vp
) == (struct iso_node
*) NULL
)
898 panic ("cd9660_lock: null inode");
899 return (lockmgr(&VTOI(vp
)->i_lock
, ap
->a_flags
, &vp
->v_interlock
,ap
->a_p
));
908 struct vop_unlock_args
/* {
914 struct vnode
*vp
= ap
->a_vp
;
916 return (lockmgr(&VTOI(vp
)->i_lock
, ap
->a_flags
| LK_RELEASE
, &vp
->v_interlock
,ap
->a_p
));
921 * Calculate the logical to physical mapping if not done already,
922 * then call the device strategy routine.
926 struct vop_strategy_args
/* {
930 register struct buf
*bp
= ap
->a_bp
;
931 register struct vnode
*vp
= bp
->b_vp
;
932 register struct iso_node
*ip
;
936 if (vp
->v_type
== VBLK
|| vp
->v_type
== VCHR
)
937 panic("cd9660_strategy: spec");
938 if (bp
->b_blkno
== bp
->b_lblkno
) {
939 if ( (error
= VOP_BMAP(vp
, bp
->b_lblkno
, NULL
, &bp
->b_blkno
, NULL
)) ) {
941 bp
->b_flags
|= B_ERROR
;
945 if ((long)bp
->b_blkno
== -1)
948 if ((long)bp
->b_blkno
== -1) {
953 bp
->b_dev
= vp
->v_rdev
;
954 VOCALL (vp
->v_op
, VOFFSET(vop_strategy
), ap
);
959 * Print out the contents of an inode.
963 struct vop_print_args
/* {
968 printf("tag VT_ISOFS, isofs vnode\n");
973 * Check for a locked inode.
977 struct vop_islocked_args
/* {
982 return (lockstatus(&VTOI(ap
->a_vp
)->i_lock
));
986 * Return POSIX pathconf information applicable to cd9660 filesystems.
990 struct vop_pathconf_args
/* {
993 register_t *a_retval;
997 switch (ap
->a_name
) {
1002 switch (VTOI(ap
->a_vp
)->i_mnt
->iso_ftype
) {
1003 case ISO_FTYPE_RRIP
:
1004 *ap
->a_retval
= ISO_RRIP_NAMEMAX
;
1006 case ISO_FTYPE_JOLIET
:
1007 *ap
->a_retval
= ISO_JOLIET_NAMEMAX
;
1010 *ap
->a_retval
= ISO_NAMEMAX
;
1014 *ap
->a_retval
= PATH_MAX
;
1017 *ap
->a_retval
= PIPE_BUF
;
1019 case _PC_CHOWN_RESTRICTED
:
1032 * Unsupported operation
1038 return (EOPNOTSUPP
);
1040 /* Pagein. similar to read */
1043 struct vop_pagein_args
/* {
1046 vm_offset_t a_pl_offset,
1049 struct ucred *a_cred,
1053 struct vnode
*vp
= ap
->a_vp
;
1054 upl_t pl
= ap
->a_pl
;
1055 size_t size
= ap
->a_size
;
1056 off_t f_offset
= ap
->a_f_offset
;
1057 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1058 int flags
= ap
->a_flags
;
1059 register struct iso_node
*ip
= VTOI(vp
);
1063 * Copy the Apple Double header.
1065 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (f_offset
== 0) && (size
== ADH_SIZE
)) {
1066 apple_double_header_t header
;
1070 kret
= ubc_upl_map(pl
, &ioaddr
);
1071 if (kret
!= KERN_SUCCESS
)
1072 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1073 ioaddr
+= pl_offset
;
1074 bzero((caddr_t
)ioaddr
, ADH_SIZE
);
1076 header
.magic
= APPLEDOUBLE_MAGIC
;
1077 header
.version
= APPLEDOUBLE_VERSION
;
1079 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
1080 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
1081 header
.entries
[0].length
= 32;
1082 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
1083 header
.entries
[1].offset
= ADH_SIZE
;
1084 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
1085 header
.finfo
.fdType
= ip
->i_FileType
;
1086 header
.finfo
.fdCreator
= ip
->i_Creator
;
1087 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
1088 header
.finfo
.fdLocation
.v
= -1;
1089 header
.finfo
.fdLocation
.h
= -1;
1090 header
.finfo
.fdReserved
= 0;
1092 bcopy((caddr_t
)&header
, (caddr_t
)ioaddr
, sizeof(apple_double_header_t
));
1094 kret
= ubc_upl_unmap(pl
);
1095 if (kret
!= KERN_SUCCESS
)
1096 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1098 if ((flags
& UPL_NOCOMMIT
) == 0) {
1099 ubc_upl_commit_range(pl
, pl_offset
, size
, UPL_COMMIT_FREE_ON_EMPTY
);
1102 int devBlockSize
= 0;
1104 /* check pageouts are for reg file only and ubc info is present*/
1106 panic("cd9660_pagein: Not a VREG");
1107 UBCINFOCHECK("cd9660_pagein", vp
);
1109 VOP_DEVBLOCKSIZE(ip
->i_devvp
, &devBlockSize
);
1111 error
= cluster_pagein(vp
, pl
, pl_offset
, f_offset
, size
,
1112 (off_t
)ip
->i_size
, devBlockSize
, flags
);
1118 * cd9660_remove - not possible to remove a file from iso cds
1120 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
1124 struct vop_remove_args
/* { struct vnode *a_dvp; struct vnode *a_vp;
1125 struct componentname *a_cnp; } */ *ap
;
1127 if (ap
->a_dvp
== ap
->a_vp
)
1138 * cd9660_rmdir - not possible to remove a directory from iso cds
1140 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
1144 struct vop_rmdir_args
/* { struct vnode *a_dvp; struct vnode *a_vp;
1145 struct componentname *a_cnp; } */ *ap
;
1147 (void) nop_rmdir(ap
);
1154 #% getattrlist vp = = =
1157 IN struct vnode *vp;
1158 IN struct attrlist *alist;
1159 INOUT struct uio *uio;
1160 IN struct ucred *cred;
1166 cd9660_getattrlist(ap
)
1167 struct vop_getattrlist_args
/* {
1169 struct attrlist *a_alist
1171 struct ucred *a_cred;
1175 struct attrlist
*alist
= ap
->a_alist
;
1184 if ((alist
->bitmapcount
!= ATTR_BIT_MAP_COUNT
) ||
1185 ((alist
->commonattr
& ~ATTR_CMN_VALIDMASK
) != 0) ||
1186 ((alist
->volattr
& ~ATTR_VOL_VALIDMASK
) != 0) ||
1187 ((alist
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) ||
1188 ((alist
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) ||
1189 ((alist
->forkattr
& ~ATTR_FORK_VALIDMASK
) != 0)) {
1194 * Requesting volume information requires setting the ATTR_VOL_INFO bit and
1195 * volume info requests are mutually exclusive with all other info requests:
1197 if ((alist
->volattr
!= 0) &&
1198 (((alist
->volattr
& ATTR_VOL_INFO
) == 0) ||
1199 (alist
->dirattr
!= 0) ||
1200 (alist
->fileattr
!= 0) ||
1201 (alist
->forkattr
!= 0) )) {
1206 * Reject requests for unsupported options for now:
1208 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) return EINVAL
;
1209 if (alist
->commonattr
& (ATTR_CMN_NAMEDATTRCOUNT
| ATTR_CMN_NAMEDATTRLIST
)) return EINVAL
;
1210 if (alist
->fileattr
&
1211 (ATTR_FILE_FILETYPE
|
1212 ATTR_FILE_FORKCOUNT
|
1213 ATTR_FILE_FORKLIST
|
1214 ATTR_FILE_DATAEXTENTS
|
1215 ATTR_FILE_RSRCEXTENTS
)) {
1220 fixedblocksize
= attrcalcsize(alist
);
1221 attrblocksize
= fixedblocksize
+ (sizeof(u_long
)); /* u_long for length longword */
1222 if (alist
->commonattr
& ATTR_CMN_NAME
) attrblocksize
+= NAME_MAX
;
1223 if (alist
->commonattr
& ATTR_CMN_NAMEDATTRLIST
) attrblocksize
+= 0; /* XXX PPD */
1224 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) attrblocksize
+= PATH_MAX
;
1225 if (alist
->volattr
& ATTR_VOL_NAME
) attrblocksize
+= NAME_MAX
;
1226 if (alist
->fileattr
& ATTR_FILE_FORKLIST
) attrblocksize
+= 0; /* XXX PPD */
1228 attrbufsize
= MIN(ap
->a_uio
->uio_resid
, attrblocksize
);
1229 MALLOC(attrbufptr
, void *, attrblocksize
, M_TEMP
, M_WAITOK
);
1230 attrptr
= attrbufptr
;
1231 *((u_long
*)attrptr
) = 0; /* Set buffer length in case of errors */
1232 ++((u_long
*)attrptr
); /* Reserve space for length field */
1233 varptr
= ((char *)attrptr
) + fixedblocksize
; /* Point to variable-length storage */
1235 packattrblk(alist
, ap
->a_vp
, &attrptr
, &varptr
);
1237 /* Store length of fixed + var block */
1238 *((u_long
*)attrbufptr
) = ((char*)varptr
- (char*)attrbufptr
);
1239 /* Don't copy out more data than was generated */
1240 attrbufsize
= MIN(attrbufsize
, (char*)varptr
- (char*)attrbufptr
);
1242 error
= uiomove((caddr_t
)attrbufptr
, attrbufsize
, ap
->a_uio
);
1244 FREE(attrbufptr
, M_TEMP
);
1250 * Make a RIFF file header for a CD-ROM XA media file.
1252 __private_extern__
void
1253 cd9660_xa_init(struct vnode
*vp
, struct iso_directory_record
*isodir
)
1256 struct iso_node
*ip
= VTOI(vp
);
1257 struct riff_header
*header
;
1261 MALLOC(header
, struct riff_header
*, sizeof(struct riff_header
), M_TEMP
, M_WAITOK
);
1263 sectors
= ip
->i_size
/ 2048;
1265 strncpy(header
->riff
, "RIFF", 4);
1266 header
->fileSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
) - 8);
1267 strncpy(header
->cdxa
, "CDXA", 4);
1268 strncpy(header
->fmt
, "fmt ", 4);
1269 header
->fmtSize
= NXSwapHostLongToLittle(16);
1270 strncpy(header
->data
, "data", 4);
1271 header
->dataSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
);
1274 * Copy the CD-ROM XA extended directory information into the header. As far as
1275 * I can tell, it's always 14 bytes in the directory record, but allocated 16 bytes
1276 * in the header (the last two being zeroed pad bytes).
1278 name_len
= isonum_711(isodir
->name_len
);
1279 cdxa
= &isodir
->name
[name_len
];
1280 if ((name_len
& 0x01) == 0)
1281 ++cdxa
; /* Skip pad byte */
1282 bcopy(cdxa
, header
->fmtData
, 14);
1283 header
->fmtData
[14] = 0;
1284 header
->fmtData
[15] = 0;
1287 * Point this i-node to the "whole sector" device instead of the normal
1288 * device. This allows cd9660_strategy to be ignorant of the block
1292 ip
->i_devvp
= ip
->i_mnt
->phys_devvp
;
1295 ip
->i_size
= sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
);
1296 ip
->i_riff
= header
;
1297 vp
->v_op
= cd9660_cdxaop_p
;
1301 * Helper routine for VOP_READ and VOP_PAGEIN of CD-ROM XA multimedia files.
1302 * This routine determines the physical location of the file, then reads
1303 * sectors directly from the device into a buffer. It also handles inserting
1304 * the RIFF header at the beginning of the file.
1306 * Exactly one of buffer or uio must be non-zero. It will either bcopy to
1307 * buffer, or uiomove via uio.
1309 * XXX Should this code be using breadn and vp->v_lastr to support single-block
1310 * read-ahead? Should we try more aggressive read-ahead like cluster_io does?
1312 * XXX This could be made to do larger I/O to the device (reading all the
1313 * whole sectors directly into the buffer). That would make the code more
1314 * complex, and the current code only adds 2.5% overhead compared to reading
1315 * from the device directly (at least on my test machine).
1318 cd9660_xa_read_common(
1325 struct iso_node
*ip
= VTOI(vp
);
1327 off_t diff
; /* number of bytes from offset to file's EOF */
1328 daddr_t block
; /* physical disk block containing offset */
1329 off_t sect_off
; /* starting offset into current sector */
1330 u_int count
; /* number of bytes to transfer in current block */
1334 * Copy any part of the RIFF header.
1336 if (offset
< sizeof(struct riff_header
)) {
1339 p
= ((char *) ip
->i_riff
) + offset
;
1340 count
= min(amount
, sizeof(struct riff_header
) - offset
);
1342 bcopy(p
, buffer
, count
);
1345 error
= uiomove(p
, count
, uio
);
1354 * Loop over (possibly partial) blocks to transfer.
1356 while (error
== 0 && amount
> 0) {
1358 * Determine number of bytes until EOF. If we've hit
1361 diff
= ip
->i_size
- offset
;
1365 /* Get a block from the underlying device */
1366 block
= ip
->iso_start
+ (offset
- sizeof(struct riff_header
))/CDXA_SECTOR_SIZE
;
1367 error
= bread(ip
->i_devvp
, block
, CDXA_SECTOR_SIZE
, NOCRED
, &bp
);
1373 printf("isofs: cd9660_xa_read_common: bread didn't read full sector\n");
1377 /* Figure out which part of the block to copy, and copy it */
1378 sect_off
= (offset
- sizeof(struct riff_header
)) % CDXA_SECTOR_SIZE
;
1379 count
= min(CDXA_SECTOR_SIZE
-sect_off
, amount
);
1380 if (diff
< count
) /* Pin transfer amount to EOF */
1384 bcopy(bp
->b_data
+sect_off
, buffer
, count
);
1387 error
= uiomove(bp
->b_data
+sect_off
, count
, uio
);
1393 * If we copied through the end of the block, or the end of file, then
1394 * age the device block. This is optimized for sequential access.
1396 if (sect_off
+count
== CDXA_SECTOR_SIZE
|| offset
== (off_t
)ip
->i_size
)
1397 bp
->b_flags
|= B_AGE
;
1405 * Read from a CD-ROM XA multimedia file.
1407 * This uses the same common routine as pagein for doing the actual read
1410 * This routine doesn't do any caching beyond what the block device does.
1411 * Even then, cd9660_xa_read_common ages the blocks once we read up to
1414 * We don't even take advantage if the file has been memory mapped and has
1415 * valid pages already (in which case we could just uiomove from the page
1416 * to the caller). Since we're a read-only filesystem, there can't be
1417 * any cache coherency problems. Multimedia files are expected to be
1418 * large and streamed anyway, so caching file contents probably isn't
1423 struct vop_read_args
/* {
1427 struct ucred *a_cred;
1430 struct vnode
*vp
= ap
->a_vp
;
1431 register struct uio
*uio
= ap
->a_uio
;
1432 register struct iso_node
*ip
= VTOI(vp
);
1433 off_t offset
= uio
->uio_offset
;
1434 size_t size
= uio
->uio_resid
;
1436 /* Check for some obvious parameter problems */
1441 if (offset
>= ip
->i_size
)
1444 /* Pin the size of the read to the file's EOF */
1445 if (offset
+ size
> ip
->i_size
)
1446 size
= ip
->i_size
- offset
;
1448 return cd9660_xa_read_common(vp
, offset
, size
, NULL
, uio
);
1452 * Page in from a CD-ROM XA media file.
1454 * Since our device block size isn't a power of two, we can't use
1455 * cluster_pagein. Instead, we have to map the page and read into it.
1458 cd9660_xa_pagein(ap
)
1459 struct vop_pagein_args
/* {
1462 vm_offset_t a_pl_offset,
1465 struct ucred *a_cred,
1469 struct vnode
*vp
= ap
->a_vp
;
1470 upl_t pl
= ap
->a_pl
;
1471 size_t size
= ap
->a_size
;
1472 off_t f_offset
= ap
->a_f_offset
;
1473 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1474 int flags
= ap
->a_flags
;
1475 register struct iso_node
*ip
= VTOI(vp
);
1480 /* check pageins are for reg file only and ubc info is present*/
1482 panic("cd9660_xa_pagein: Not a VREG");
1483 UBCINFOCHECK("cd9660_xa_pagein", vp
);
1486 panic("cd9660_xa_pagein: size = %d", size
);
1488 kret
= ubc_upl_map(pl
, &ioaddr
);
1489 if (kret
!= KERN_SUCCESS
)
1490 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1492 ioaddr
+= pl_offset
;
1494 /* Make sure pagein doesn't extend past EOF */
1495 if (f_offset
+ size
> ip
->i_size
)
1496 size
= ip
->i_size
- f_offset
; /* pin size to EOF */
1498 /* Read the data in using the underlying device */
1499 error
= cd9660_xa_read_common(vp
, f_offset
, size
, (caddr_t
)ioaddr
, NULL
);
1501 /* Zero fill part of page past EOF */
1502 if (ap
->a_size
> size
)
1503 bzero((caddr_t
)ioaddr
+size
, ap
->a_size
-size
);
1505 kret
= ubc_upl_unmap(pl
);
1506 if (kret
!= KERN_SUCCESS
)
1507 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1509 if ((flags
& UPL_NOCOMMIT
) == 0)
1512 ubc_upl_abort_range(pl
, pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
);
1514 ubc_upl_commit_range(pl
, pl_offset
, ap
->a_size
, UPL_COMMIT_FREE_ON_EMPTY
);
1521 * Global vfs data structures for isofs
1523 #define cd9660_create \
1524 ((int (*) __P((struct vop_create_args *)))err_create)
1525 #define cd9660_mknod ((int (*) __P((struct vop_mknod_args *)))err_mknod)
1526 #define cd9660_setattr \
1527 ((int (*) __P((struct vop_setattr_args *)))cd9660_enotsupp)
1528 #define cd9660_write ((int (*) __P((struct vop_write_args *)))cd9660_enotsupp)
1530 int lease_check
__P((struct vop_lease_args
*));
1531 #define cd9660_lease_check lease_check
1533 #define cd9660_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
1535 #define cd9660_fsync ((int (*) __P((struct vop_fsync_args *)))nullop)
1536 #define cd9660_rename \
1537 ((int (*) __P((struct vop_rename_args *)))err_rename)
1538 #define cd9660_copyfile \
1539 ((int (*) __P((struct vop_copyfile_args *)))err_copyfile)
1540 #define cd9660_link ((int (*) __P((struct vop_link_args *)))err_link)
1541 #define cd9660_mkdir ((int (*) __P((struct vop_mkdir_args *)))err_mkdir)
1542 #define cd9660_symlink \
1543 ((int (*) __P((struct vop_symlink_args *)))err_symlink)
1544 #define cd9660_advlock \
1545 ((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp)
1546 #define cd9660_valloc ((int(*) __P(( \
1547 struct vnode *pvp, \
1549 struct ucred *cred, \
1550 struct vnode **vpp))) cd9660_enotsupp)
1551 #define cd9660_vfree ((int (*) __P((struct vop_vfree_args *)))cd9660_enotsupp)
1552 #define cd9660_truncate \
1553 ((int (*) __P((struct vop_truncate_args *)))cd9660_enotsupp)
1554 #define cd9660_update \
1555 ((int (*) __P((struct vop_update_args *)))cd9660_enotsupp)
1556 #define cd9660_bwrite \
1557 ((int (*) __P((struct vop_bwrite_args *)))cd9660_enotsupp)
1558 #define cd9660_pageout \
1559 ((int (*) __P((struct vop_pageout_args *)))cd9660_enotsupp)
1560 int cd9660_blktooff(struct vop_blktooff_args
*ap
);
1561 int cd9660_offtoblk(struct vop_offtoblk_args
*ap
);
1562 int cd9660_cmap(struct vop_cmap_args
*ap
);
1564 #define VOPFUNC int (*)(void *)
1566 * Global vfs data structures for cd9660
1568 int (**cd9660_vnodeop_p
)(void *);
1569 struct vnodeopv_entry_desc cd9660_vnodeop_entries
[] = {
1570 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1571 { &vop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1572 { &vop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1573 { &vop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1574 { &vop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1575 { &vop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1576 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1577 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1578 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1579 { &vop_read_desc
, (VOPFUNC
)cd9660_read
}, /* read */
1580 { &vop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1581 { &vop_lease_desc
, (VOPFUNC
)cd9660_lease_check
},/* lease */
1582 { &vop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1583 { &vop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1584 { &vop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1585 { &vop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1586 { &vop_seek_desc
, (VOPFUNC
)cd9660_seek
}, /* seek */
1587 { &vop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1588 { &vop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1589 { &vop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1590 { &vop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1591 { &vop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1592 { &vop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1593 { &vop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1594 { &vop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1595 { &vop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1596 { &vop_abortop_desc
, (VOPFUNC
)nop_abortop
}, /* abortop */
1597 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1598 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1599 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1600 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1601 { &vop_bmap_desc
, (VOPFUNC
)cd9660_bmap
}, /* bmap */
1602 { &vop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1603 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1604 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1605 { &vop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1606 { &vop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1607 { &vop_blkatoff_desc
, (VOPFUNC
)cd9660_blkatoff
},/* blkatoff */
1608 { &vop_valloc_desc
, (VOPFUNC
)cd9660_valloc
}, /* valloc */
1609 { &vop_vfree_desc
, (VOPFUNC
)cd9660_vfree
}, /* vfree */
1610 { &vop_truncate_desc
, (VOPFUNC
)cd9660_truncate
},/* truncate */
1611 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1612 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1613 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1614 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1615 { &vop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1616 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1617 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1618 { &vop_cmap_desc
, (VOPFUNC
)cd9660_cmap
}, /* cmap */
1619 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1621 struct vnodeopv_desc cd9660_vnodeop_opv_desc
=
1622 { &cd9660_vnodeop_p
, cd9660_vnodeop_entries
};
1625 * The VOP table for CD-ROM XA (media) files is almost the same
1626 * as for ordinary files, except for read, and pagein.
1627 * Note that cd9660_xa_read doesn't use cluster I/O, so cmap
1628 * isn't needed, and isn't implemented. Similarly, it doesn't
1629 * do bread() on CD XA vnodes, so bmap, blktooff, offtoblk
1632 int (**cd9660_cdxaop_p
)(void *);
1633 struct vnodeopv_entry_desc cd9660_cdxaop_entries
[] = {
1634 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1635 { &vop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1636 { &vop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1637 { &vop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1638 { &vop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1639 { &vop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1640 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1641 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1642 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1643 { &vop_read_desc
, (VOPFUNC
)cd9660_xa_read
}, /* read */
1644 { &vop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1645 { &vop_lease_desc
, (VOPFUNC
)cd9660_lease_check
},/* lease */
1646 { &vop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1647 { &vop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1648 { &vop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1649 { &vop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1650 { &vop_seek_desc
, (VOPFUNC
)cd9660_seek
}, /* seek */
1651 { &vop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1652 { &vop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1653 { &vop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1654 { &vop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1655 { &vop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1656 { &vop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1657 { &vop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1658 { &vop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1659 { &vop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1660 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1661 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1662 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1663 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1664 { &vop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1665 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1666 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1667 { &vop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1668 { &vop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1669 { &vop_blkatoff_desc
, (VOPFUNC
)cd9660_blkatoff
},/* blkatoff */
1670 { &vop_valloc_desc
, (VOPFUNC
)cd9660_valloc
}, /* valloc */
1671 { &vop_vfree_desc
, (VOPFUNC
)cd9660_vfree
}, /* vfree */
1672 { &vop_truncate_desc
, (VOPFUNC
)cd9660_truncate
},/* truncate */
1673 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1674 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1675 { &vop_pagein_desc
, (VOPFUNC
)cd9660_xa_pagein
}, /* Pagein */
1676 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1677 { &vop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1678 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1680 struct vnodeopv_desc cd9660_cdxaop_opv_desc
=
1681 { &cd9660_cdxaop_p
, cd9660_cdxaop_entries
};
1684 * Special device vnode ops
1686 int (**cd9660_specop_p
)(void *);
1687 struct vnodeopv_entry_desc cd9660_specop_entries
[] = {
1688 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1689 { &vop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
1690 { &vop_create_desc
, (VOPFUNC
)spec_create
}, /* create */
1691 { &vop_mknod_desc
, (VOPFUNC
)spec_mknod
}, /* mknod */
1692 { &vop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
1693 { &vop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
1694 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1695 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1696 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1697 { &vop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
1698 { &vop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
1699 { &vop_lease_desc
, (VOPFUNC
)spec_lease_check
}, /* lease */
1700 { &vop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
1701 { &vop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
1702 { &vop_mmap_desc
, (VOPFUNC
)spec_mmap
}, /* mmap */
1703 { &vop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
1704 { &vop_seek_desc
, (VOPFUNC
)spec_seek
}, /* seek */
1705 { &vop_remove_desc
, (VOPFUNC
)spec_remove
}, /* remove */
1706 { &vop_link_desc
, (VOPFUNC
)spec_link
}, /* link */
1707 { &vop_rename_desc
, (VOPFUNC
)spec_rename
}, /* rename */
1708 { &vop_mkdir_desc
, (VOPFUNC
)spec_mkdir
}, /* mkdir */
1709 { &vop_rmdir_desc
, (VOPFUNC
)spec_rmdir
}, /* rmdir */
1710 { &vop_symlink_desc
, (VOPFUNC
)spec_symlink
}, /* symlink */
1711 { &vop_readdir_desc
, (VOPFUNC
)spec_readdir
}, /* readdir */
1712 { &vop_readlink_desc
, (VOPFUNC
)spec_readlink
}, /* readlink */
1713 { &vop_abortop_desc
, (VOPFUNC
)spec_abortop
}, /* abortop */
1714 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1715 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1716 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1717 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1718 { &vop_bmap_desc
, (VOPFUNC
)spec_bmap
}, /* bmap */
1719 { &vop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
1720 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1721 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1722 { &vop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
1723 { &vop_advlock_desc
, (VOPFUNC
)spec_advlock
}, /* advlock */
1724 { &vop_blkatoff_desc
, (VOPFUNC
)spec_blkatoff
}, /* blkatoff */
1725 { &vop_valloc_desc
, (VOPFUNC
)spec_valloc
}, /* valloc */
1726 { &vop_vfree_desc
, (VOPFUNC
)spec_vfree
}, /* vfree */
1727 { &vop_truncate_desc
, (VOPFUNC
)spec_truncate
}, /* truncate */
1728 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1729 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1730 { &vop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
1731 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1732 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1733 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1734 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1735 { &vop_cmap_desc
, (VOPFUNC
)cd9660_cmap
}, /* cmap */
1736 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1738 struct vnodeopv_desc cd9660_specop_opv_desc
=
1739 { &cd9660_specop_p
, cd9660_specop_entries
};
1742 int (**cd9660_fifoop_p
)(void *);
1743 struct vnodeopv_entry_desc cd9660_fifoop_entries
[] = {
1744 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1745 { &vop_lookup_desc
, (VOPFUNC
)fifo_lookup
}, /* lookup */
1746 { &vop_create_desc
, (VOPFUNC
)fifo_create
}, /* create */
1747 { &vop_mknod_desc
, (VOPFUNC
)fifo_mknod
}, /* mknod */
1748 { &vop_open_desc
, (VOPFUNC
)fifo_open
}, /* open */
1749 { &vop_close_desc
, (VOPFUNC
)fifo_close
}, /* close */
1750 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1751 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1752 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1753 { &vop_read_desc
, (VOPFUNC
)fifo_read
}, /* read */
1754 { &vop_write_desc
, (VOPFUNC
)fifo_write
}, /* write */
1755 { &vop_lease_desc
, (VOPFUNC
)fifo_lease_check
}, /* lease */
1756 { &vop_ioctl_desc
, (VOPFUNC
)fifo_ioctl
}, /* ioctl */
1757 { &vop_select_desc
, (VOPFUNC
)fifo_select
}, /* select */
1758 { &vop_mmap_desc
, (VOPFUNC
)fifo_mmap
}, /* mmap */
1759 { &vop_fsync_desc
, (VOPFUNC
)fifo_fsync
}, /* fsync */
1760 { &vop_seek_desc
, (VOPFUNC
)fifo_seek
}, /* seek */
1761 { &vop_remove_desc
, (VOPFUNC
)fifo_remove
}, /* remove */
1762 { &vop_link_desc
, (VOPFUNC
)fifo_link
} , /* link */
1763 { &vop_rename_desc
, (VOPFUNC
)fifo_rename
}, /* rename */
1764 { &vop_mkdir_desc
, (VOPFUNC
)fifo_mkdir
}, /* mkdir */
1765 { &vop_rmdir_desc
, (VOPFUNC
)fifo_rmdir
}, /* rmdir */
1766 { &vop_symlink_desc
, (VOPFUNC
)fifo_symlink
}, /* symlink */
1767 { &vop_readdir_desc
, (VOPFUNC
)fifo_readdir
}, /* readdir */
1768 { &vop_readlink_desc
, (VOPFUNC
)fifo_readlink
}, /* readlink */
1769 { &vop_abortop_desc
, (VOPFUNC
)fifo_abortop
}, /* abortop */
1770 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1771 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1772 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1773 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1774 { &vop_bmap_desc
, (VOPFUNC
)fifo_bmap
}, /* bmap */
1775 { &vop_strategy_desc
, (VOPFUNC
)fifo_strategy
}, /* strategy */
1776 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1777 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1778 { &vop_pathconf_desc
, (VOPFUNC
)fifo_pathconf
}, /* pathconf */
1779 { &vop_advlock_desc
, (VOPFUNC
)fifo_advlock
}, /* advlock */
1780 { &vop_blkatoff_desc
, (VOPFUNC
)fifo_blkatoff
}, /* blkatoff */
1781 { &vop_valloc_desc
, (VOPFUNC
)fifo_valloc
}, /* valloc */
1782 { &vop_vfree_desc
, (VOPFUNC
)fifo_vfree
}, /* vfree */
1783 { &vop_truncate_desc
, (VOPFUNC
)fifo_truncate
}, /* truncate */
1784 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1785 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1786 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1787 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1788 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1789 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1790 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1792 struct vnodeopv_desc cd9660_fifoop_opv_desc
=
1793 { &cd9660_fifoop_p
, cd9660_fifoop_entries
};