2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 /* $NetBSD: cd9660_vnops.c,v 1.22 1994/12/27 19:05:12 mycroft Exp $ */
26 * The Regents of the University of California. All rights reserved.
28 * This code is derived from software contributed to Berkeley
29 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
30 * Support code is derived from software contributed to Berkeley
31 * by Atsushi Murai (amurai@spec.co.jp).
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
61 * @(#)cd9660_vnops.c 8.15 (Berkeley) 12/5/94
64 * 02-Feb-00 chw Add cd9660_copyfile to return error
65 * 29-Sep-98 djb Add cd9660_getattrlist VOP for VDI support.
66 * 15-sep-98 added cd9660_rmdir to do proper unlocking - chw
67 * 12-aug-98 added cd9660_remove which will do proper unlocking - chw
68 * 17-Feb-98 radar 1669467 - changed lock protocols to use the lock manager - chw
69 * 22-Jan-98 radar 1669467 - ISO 9660 CD support - jwc
72 #include <sys/param.h>
73 #include <sys/systm.h>
74 #include <sys/vnode.h>
75 #include <sys/mount.h>
76 #include <sys/namei.h>
77 #include <sys/resourcevar.h>
78 #include <sys/kernel.h>
84 #include <miscfs/specfs/specdev.h>
85 #include <miscfs/fifofs/fifo.h>
86 #include <sys/malloc.h>
89 #include <vfs/vfs_support.h>
92 #include <architecture/byte_order.h>
94 #include <isofs/cd9660/iso.h>
95 #include <isofs/cd9660/cd9660_node.h>
96 #include <isofs/cd9660/iso_rrip.h>
106 struct vop_open_args
/* {
109 struct ucred *a_cred;
119 * Update the times on the inode on writeable file systems.
124 struct vop_close_args
/* {
127 struct ucred *a_cred;
135 * Check mode permission on inode pointer. Mode is READ, WRITE or EXEC.
136 * The mode is shifted to select the owner/group/other fields. The
137 * super user is granted all permissions.
142 struct vop_access_args
/* {
145 struct ucred *a_cred;
149 struct vnode
*vp
= ap
->a_vp
;
150 struct iso_node
*ip
= VTOI(vp
);
151 struct ucred
*cred
= ap
->a_cred
;
152 mode_t mask
, mode
= ap
->a_mode
;
157 * Disallow write attempts on read-only file systems;
158 * unless the file is a socket, fifo, or a block or
159 * character device resident on the file system.
162 switch (vp
->v_type
) {
173 /* If immutable bit set, nobody gets to write it. */
175 if ((mode
& VWRITE
) && (ip
->i_flag
& IMMUTABLE
))
178 /* Otherwise, user id 0 always gets access. */
179 if (cred
->cr_uid
== 0)
184 /* Otherwise, check the owner. */
185 if (cred
->cr_uid
== ip
->inode
.iso_uid
) {
192 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
195 /* Otherwise, check the groups. */
196 for (i
= 0, gp
= cred
->cr_groups
; i
< cred
->cr_ngroups
; i
++, gp
++)
197 if (ip
->inode
.iso_gid
== *gp
) {
204 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
207 /* Otherwise, check everyone else. */
214 return ((ip
->inode
.iso_mode
& mask
) == mask
? 0 : EACCES
);
219 struct vop_getattr_args
/* {
222 struct ucred *a_cred;
227 struct vnode
*vp
= ap
->a_vp
;
228 register struct vattr
*vap
= ap
->a_vap
;
229 register struct iso_node
*ip
= VTOI(vp
);
231 vap
->va_fsid
= ip
->i_dev
;
232 vap
->va_fileid
= ip
->i_number
;
234 vap
->va_mode
= ip
->inode
.iso_mode
;
235 vap
->va_nlink
= ip
->inode
.iso_links
;
236 vap
->va_uid
= ip
->inode
.iso_uid
;
237 vap
->va_gid
= ip
->inode
.iso_gid
;
238 vap
->va_atime
= ip
->inode
.iso_atime
;
239 vap
->va_mtime
= ip
->inode
.iso_mtime
;
240 vap
->va_ctime
= ip
->inode
.iso_ctime
;
241 vap
->va_rdev
= ip
->inode
.iso_rdev
;
243 vap
->va_size
= (u_quad_t
) ip
->i_size
;
244 if (ip
->i_size
== 0 && (vap
->va_mode
& S_IFMT
) == S_IFLNK
) {
245 struct vop_readlink_args rdlnk
;
250 MALLOC(cp
, char *, MAXPATHLEN
, M_TEMP
, M_WAITOK
);
252 aiov
.iov_len
= MAXPATHLEN
;
253 auio
.uio_iov
= &aiov
;
256 auio
.uio_rw
= UIO_READ
;
257 auio
.uio_segflg
= UIO_SYSSPACE
;
258 auio
.uio_procp
= ap
->a_p
;
259 auio
.uio_resid
= MAXPATHLEN
;
261 rdlnk
.a_vp
= ap
->a_vp
;
262 rdlnk
.a_cred
= ap
->a_cred
;
263 if (cd9660_readlink(&rdlnk
) == 0)
264 vap
->va_size
= MAXPATHLEN
- auio
.uio_resid
;
269 vap
->va_blocksize
= ip
->i_mnt
->logical_block_size
;
270 vap
->va_bytes
= (u_quad_t
) (ip
->i_size
+ ip
->i_rsrcsize
);
271 vap
->va_type
= vp
->v_type
;
278 * Vnode op for reading.
282 struct vop_read_args
/* {
286 struct ucred *a_cred;
289 struct vnode
*vp
= ap
->a_vp
;
290 register struct uio
*uio
= ap
->a_uio
;
291 register struct iso_node
*ip
= VTOI(vp
);
292 register struct iso_mnt
*imp
;
294 daddr_t lbn
, rablock
;
296 int rasize
, error
= 0;
298 int devBlockSize
= 0;
300 if (uio
->uio_resid
== 0)
302 if (uio
->uio_offset
< 0)
306 VOP_DEVBLOCKSIZE(ip
->i_devvp
, &devBlockSize
);
308 if (UBCISVALID(vp
)) {
310 * Copy any part of the Apple Double header.
312 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (uio
->uio_offset
< ADH_SIZE
)) {
313 apple_double_header_t header
;
316 if (uio
->uio_offset
< sizeof(apple_double_header_t
)) {
317 header
.magic
= APPLEDOUBLE_MAGIC
;
318 header
.version
= APPLEDOUBLE_VERSION
;
320 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
321 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
322 header
.entries
[0].length
= 32;
323 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
324 header
.entries
[1].offset
= ADH_SIZE
;
325 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
326 header
.finfo
.fdType
= ip
->i_FileType
;
327 header
.finfo
.fdCreator
= ip
->i_Creator
;
328 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
329 header
.finfo
.fdLocation
.v
= -1;
330 header
.finfo
.fdLocation
.h
= -1;
331 header
.finfo
.fdReserved
= 0;
333 bytes
= min(uio
->uio_resid
, sizeof(apple_double_header_t
) - uio
->uio_offset
);
334 error
= uiomove(((char *) &header
) + uio
->uio_offset
, bytes
, uio
);
338 if (uio
->uio_resid
&& uio
->uio_offset
< ADH_SIZE
) {
341 if (kmem_alloc(kernel_map
, (vm_offset_t
*)&buffer
, ADH_SIZE
)) {
344 bytes
= min(uio
->uio_resid
, ADH_SIZE
- uio
->uio_offset
);
345 error
= uiomove(((char *) buffer
) + uio
->uio_offset
, bytes
, uio
);
346 kmem_free(kernel_map
, (vm_offset_t
)buffer
, ADH_SIZE
);
351 if (uio
->uio_resid
> 0)
352 error
= cluster_read(vp
, uio
, (off_t
)ip
->i_size
, devBlockSize
, 0);
356 lbn
= lblkno(imp
, uio
->uio_offset
);
357 on
= blkoff(imp
, uio
->uio_offset
);
358 n
= min((u_int
)(imp
->logical_block_size
- on
),
360 diff
= (off_t
)ip
->i_size
- uio
->uio_offset
;
365 size
= blksize(imp
, ip
, lbn
);
368 if (vp
->v_lastr
+ 1 == lbn
&&
369 lblktosize(imp
, rablock
) < ip
->i_size
) {
370 rasize
= blksize(imp
, ip
, rablock
);
371 error
= breadn(vp
, lbn
, size
, &rablock
,
372 &rasize
, 1, NOCRED
, &bp
);
374 error
= bread(vp
, lbn
, size
, NOCRED
, &bp
);
377 n
= min(n
, size
- bp
->b_resid
);
383 error
= uiomove(bp
->b_data
+ on
, (int)n
, uio
);
384 if (n
+ on
== imp
->logical_block_size
||
385 uio
->uio_offset
== (off_t
)ip
->i_size
)
386 bp
->b_flags
|= B_AGE
;
388 } while (error
== 0 && uio
->uio_resid
> 0 && n
!= 0);
397 struct vop_ioctl_args
/* {
402 struct ucred *a_cred;
412 struct vop_select_args
/* {
416 struct ucred *a_cred;
422 * We should really check to see if I/O is possible.
430 * NB Currently unsupported.
435 struct vop_mmap_args
/* {
438 struct ucred *a_cred;
449 * Nothing to do, so just return.
454 struct vop_seek_args
/* {
458 struct ucred *a_cred;
466 * Structure for reading directories
469 struct dirent saveent
;
470 struct dirent current
;
481 iso_uiodir(idp
,dp
,off
)
482 struct isoreaddir
*idp
;
488 dp
->d_name
[dp
->d_namlen
] = 0;
489 dp
->d_reclen
= DIRSIZ(dp
);
491 if (idp
->uio
->uio_resid
< dp
->d_reclen
) {
498 if (*idp
->ncookies
<= 0) {
503 **idp
->cookies
++ = off
;
508 if ( (error
= uiomove( (caddr_t
)dp
, dp
->d_reclen
, idp
->uio
)) )
516 struct isoreaddir
*idp
;
523 cl
= idp
->current
.d_namlen
;
524 cname
= idp
->current
.d_name
;
531 || bcmp(sname
,cname
,sl
)) {
532 if (idp
->saveent
.d_namlen
) {
533 if ( (error
= iso_uiodir(idp
,&idp
->saveent
,idp
->saveoff
)) )
535 idp
->saveent
.d_namlen
= 0;
539 idp
->current
.d_reclen
= DIRSIZ(&idp
->current
);
540 idp
->saveoff
= idp
->curroff
;
541 bcopy(&idp
->current
,&idp
->saveent
,idp
->current
.d_reclen
);
546 * Vnode op for readdir
548 * Note that directories are sector aligned (2K) and
549 * that an entry can cross a logical block but not
554 struct vop_readdir_args
/* {
555 struct vnodeop_desc *a_desc;
558 struct ucred *a_cred;
564 register struct uio
*uio
= ap
->a_uio
;
565 off_t startingOffset
= uio
->uio_offset
;
567 struct isoreaddir
*idp
;
568 struct vnode
*vdp
= ap
->a_vp
;
571 struct buf
*bp
= NULL
;
572 struct iso_directory_record
*ep
;
573 int entryoffsetinblock
;
582 bmask
= imp
->im_sector_size
- 1;
584 MALLOC(idp
, struct isoreaddir
*, sizeof(*idp
), M_TEMP
, M_WAITOK
);
585 idp
->saveent
.d_namlen
= 0;
588 * Is it worth trying to figure out the type?
590 idp
->saveent
.d_type
= idp
->current
.d_type
= DT_UNKNOWN
;
593 idp
->curroff
= uio
->uio_offset
;
595 if ((entryoffsetinblock
= idp
->curroff
& bmask
) &&
596 (error
= VOP_BLKATOFF(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
))) {
600 endsearch
= dp
->i_size
;
602 while (idp
->curroff
< endsearch
) {
604 * If offset is on a block boundary,
605 * read the next directory block.
606 * Release previous if it exists.
608 if ((idp
->curroff
& bmask
) == 0) {
611 if ((error
= VOP_BLKATOFF(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
)))
613 entryoffsetinblock
= 0;
616 * Get pointer to next entry.
618 ep
= (struct iso_directory_record
*)
619 ((char *)bp
->b_data
+ entryoffsetinblock
);
621 reclen
= isonum_711(ep
->length
);
623 /* skip to next block, if any */
625 (idp
->curroff
& ~bmask
) + imp
->im_sector_size
;
629 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
) {
631 /* illegal entry, stop */
635 if (entryoffsetinblock
+ reclen
> imp
->im_sector_size
) {
637 /* illegal directory, so stop looking */
641 idp
->current
.d_namlen
= isonum_711(ep
->name_len
);
643 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
+ idp
->current
.d_namlen
) {
645 /* illegal entry, stop */
650 * Some poorly mastered discs have an incorrect directory
651 * file size. If the '.' entry has a better size (bigger)
652 * then use that instead.
654 if ((uio
->uio_offset
== 0) && (isonum_733(ep
->size
) > endsearch
)) {
655 dp
->i_size
= endsearch
= isonum_733(ep
->size
);
658 if ( isonum_711(ep
->flags
) & directoryBit
)
659 idp
->current
.d_fileno
= isodirino(ep
, imp
);
661 idp
->current
.d_fileno
= (bp
->b_blkno
<< imp
->im_bshift
) +
665 idp
->curroff
+= reclen
;
667 switch (imp
->iso_ftype
) {
669 cd9660_rrip_getname(ep
,idp
->current
.d_name
, &namelen
,
670 &idp
->current
.d_fileno
,imp
);
671 idp
->current
.d_namlen
= (u_char
)namelen
;
672 if (idp
->current
.d_namlen
)
673 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
676 case ISO_FTYPE_JOLIET
:
677 ucsfntrans((u_int16_t
*)ep
->name
, idp
->current
.d_namlen
,
678 idp
->current
.d_name
, &namelen
,
679 isonum_711(ep
->flags
) & directoryBit
,
680 isonum_711(ep
->flags
) & associatedBit
);
681 idp
->current
.d_namlen
= (u_char
)namelen
;
682 if (idp
->current
.d_namlen
)
683 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
686 default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
687 strcpy(idp
->current
.d_name
,"..");
688 switch (ep
->name
[0]) {
690 idp
->current
.d_namlen
= 1;
691 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
694 idp
->current
.d_namlen
= 2;
695 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
698 isofntrans(ep
->name
,idp
->current
.d_namlen
,
699 idp
->current
.d_name
, &namelen
,
700 imp
->iso_ftype
== ISO_FTYPE_9660
,
701 isonum_711(ep
->flags
) & associatedBit
);
702 idp
->current
.d_namlen
= (u_char
)namelen
;
703 if (imp
->iso_ftype
== ISO_FTYPE_DEFAULT
)
704 error
= iso_shipdir(idp
);
706 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
713 entryoffsetinblock
+= reclen
;
716 if (!error
&& imp
->iso_ftype
== ISO_FTYPE_DEFAULT
) {
717 idp
->current
.d_namlen
= 0;
718 error
= iso_shipdir(idp
);
721 if (!error
&& ap
->a_ncookies
) {
722 struct dirent
*dp
, *dpstart
;
728 * Only the NFS server uses cookies, and it loads the
729 * directory block into system space, so we can just look at
732 * We assume the entire transfer is done to a single contiguous buffer.
734 if (uio
->uio_segflg
!= UIO_SYSSPACE
|| uio
->uio_iovcnt
!= 1)
735 panic("ufs_readdir: lost in space");
738 * Make a first pass over the buffer just generated,
739 * counting the number of entries:
741 dpstart
= (struct dirent
*) (uio
->uio_iov
->iov_base
- (uio
->uio_offset
- startingOffset
));
742 for (dp
= dpstart
, bufferOffset
= startingOffset
, ncookies
= 0;
743 bufferOffset
< uio
->uio_offset
; ) {
744 if (dp
->d_reclen
== 0)
746 bufferOffset
+= dp
->d_reclen
;
748 dp
= (struct dirent
*)((caddr_t
)dp
+ dp
->d_reclen
);
750 lost
+= uio
->uio_offset
- bufferOffset
;
751 uio
->uio_offset
= bufferOffset
;
754 * Allocate a buffer to hold the cookies requested:
756 MALLOC(cookies
, u_long
*, ncookies
* sizeof(u_long
), M_TEMP
, M_WAITOK
);
757 *ap
->a_ncookies
= ncookies
;
758 *ap
->a_cookies
= cookies
;
761 * Fill in the offsets for each entry in the buffer just allocated:
763 for (bufferOffset
= startingOffset
, dp
= dpstart
; bufferOffset
< uio
->uio_offset
; ) {
764 *(cookies
++) = bufferOffset
;
765 bufferOffset
+= dp
->d_reclen
;
766 dp
= (struct dirent
*)((caddr_t
)dp
+ dp
->d_reclen
);
776 uio
->uio_offset
= idp
->uio_off
;
777 *ap
->a_eofflag
= idp
->eofflag
;
785 * Return target name of a symbolic link
786 * Shouldn't we get the parent vnode and read the data from there?
787 * This could eventually result in deadlocks in cd9660_lookup.
788 * But otherwise the block read here is in the block buffer two times.
790 typedef struct iso_directory_record ISODIR
;
791 typedef struct iso_node ISONODE
;
792 typedef struct iso_mnt ISOMNT
;
795 struct vop_readlink_args
/* {
798 struct ucred *a_cred;
814 if (imp
->iso_ftype
!= ISO_FTYPE_RRIP
)
818 * Get parents directory record block that this inode included.
820 error
= bread(imp
->im_devvp
,
821 (ip
->i_number
>> imp
->im_bshift
),
822 imp
->logical_block_size
, NOCRED
, &bp
);
829 * Setup the directory pointer for this inode
831 dirp
= (ISODIR
*)(bp
->b_data
+ (ip
->i_number
& imp
->im_bmask
));
834 * Just make sure, we have a right one....
835 * 1: Check not cross boundary on block
837 if ((ip
->i_number
& imp
->im_bmask
) + isonum_711(dirp
->length
)
838 > imp
->logical_block_size
) {
845 * Abuse a namei buffer for now.
847 if (uio
->uio_segflg
== UIO_SYSSPACE
)
848 symname
= uio
->uio_iov
->iov_base
;
850 MALLOC_ZONE(symname
, char *, MAXPATHLEN
, M_NAMEI
, M_WAITOK
);
853 * Ok, we just gathering a symbolic name in SL record.
855 if (cd9660_rrip_getsymname(dirp
, symname
, &symlen
, imp
) == 0) {
856 if (uio
->uio_segflg
!= UIO_SYSSPACE
)
857 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
862 * Don't forget before you leave from home ;-)
867 * return with the symbolic name to caller's.
869 if (uio
->uio_segflg
!= UIO_SYSSPACE
) {
870 error
= uiomove(symname
, symlen
, uio
);
871 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
874 uio
->uio_resid
-= symlen
;
875 uio
->uio_iov
->iov_base
+= symlen
;
876 uio
->uio_iov
->iov_len
-= symlen
;
886 struct vop_lock_args
/* {
892 struct vnode
*vp
= ap
->a_vp
;
894 if (VTOI(vp
) == (struct iso_node
*) NULL
)
895 panic ("cd9660_lock: null inode");
896 return (lockmgr(&VTOI(vp
)->i_lock
, ap
->a_flags
, &vp
->v_interlock
,ap
->a_p
));
905 struct vop_unlock_args
/* {
911 struct vnode
*vp
= ap
->a_vp
;
913 return (lockmgr(&VTOI(vp
)->i_lock
, ap
->a_flags
| LK_RELEASE
, &vp
->v_interlock
,ap
->a_p
));
918 * Calculate the logical to physical mapping if not done already,
919 * then call the device strategy routine.
923 struct vop_strategy_args
/* {
927 register struct buf
*bp
= ap
->a_bp
;
928 register struct vnode
*vp
= bp
->b_vp
;
929 register struct iso_node
*ip
;
933 if (vp
->v_type
== VBLK
|| vp
->v_type
== VCHR
)
934 panic("cd9660_strategy: spec");
935 if (bp
->b_blkno
== bp
->b_lblkno
) {
936 if ( (error
= VOP_BMAP(vp
, bp
->b_lblkno
, NULL
, &bp
->b_blkno
, NULL
)) ) {
938 bp
->b_flags
|= B_ERROR
;
942 if ((long)bp
->b_blkno
== -1)
945 if ((long)bp
->b_blkno
== -1) {
950 bp
->b_dev
= vp
->v_rdev
;
951 VOCALL (vp
->v_op
, VOFFSET(vop_strategy
), ap
);
956 * Print out the contents of an inode.
960 struct vop_print_args
/* {
965 printf("tag VT_ISOFS, isofs vnode\n");
970 * Check for a locked inode.
974 struct vop_islocked_args
/* {
979 return (lockstatus(&VTOI(ap
->a_vp
)->i_lock
));
983 * Return POSIX pathconf information applicable to cd9660 filesystems.
987 struct vop_pathconf_args
/* {
990 register_t *a_retval;
994 switch (ap
->a_name
) {
999 switch (VTOI(ap
->a_vp
)->i_mnt
->iso_ftype
) {
1000 case ISO_FTYPE_RRIP
:
1001 *ap
->a_retval
= ISO_RRIP_NAMEMAX
;
1003 case ISO_FTYPE_JOLIET
:
1004 *ap
->a_retval
= ISO_JOLIET_NAMEMAX
;
1007 *ap
->a_retval
= ISO_NAMEMAX
;
1011 *ap
->a_retval
= PATH_MAX
;
1014 *ap
->a_retval
= PIPE_BUF
;
1016 case _PC_CHOWN_RESTRICTED
:
1029 * Unsupported operation
1035 return (EOPNOTSUPP
);
1037 /* Pagein. similar to read */
1040 struct vop_pagein_args
/* {
1043 vm_offset_t a_pl_offset,
1046 struct ucred *a_cred,
1050 struct vnode
*vp
= ap
->a_vp
;
1051 upl_t pl
= ap
->a_pl
;
1052 size_t size
= ap
->a_size
;
1053 off_t f_offset
= ap
->a_f_offset
;
1054 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1055 int flags
= ap
->a_flags
;
1056 register struct iso_node
*ip
= VTOI(vp
);
1060 * Copy the Apple Double header.
1062 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (f_offset
== 0) && (size
== ADH_SIZE
)) {
1063 apple_double_header_t header
;
1067 kret
= ubc_upl_map(pl
, &ioaddr
);
1068 if (kret
!= KERN_SUCCESS
)
1069 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1070 ioaddr
+= pl_offset
;
1071 bzero((caddr_t
)ioaddr
, ADH_SIZE
);
1073 header
.magic
= APPLEDOUBLE_MAGIC
;
1074 header
.version
= APPLEDOUBLE_VERSION
;
1076 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
1077 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
1078 header
.entries
[0].length
= 32;
1079 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
1080 header
.entries
[1].offset
= ADH_SIZE
;
1081 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
1082 header
.finfo
.fdType
= ip
->i_FileType
;
1083 header
.finfo
.fdCreator
= ip
->i_Creator
;
1084 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
1085 header
.finfo
.fdLocation
.v
= -1;
1086 header
.finfo
.fdLocation
.h
= -1;
1087 header
.finfo
.fdReserved
= 0;
1089 bcopy((caddr_t
)&header
, (caddr_t
)ioaddr
, sizeof(apple_double_header_t
));
1091 kret
= ubc_upl_unmap(pl
);
1092 if (kret
!= KERN_SUCCESS
)
1093 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1095 if ((flags
& UPL_NOCOMMIT
) == 0) {
1096 ubc_upl_commit_range(pl
, pl_offset
, size
, UPL_COMMIT_FREE_ON_EMPTY
);
1099 int devBlockSize
= 0;
1101 /* check pageouts are for reg file only and ubc info is present*/
1103 panic("cd9660_pagein: Not a VREG");
1104 UBCINFOCHECK("cd9660_pagein", vp
);
1106 VOP_DEVBLOCKSIZE(ip
->i_devvp
, &devBlockSize
);
1108 error
= cluster_pagein(vp
, pl
, pl_offset
, f_offset
, size
,
1109 (off_t
)ip
->i_size
, devBlockSize
, flags
);
1115 * cd9660_remove - not possible to remove a file from iso cds
1117 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
1121 struct vop_remove_args
/* { struct vnode *a_dvp; struct vnode *a_vp;
1122 struct componentname *a_cnp; } */ *ap
;
1124 if (ap
->a_dvp
== ap
->a_vp
)
1135 * cd9660_rmdir - not possible to remove a directory from iso cds
1137 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
1141 struct vop_rmdir_args
/* { struct vnode *a_dvp; struct vnode *a_vp;
1142 struct componentname *a_cnp; } */ *ap
;
1144 (void) nop_rmdir(ap
);
1151 #% getattrlist vp = = =
1154 IN struct vnode *vp;
1155 IN struct attrlist *alist;
1156 INOUT struct uio *uio;
1157 IN struct ucred *cred;
1163 cd9660_getattrlist(ap
)
1164 struct vop_getattrlist_args
/* {
1166 struct attrlist *a_alist
1168 struct ucred *a_cred;
1172 struct attrlist
*alist
= ap
->a_alist
;
1181 if ((alist
->bitmapcount
!= ATTR_BIT_MAP_COUNT
) ||
1182 ((alist
->commonattr
& ~ATTR_CMN_VALIDMASK
) != 0) ||
1183 ((alist
->volattr
& ~ATTR_VOL_VALIDMASK
) != 0) ||
1184 ((alist
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) ||
1185 ((alist
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) ||
1186 ((alist
->forkattr
& ~ATTR_FORK_VALIDMASK
) != 0)) {
1191 * Requesting volume information requires setting the ATTR_VOL_INFO bit and
1192 * volume info requests are mutually exclusive with all other info requests:
1194 if ((alist
->volattr
!= 0) &&
1195 (((alist
->volattr
& ATTR_VOL_INFO
) == 0) ||
1196 (alist
->dirattr
!= 0) ||
1197 (alist
->fileattr
!= 0) ||
1198 (alist
->forkattr
!= 0) )) {
1203 * Reject requests for unsupported options for now:
1205 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) return EINVAL
;
1206 if (alist
->commonattr
& (ATTR_CMN_NAMEDATTRCOUNT
| ATTR_CMN_NAMEDATTRLIST
)) return EINVAL
;
1207 if (alist
->fileattr
&
1208 (ATTR_FILE_FILETYPE
|
1209 ATTR_FILE_FORKCOUNT
|
1210 ATTR_FILE_FORKLIST
|
1211 ATTR_FILE_DATAEXTENTS
|
1212 ATTR_FILE_RSRCEXTENTS
)) {
1217 fixedblocksize
= attrcalcsize(alist
);
1218 attrblocksize
= fixedblocksize
+ (sizeof(u_long
)); /* u_long for length longword */
1219 if (alist
->commonattr
& ATTR_CMN_NAME
) attrblocksize
+= NAME_MAX
;
1220 if (alist
->commonattr
& ATTR_CMN_NAMEDATTRLIST
) attrblocksize
+= 0; /* XXX PPD */
1221 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) attrblocksize
+= PATH_MAX
;
1222 if (alist
->volattr
& ATTR_VOL_NAME
) attrblocksize
+= NAME_MAX
;
1223 if (alist
->fileattr
& ATTR_FILE_FORKLIST
) attrblocksize
+= 0; /* XXX PPD */
1225 attrbufsize
= MIN(ap
->a_uio
->uio_resid
, attrblocksize
);
1226 MALLOC(attrbufptr
, void *, attrblocksize
, M_TEMP
, M_WAITOK
);
1227 attrptr
= attrbufptr
;
1228 *((u_long
*)attrptr
) = 0; /* Set buffer length in case of errors */
1229 ++((u_long
*)attrptr
); /* Reserve space for length field */
1230 varptr
= ((char *)attrptr
) + fixedblocksize
; /* Point to variable-length storage */
1232 packattrblk(alist
, ap
->a_vp
, &attrptr
, &varptr
);
1234 /* Store length of fixed + var block */
1235 *((u_long
*)attrbufptr
) = ((char*)varptr
- (char*)attrbufptr
);
1236 /* Don't copy out more data than was generated */
1237 attrbufsize
= MIN(attrbufsize
, (char*)varptr
- (char*)attrbufptr
);
1239 error
= uiomove((caddr_t
)attrbufptr
, attrbufsize
, ap
->a_uio
);
1241 FREE(attrbufptr
, M_TEMP
);
1247 * Make a RIFF file header for a CD-ROM XA media file.
1249 __private_extern__
void
1250 cd9660_xa_init(struct vnode
*vp
, struct iso_directory_record
*isodir
)
1253 struct iso_node
*ip
= VTOI(vp
);
1254 struct riff_header
*header
;
1258 MALLOC(header
, struct riff_header
*, sizeof(struct riff_header
), M_TEMP
, M_WAITOK
);
1260 sectors
= ip
->i_size
/ 2048;
1262 strncpy(header
->riff
, "RIFF", 4);
1263 header
->fileSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
) - 8);
1264 strncpy(header
->cdxa
, "CDXA", 4);
1265 strncpy(header
->fmt
, "fmt ", 4);
1266 header
->fmtSize
= NXSwapHostLongToLittle(16);
1267 strncpy(header
->data
, "data", 4);
1268 header
->dataSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
);
1271 * Copy the CD-ROM XA extended directory information into the header. As far as
1272 * I can tell, it's always 14 bytes in the directory record, but allocated 16 bytes
1273 * in the header (the last two being zeroed pad bytes).
1275 name_len
= isonum_711(isodir
->name_len
);
1276 cdxa
= &isodir
->name
[name_len
];
1277 if ((name_len
& 0x01) == 0)
1278 ++cdxa
; /* Skip pad byte */
1279 bcopy(cdxa
, header
->fmtData
, 14);
1280 header
->fmtData
[14] = 0;
1281 header
->fmtData
[15] = 0;
1284 * Point this i-node to the "whole sector" device instead of the normal
1285 * device. This allows cd9660_strategy to be ignorant of the block
1289 ip
->i_devvp
= ip
->i_mnt
->phys_devvp
;
1292 ip
->i_size
= sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
);
1293 ip
->i_riff
= header
;
1294 vp
->v_op
= cd9660_cdxaop_p
;
1298 * Helper routine for VOP_READ and VOP_PAGEIN of CD-ROM XA multimedia files.
1299 * This routine determines the physical location of the file, then reads
1300 * sectors directly from the device into a buffer. It also handles inserting
1301 * the RIFF header at the beginning of the file.
1303 * Exactly one of buffer or uio must be non-zero. It will either bcopy to
1304 * buffer, or uiomove via uio.
1306 * XXX Should this code be using breadn and vp->v_lastr to support single-block
1307 * read-ahead? Should we try more aggressive read-ahead like cluster_io does?
1309 * XXX This could be made to do larger I/O to the device (reading all the
1310 * whole sectors directly into the buffer). That would make the code more
1311 * complex, and the current code only adds 2.5% overhead compared to reading
1312 * from the device directly (at least on my test machine).
1315 cd9660_xa_read_common(
1322 struct iso_node
*ip
= VTOI(vp
);
1324 off_t diff
; /* number of bytes from offset to file's EOF */
1325 daddr_t block
; /* physical disk block containing offset */
1326 off_t sect_off
; /* starting offset into current sector */
1327 u_int count
; /* number of bytes to transfer in current block */
1331 * Copy any part of the RIFF header.
1333 if (offset
< sizeof(struct riff_header
)) {
1336 p
= ((char *) ip
->i_riff
) + offset
;
1337 count
= min(amount
, sizeof(struct riff_header
) - offset
);
1339 bcopy(p
, buffer
, count
);
1342 error
= uiomove(p
, count
, uio
);
1351 * Loop over (possibly partial) blocks to transfer.
1353 while (error
== 0 && amount
> 0) {
1355 * Determine number of bytes until EOF. If we've hit
1358 diff
= ip
->i_size
- offset
;
1362 /* Get a block from the underlying device */
1363 block
= ip
->iso_start
+ (offset
- sizeof(struct riff_header
))/CDXA_SECTOR_SIZE
;
1364 error
= bread(ip
->i_devvp
, block
, CDXA_SECTOR_SIZE
, NOCRED
, &bp
);
1370 printf("isofs: cd9660_xa_read_common: bread didn't read full sector\n");
1374 /* Figure out which part of the block to copy, and copy it */
1375 sect_off
= (offset
- sizeof(struct riff_header
)) % CDXA_SECTOR_SIZE
;
1376 count
= min(CDXA_SECTOR_SIZE
-sect_off
, amount
);
1377 if (diff
< count
) /* Pin transfer amount to EOF */
1381 bcopy(bp
->b_data
+sect_off
, buffer
, count
);
1384 error
= uiomove(bp
->b_data
+sect_off
, count
, uio
);
1390 * If we copied through the end of the block, or the end of file, then
1391 * age the device block. This is optimized for sequential access.
1393 if (sect_off
+count
== CDXA_SECTOR_SIZE
|| offset
== (off_t
)ip
->i_size
)
1394 bp
->b_flags
|= B_AGE
;
1402 * Read from a CD-ROM XA multimedia file.
1404 * This uses the same common routine as pagein for doing the actual read
1407 * This routine doesn't do any caching beyond what the block device does.
1408 * Even then, cd9660_xa_read_common ages the blocks once we read up to
1411 * We don't even take advantage if the file has been memory mapped and has
1412 * valid pages already (in which case we could just uiomove from the page
1413 * to the caller). Since we're a read-only filesystem, there can't be
1414 * any cache coherency problems. Multimedia files are expected to be
1415 * large and streamed anyway, so caching file contents probably isn't
1420 struct vop_read_args
/* {
1424 struct ucred *a_cred;
1427 struct vnode
*vp
= ap
->a_vp
;
1428 register struct uio
*uio
= ap
->a_uio
;
1429 register struct iso_node
*ip
= VTOI(vp
);
1430 off_t offset
= uio
->uio_offset
;
1431 size_t size
= uio
->uio_resid
;
1433 /* Check for some obvious parameter problems */
1438 if (offset
>= ip
->i_size
)
1441 /* Pin the size of the read to the file's EOF */
1442 if (offset
+ size
> ip
->i_size
)
1443 size
= ip
->i_size
- offset
;
1445 return cd9660_xa_read_common(vp
, offset
, size
, NULL
, uio
);
1449 * Page in from a CD-ROM XA media file.
1451 * Since our device block size isn't a power of two, we can't use
1452 * cluster_pagein. Instead, we have to map the page and read into it.
1455 cd9660_xa_pagein(ap
)
1456 struct vop_pagein_args
/* {
1459 vm_offset_t a_pl_offset,
1462 struct ucred *a_cred,
1466 struct vnode
*vp
= ap
->a_vp
;
1467 upl_t pl
= ap
->a_pl
;
1468 size_t size
= ap
->a_size
;
1469 off_t f_offset
= ap
->a_f_offset
;
1470 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1471 int flags
= ap
->a_flags
;
1472 register struct iso_node
*ip
= VTOI(vp
);
1477 /* check pageins are for reg file only and ubc info is present*/
1479 panic("cd9660_xa_pagein: Not a VREG");
1480 UBCINFOCHECK("cd9660_xa_pagein", vp
);
1483 panic("cd9660_xa_pagein: size = %d", size
);
1485 kret
= ubc_upl_map(pl
, &ioaddr
);
1486 if (kret
!= KERN_SUCCESS
)
1487 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1489 ioaddr
+= pl_offset
;
1491 /* Make sure pagein doesn't extend past EOF */
1492 if (f_offset
+ size
> ip
->i_size
)
1493 size
= ip
->i_size
- f_offset
; /* pin size to EOF */
1495 /* Read the data in using the underlying device */
1496 error
= cd9660_xa_read_common(vp
, f_offset
, size
, (caddr_t
)ioaddr
, NULL
);
1498 /* Zero fill part of page past EOF */
1499 if (ap
->a_size
> size
)
1500 bzero((caddr_t
)ioaddr
+size
, ap
->a_size
-size
);
1502 kret
= ubc_upl_unmap(pl
);
1503 if (kret
!= KERN_SUCCESS
)
1504 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1506 if ((flags
& UPL_NOCOMMIT
) == 0)
1509 ubc_upl_abort_range(pl
, pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
);
1511 ubc_upl_commit_range(pl
, pl_offset
, ap
->a_size
, UPL_COMMIT_FREE_ON_EMPTY
);
1518 * Global vfs data structures for isofs
1520 #define cd9660_create \
1521 ((int (*) __P((struct vop_create_args *)))err_create)
1522 #define cd9660_mknod ((int (*) __P((struct vop_mknod_args *)))err_mknod)
1523 #define cd9660_setattr \
1524 ((int (*) __P((struct vop_setattr_args *)))cd9660_enotsupp)
1525 #define cd9660_write ((int (*) __P((struct vop_write_args *)))cd9660_enotsupp)
1527 int lease_check
__P((struct vop_lease_args
*));
1528 #define cd9660_lease_check lease_check
1530 #define cd9660_lease_check ((int (*) __P((struct vop_lease_args *)))nullop)
1532 #define cd9660_fsync ((int (*) __P((struct vop_fsync_args *)))nullop)
1533 #define cd9660_rename \
1534 ((int (*) __P((struct vop_rename_args *)))err_rename)
1535 #define cd9660_copyfile \
1536 ((int (*) __P((struct vop_copyfile_args *)))err_copyfile)
1537 #define cd9660_link ((int (*) __P((struct vop_link_args *)))err_link)
1538 #define cd9660_mkdir ((int (*) __P((struct vop_mkdir_args *)))err_mkdir)
1539 #define cd9660_symlink \
1540 ((int (*) __P((struct vop_symlink_args *)))err_symlink)
1541 #define cd9660_advlock \
1542 ((int (*) __P((struct vop_advlock_args *)))cd9660_enotsupp)
1543 #define cd9660_valloc ((int(*) __P(( \
1544 struct vnode *pvp, \
1546 struct ucred *cred, \
1547 struct vnode **vpp))) cd9660_enotsupp)
1548 #define cd9660_vfree ((int (*) __P((struct vop_vfree_args *)))cd9660_enotsupp)
1549 #define cd9660_truncate \
1550 ((int (*) __P((struct vop_truncate_args *)))cd9660_enotsupp)
1551 #define cd9660_update \
1552 ((int (*) __P((struct vop_update_args *)))cd9660_enotsupp)
1553 #define cd9660_bwrite \
1554 ((int (*) __P((struct vop_bwrite_args *)))cd9660_enotsupp)
1555 #define cd9660_pageout \
1556 ((int (*) __P((struct vop_pageout_args *)))cd9660_enotsupp)
1557 int cd9660_blktooff(struct vop_blktooff_args
*ap
);
1558 int cd9660_offtoblk(struct vop_offtoblk_args
*ap
);
1559 int cd9660_cmap(struct vop_cmap_args
*ap
);
1561 #define VOPFUNC int (*)(void *)
1563 * Global vfs data structures for cd9660
1565 int (**cd9660_vnodeop_p
)(void *);
1566 struct vnodeopv_entry_desc cd9660_vnodeop_entries
[] = {
1567 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1568 { &vop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1569 { &vop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1570 { &vop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1571 { &vop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1572 { &vop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1573 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1574 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1575 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1576 { &vop_read_desc
, (VOPFUNC
)cd9660_read
}, /* read */
1577 { &vop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1578 { &vop_lease_desc
, (VOPFUNC
)cd9660_lease_check
},/* lease */
1579 { &vop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1580 { &vop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1581 { &vop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1582 { &vop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1583 { &vop_seek_desc
, (VOPFUNC
)cd9660_seek
}, /* seek */
1584 { &vop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1585 { &vop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1586 { &vop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1587 { &vop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1588 { &vop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1589 { &vop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1590 { &vop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1591 { &vop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1592 { &vop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1593 { &vop_abortop_desc
, (VOPFUNC
)nop_abortop
}, /* abortop */
1594 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1595 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1596 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1597 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1598 { &vop_bmap_desc
, (VOPFUNC
)cd9660_bmap
}, /* bmap */
1599 { &vop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1600 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1601 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1602 { &vop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1603 { &vop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1604 { &vop_blkatoff_desc
, (VOPFUNC
)cd9660_blkatoff
},/* blkatoff */
1605 { &vop_valloc_desc
, (VOPFUNC
)cd9660_valloc
}, /* valloc */
1606 { &vop_vfree_desc
, (VOPFUNC
)cd9660_vfree
}, /* vfree */
1607 { &vop_truncate_desc
, (VOPFUNC
)cd9660_truncate
},/* truncate */
1608 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1609 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1610 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1611 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1612 { &vop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1613 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1614 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1615 { &vop_cmap_desc
, (VOPFUNC
)cd9660_cmap
}, /* cmap */
1616 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1618 struct vnodeopv_desc cd9660_vnodeop_opv_desc
=
1619 { &cd9660_vnodeop_p
, cd9660_vnodeop_entries
};
1622 * The VOP table for CD-ROM XA (media) files is almost the same
1623 * as for ordinary files, except for read, and pagein.
1624 * Note that cd9660_xa_read doesn't use cluster I/O, so cmap
1625 * isn't needed, and isn't implemented. Similarly, it doesn't
1626 * do bread() on CD XA vnodes, so bmap, blktooff, offtoblk
1629 int (**cd9660_cdxaop_p
)(void *);
1630 struct vnodeopv_entry_desc cd9660_cdxaop_entries
[] = {
1631 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1632 { &vop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1633 { &vop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1634 { &vop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1635 { &vop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1636 { &vop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1637 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1638 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1639 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1640 { &vop_read_desc
, (VOPFUNC
)cd9660_xa_read
}, /* read */
1641 { &vop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1642 { &vop_lease_desc
, (VOPFUNC
)cd9660_lease_check
},/* lease */
1643 { &vop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1644 { &vop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1645 { &vop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1646 { &vop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1647 { &vop_seek_desc
, (VOPFUNC
)cd9660_seek
}, /* seek */
1648 { &vop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1649 { &vop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1650 { &vop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1651 { &vop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1652 { &vop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1653 { &vop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1654 { &vop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1655 { &vop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1656 { &vop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1657 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1658 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1659 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1660 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1661 { &vop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1662 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1663 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1664 { &vop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1665 { &vop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1666 { &vop_blkatoff_desc
, (VOPFUNC
)cd9660_blkatoff
},/* blkatoff */
1667 { &vop_valloc_desc
, (VOPFUNC
)cd9660_valloc
}, /* valloc */
1668 { &vop_vfree_desc
, (VOPFUNC
)cd9660_vfree
}, /* vfree */
1669 { &vop_truncate_desc
, (VOPFUNC
)cd9660_truncate
},/* truncate */
1670 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1671 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1672 { &vop_pagein_desc
, (VOPFUNC
)cd9660_xa_pagein
}, /* Pagein */
1673 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1674 { &vop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1675 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1677 struct vnodeopv_desc cd9660_cdxaop_opv_desc
=
1678 { &cd9660_cdxaop_p
, cd9660_cdxaop_entries
};
1681 * Special device vnode ops
1683 int (**cd9660_specop_p
)(void *);
1684 struct vnodeopv_entry_desc cd9660_specop_entries
[] = {
1685 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1686 { &vop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
1687 { &vop_create_desc
, (VOPFUNC
)spec_create
}, /* create */
1688 { &vop_mknod_desc
, (VOPFUNC
)spec_mknod
}, /* mknod */
1689 { &vop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
1690 { &vop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
1691 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1692 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1693 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1694 { &vop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
1695 { &vop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
1696 { &vop_lease_desc
, (VOPFUNC
)spec_lease_check
}, /* lease */
1697 { &vop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
1698 { &vop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
1699 { &vop_mmap_desc
, (VOPFUNC
)spec_mmap
}, /* mmap */
1700 { &vop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
1701 { &vop_seek_desc
, (VOPFUNC
)spec_seek
}, /* seek */
1702 { &vop_remove_desc
, (VOPFUNC
)spec_remove
}, /* remove */
1703 { &vop_link_desc
, (VOPFUNC
)spec_link
}, /* link */
1704 { &vop_rename_desc
, (VOPFUNC
)spec_rename
}, /* rename */
1705 { &vop_mkdir_desc
, (VOPFUNC
)spec_mkdir
}, /* mkdir */
1706 { &vop_rmdir_desc
, (VOPFUNC
)spec_rmdir
}, /* rmdir */
1707 { &vop_symlink_desc
, (VOPFUNC
)spec_symlink
}, /* symlink */
1708 { &vop_readdir_desc
, (VOPFUNC
)spec_readdir
}, /* readdir */
1709 { &vop_readlink_desc
, (VOPFUNC
)spec_readlink
}, /* readlink */
1710 { &vop_abortop_desc
, (VOPFUNC
)spec_abortop
}, /* abortop */
1711 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1712 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1713 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1714 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1715 { &vop_bmap_desc
, (VOPFUNC
)spec_bmap
}, /* bmap */
1716 { &vop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
1717 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1718 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1719 { &vop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
1720 { &vop_advlock_desc
, (VOPFUNC
)spec_advlock
}, /* advlock */
1721 { &vop_blkatoff_desc
, (VOPFUNC
)spec_blkatoff
}, /* blkatoff */
1722 { &vop_valloc_desc
, (VOPFUNC
)spec_valloc
}, /* valloc */
1723 { &vop_vfree_desc
, (VOPFUNC
)spec_vfree
}, /* vfree */
1724 { &vop_truncate_desc
, (VOPFUNC
)spec_truncate
}, /* truncate */
1725 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1726 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1727 { &vop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
1728 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1729 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1730 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1731 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1732 { &vop_cmap_desc
, (VOPFUNC
)cd9660_cmap
}, /* cmap */
1733 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1735 struct vnodeopv_desc cd9660_specop_opv_desc
=
1736 { &cd9660_specop_p
, cd9660_specop_entries
};
1739 int (**cd9660_fifoop_p
)(void *);
1740 struct vnodeopv_entry_desc cd9660_fifoop_entries
[] = {
1741 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
1742 { &vop_lookup_desc
, (VOPFUNC
)fifo_lookup
}, /* lookup */
1743 { &vop_create_desc
, (VOPFUNC
)fifo_create
}, /* create */
1744 { &vop_mknod_desc
, (VOPFUNC
)fifo_mknod
}, /* mknod */
1745 { &vop_open_desc
, (VOPFUNC
)fifo_open
}, /* open */
1746 { &vop_close_desc
, (VOPFUNC
)fifo_close
}, /* close */
1747 { &vop_access_desc
, (VOPFUNC
)cd9660_access
}, /* access */
1748 { &vop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1749 { &vop_setattr_desc
, (VOPFUNC
)cd9660_setattr
}, /* setattr */
1750 { &vop_read_desc
, (VOPFUNC
)fifo_read
}, /* read */
1751 { &vop_write_desc
, (VOPFUNC
)fifo_write
}, /* write */
1752 { &vop_lease_desc
, (VOPFUNC
)fifo_lease_check
}, /* lease */
1753 { &vop_ioctl_desc
, (VOPFUNC
)fifo_ioctl
}, /* ioctl */
1754 { &vop_select_desc
, (VOPFUNC
)fifo_select
}, /* select */
1755 { &vop_mmap_desc
, (VOPFUNC
)fifo_mmap
}, /* mmap */
1756 { &vop_fsync_desc
, (VOPFUNC
)fifo_fsync
}, /* fsync */
1757 { &vop_seek_desc
, (VOPFUNC
)fifo_seek
}, /* seek */
1758 { &vop_remove_desc
, (VOPFUNC
)fifo_remove
}, /* remove */
1759 { &vop_link_desc
, (VOPFUNC
)fifo_link
} , /* link */
1760 { &vop_rename_desc
, (VOPFUNC
)fifo_rename
}, /* rename */
1761 { &vop_mkdir_desc
, (VOPFUNC
)fifo_mkdir
}, /* mkdir */
1762 { &vop_rmdir_desc
, (VOPFUNC
)fifo_rmdir
}, /* rmdir */
1763 { &vop_symlink_desc
, (VOPFUNC
)fifo_symlink
}, /* symlink */
1764 { &vop_readdir_desc
, (VOPFUNC
)fifo_readdir
}, /* readdir */
1765 { &vop_readlink_desc
, (VOPFUNC
)fifo_readlink
}, /* readlink */
1766 { &vop_abortop_desc
, (VOPFUNC
)fifo_abortop
}, /* abortop */
1767 { &vop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1768 { &vop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1769 { &vop_lock_desc
, (VOPFUNC
)cd9660_lock
}, /* lock */
1770 { &vop_unlock_desc
, (VOPFUNC
)cd9660_unlock
}, /* unlock */
1771 { &vop_bmap_desc
, (VOPFUNC
)fifo_bmap
}, /* bmap */
1772 { &vop_strategy_desc
, (VOPFUNC
)fifo_strategy
}, /* strategy */
1773 { &vop_print_desc
, (VOPFUNC
)cd9660_print
}, /* print */
1774 { &vop_islocked_desc
, (VOPFUNC
)cd9660_islocked
},/* islocked */
1775 { &vop_pathconf_desc
, (VOPFUNC
)fifo_pathconf
}, /* pathconf */
1776 { &vop_advlock_desc
, (VOPFUNC
)fifo_advlock
}, /* advlock */
1777 { &vop_blkatoff_desc
, (VOPFUNC
)fifo_blkatoff
}, /* blkatoff */
1778 { &vop_valloc_desc
, (VOPFUNC
)fifo_valloc
}, /* valloc */
1779 { &vop_vfree_desc
, (VOPFUNC
)fifo_vfree
}, /* vfree */
1780 { &vop_truncate_desc
, (VOPFUNC
)fifo_truncate
}, /* truncate */
1781 { &vop_update_desc
, (VOPFUNC
)cd9660_update
}, /* update */
1782 { &vop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1783 { &vop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1784 { &vop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1785 { &vop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1786 { &vop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1787 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1789 struct vnodeopv_desc cd9660_fifoop_opv_desc
=
1790 { &cd9660_fifoop_p
, cd9660_fifoop_entries
};