2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
23 /* $NetBSD: cd9660_vnops.c,v 1.22 1994/12/27 19:05:12 mycroft Exp $ */
27 * The Regents of the University of California. All rights reserved.
29 * This code is derived from software contributed to Berkeley
30 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
31 * Support code is derived from software contributed to Berkeley
32 * by Atsushi Murai (amurai@spec.co.jp).
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
37 * 1. Redistributions of source code must retain the above copyright
38 * notice, this list of conditions and the following disclaimer.
39 * 2. Redistributions in binary form must reproduce the above copyright
40 * notice, this list of conditions and the following disclaimer in the
41 * documentation and/or other materials provided with the distribution.
42 * 3. All advertising materials mentioning features or use of this software
43 * must display the following acknowledgement:
44 * This product includes software developed by the University of
45 * California, Berkeley and its contributors.
46 * 4. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission.
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * @(#)cd9660_vnops.c 8.15 (Berkeley) 12/5/94
65 * 02-Feb-00 chw Add cd9660_copyfile to return error
66 * 29-Sep-98 djb Add cd9660_getattrlist VOP for VDI support.
67 * 15-sep-98 added cd9660_rmdir to do proper unlocking - chw
68 * 12-aug-98 added cd9660_remove which will do proper unlocking - chw
69 * 17-Feb-98 radar 1669467 - changed lock protocols to use the lock manager - chw
70 * 22-Jan-98 radar 1669467 - ISO 9660 CD support - jwc
73 #include <sys/param.h>
74 #include <sys/systm.h>
75 #include <sys/vnode.h>
76 #include <sys/mount.h>
77 #include <sys/namei.h>
78 #include <sys/resourcevar.h>
79 #include <sys/kernel.h>
84 #include <sys/kauth.h>
86 #include <miscfs/specfs/specdev.h>
87 #include <miscfs/fifofs/fifo.h>
88 #include <sys/malloc.h>
91 #include <vfs/vfs_support.h>
92 #include <vm/vm_kern.h>
95 #include <sys/ubc_internal.h>
96 #include <sys/uio_internal.h>
97 #include <architecture/byte_order.h>
99 #include <vm/vm_map.h>
100 #include <vm/vm_kern.h> /* kmem_alloc, kmem_free */
102 #include <isofs/cd9660/iso.h>
103 #include <isofs/cd9660/cd9660_node.h>
104 #include <isofs/cd9660/iso_rrip.h>
112 cd9660_open(__unused
struct vnop_open_args
*ap
)
120 * Update the times on the inode on writeable file systems.
123 cd9660_close(__unused
struct vnop_close_args
*ap
)
129 cd9660_getattr(struct vnop_getattr_args
*ap
)
131 struct vnode
*vp
= ap
->a_vp
;
132 register struct vnode_attr
*vap
= ap
->a_vap
;
133 register struct iso_node
*ip
= VTOI(vp
);
135 VATTR_RETURN(vap
, va_fsid
, ip
->i_dev
);
136 VATTR_RETURN(vap
, va_fileid
, ip
->i_number
);
138 VATTR_RETURN(vap
, va_mode
, ip
->inode
.iso_mode
);
139 VATTR_RETURN(vap
, va_nlink
, ip
->inode
.iso_links
);
140 VATTR_RETURN(vap
, va_uid
, ip
->inode
.iso_uid
);
141 VATTR_RETURN(vap
, va_gid
, ip
->inode
.iso_gid
);
142 VATTR_RETURN(vap
, va_access_time
, ip
->inode
.iso_atime
);
143 VATTR_RETURN(vap
, va_modify_time
, ip
->inode
.iso_mtime
);
144 VATTR_RETURN(vap
, va_change_time
, ip
->inode
.iso_ctime
);
145 VATTR_RETURN(vap
, va_rdev
, ip
->inode
.iso_rdev
);
147 VATTR_RETURN(vap
, va_data_size
, (off_t
)ip
->i_size
);
148 if (ip
->i_size
== 0 && (vap
->va_mode
& S_IFMT
) == S_IFLNK
) {
149 struct vnop_readlink_args rdlnk
;
151 char uio_buf
[ UIO_SIZEOF(1) ];
154 MALLOC(cp
, char *, MAXPATHLEN
, M_TEMP
, M_WAITOK
);
155 auio
= uio_createwithbuffer(1, 0, UIO_SYSSPACE
, UIO_READ
,
156 &uio_buf
[0], sizeof(uio_buf
));
157 uio_addiov(auio
, CAST_USER_ADDR_T(cp
), MAXPATHLEN
);
160 rdlnk
.a_vp
= ap
->a_vp
;
161 rdlnk
.a_context
= ap
->a_context
;
162 if (cd9660_readlink(&rdlnk
) == 0)
163 // LP64todo - fix this!
164 VATTR_RETURN(vap
, va_data_size
, MAXPATHLEN
- uio_resid(auio
));
167 VATTR_RETURN(vap
, va_flags
, 0);
168 VATTR_RETURN(vap
, va_gen
, 1);
169 VATTR_RETURN(vap
, va_iosize
, ip
->i_mnt
->logical_block_size
);
170 VATTR_RETURN(vap
, va_total_size
, ip
->i_size
+ ip
->i_rsrcsize
);
177 * Vnode op for reading.
180 cd9660_read(struct vnop_read_args
*ap
)
182 struct vnode
*vp
= ap
->a_vp
;
183 register struct uio
*uio
= ap
->a_uio
;
184 register struct iso_node
*ip
= VTOI(vp
);
185 register struct iso_mnt
*imp
;
190 int rasize
, error
= 0;
193 if (uio_resid(uio
) == 0)
195 if (uio
->uio_offset
< 0)
200 if (UBCINFOEXISTS(vp
)) {
202 * Copy any part of the Apple Double header.
204 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (uio
->uio_offset
< ADH_SIZE
)) {
205 apple_double_header_t header
;
208 if (uio
->uio_offset
< sizeof(apple_double_header_t
)) {
209 header
.magic
= APPLEDOUBLE_MAGIC
;
210 header
.version
= APPLEDOUBLE_VERSION
;
212 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
213 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
214 header
.entries
[0].length
= 32;
215 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
216 header
.entries
[1].offset
= ADH_SIZE
;
217 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
218 header
.finfo
.fdType
= ip
->i_FileType
;
219 header
.finfo
.fdCreator
= ip
->i_Creator
;
220 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
221 header
.finfo
.fdLocation
.v
= -1;
222 header
.finfo
.fdLocation
.h
= -1;
223 header
.finfo
.fdReserved
= 0;
225 bytes
= min(uio_resid(uio
), sizeof(apple_double_header_t
) - uio
->uio_offset
);
226 error
= uiomove(((char *) &header
) + uio
->uio_offset
, bytes
, uio
);
230 if (uio_resid(uio
) && uio
->uio_offset
< ADH_SIZE
) {
233 if (kmem_alloc(kernel_map
, (vm_offset_t
*)&buffer
, ADH_SIZE
)) {
236 bytes
= min(uio_resid(uio
), ADH_SIZE
- uio
->uio_offset
);
237 error
= uiomove(((char *) buffer
) + uio
->uio_offset
, bytes
, uio
);
238 kmem_free(kernel_map
, (vm_offset_t
)buffer
, ADH_SIZE
);
243 if (uio_resid(uio
) > 0)
244 error
= cluster_read(vp
, uio
, (off_t
)ip
->i_size
, 0);
248 lbn
= lblkno(imp
, uio
->uio_offset
);
249 on
= blkoff(imp
, uio
->uio_offset
);
250 n
= min((u_int
)(imp
->logical_block_size
- on
),
252 diff
= (off_t
)ip
->i_size
- uio
->uio_offset
;
257 size
= blksize(imp
, ip
, lbn
);
258 rablock
= (daddr64_t
)lbn
+ 1;
260 if (ip
->i_lastr
+ 1 == lbn
&&
261 lblktosize(imp
, rablock
) < ip
->i_size
) {
262 rasize
= blksize(imp
, ip
, (daddr_t
)rablock
);
263 error
= (int)buf_breadn(vp
, (daddr64_t
)((unsigned)lbn
), size
, &rablock
,
264 &rasize
, 1, NOCRED
, &bp
);
266 error
= (int)buf_bread(vp
, (daddr64_t
)((unsigned)lbn
), size
, NOCRED
, &bp
);
269 n
= min(n
, size
- buf_resid(bp
));
275 error
= uiomove((caddr_t
)(buf_dataptr(bp
) + on
), (int)n
, uio
);
276 if (n
+ on
== imp
->logical_block_size
||
277 uio
->uio_offset
== (off_t
)ip
->i_size
)
280 } while (error
== 0 && uio_resid(uio
) > 0 && n
!= 0);
287 cd9660_ioctl(__unused
struct vnop_ioctl_args
*ap
)
293 cd9660_select(__unused
struct vnop_select_args
*ap
)
296 * We should really check to see if I/O is possible.
304 * NB Currently unsupported.
307 cd9660_mmap(__unused
struct vnop_mmap_args
*ap
)
314 * Structure for reading directories
317 struct dirent saveent
;
318 struct dirent current
;
329 iso_uiodir(struct isoreaddir
*idp
, struct dirent
*dp
, off_t off
)
333 dp
->d_name
[dp
->d_namlen
] = 0;
334 dp
->d_reclen
= DIRSIZ(dp
);
336 if (uio_resid(idp
->uio
) < dp
->d_reclen
) {
343 if (*idp
->ncookies
<= 0) {
348 **idp
->cookies
++ = off
;
353 if ( (error
= uiomove( (caddr_t
)dp
, dp
->d_reclen
, idp
->uio
)) )
360 iso_shipdir(struct isoreaddir
*idp
)
367 cl
= idp
->current
.d_namlen
;
368 cname
= idp
->current
.d_name
;
375 || bcmp(sname
,cname
,sl
)) {
376 if (idp
->saveent
.d_namlen
) {
377 if ( (error
= iso_uiodir(idp
,&idp
->saveent
,idp
->saveoff
)) )
379 idp
->saveent
.d_namlen
= 0;
383 idp
->current
.d_reclen
= DIRSIZ(&idp
->current
);
384 idp
->saveoff
= idp
->curroff
;
385 bcopy(&idp
->current
,&idp
->saveent
,idp
->current
.d_reclen
);
390 * Vnode op for readdir
392 * Note that directories are sector aligned (2K) and
393 * that an entry can cross a logical block but not
397 cd9660_readdir(struct vnop_readdir_args
*ap
)
399 register struct uio
*uio
= ap
->a_uio
;
400 off_t startingOffset
= uio
->uio_offset
;
402 struct isoreaddir
*idp
;
403 struct vnode
*vdp
= ap
->a_vp
;
406 struct buf
*bp
= NULL
;
407 struct iso_directory_record
*ep
;
408 int entryoffsetinblock
;
415 if (ap
->a_flags
& (VNODE_READDIR_EXTENDED
| VNODE_READDIR_REQSEEKOFF
))
420 bmask
= imp
->im_sector_size
- 1;
422 MALLOC(idp
, struct isoreaddir
*, sizeof(*idp
), M_TEMP
, M_WAITOK
);
423 idp
->saveent
.d_namlen
= 0;
426 * Is it worth trying to figure out the type?
428 idp
->saveent
.d_type
= idp
->current
.d_type
= DT_UNKNOWN
;
431 idp
->curroff
= uio
->uio_offset
;
433 if ((entryoffsetinblock
= idp
->curroff
& bmask
) &&
434 (error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
))) {
438 endsearch
= dp
->i_size
;
440 while (idp
->curroff
< endsearch
) {
442 * If offset is on a block boundary,
443 * read the next directory block.
444 * Release previous if it exists.
446 if ((idp
->curroff
& bmask
) == 0) {
449 if ((error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
)))
451 entryoffsetinblock
= 0;
454 * Get pointer to next entry.
456 ep
= (struct iso_directory_record
*)
457 (buf_dataptr(bp
) + entryoffsetinblock
);
459 reclen
= isonum_711(ep
->length
);
461 /* skip to next block, if any */
463 (idp
->curroff
& ~bmask
) + imp
->im_sector_size
;
467 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
) {
469 /* illegal entry, stop */
473 if (entryoffsetinblock
+ reclen
> imp
->im_sector_size
) {
475 /* illegal directory, so stop looking */
479 idp
->current
.d_namlen
= isonum_711(ep
->name_len
);
481 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
+ idp
->current
.d_namlen
) {
483 /* illegal entry, stop */
488 * Some poorly mastered discs have an incorrect directory
489 * file size. If the '.' entry has a better size (bigger)
490 * then use that instead.
492 if ((uio
->uio_offset
== 0) && (isonum_733(ep
->size
) > endsearch
)) {
493 dp
->i_size
= endsearch
= isonum_733(ep
->size
);
496 if ( isonum_711(ep
->flags
) & directoryBit
)
497 idp
->current
.d_fileno
= isodirino(ep
, imp
);
499 idp
->current
.d_fileno
= ((daddr_t
)buf_blkno(bp
) << imp
->im_bshift
) +
503 idp
->curroff
+= reclen
;
505 switch (imp
->iso_ftype
) {
507 cd9660_rrip_getname(ep
,idp
->current
.d_name
, &namelen
,
508 &idp
->current
.d_fileno
,imp
);
509 idp
->current
.d_namlen
= (u_char
)namelen
;
510 if (idp
->current
.d_namlen
)
511 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
514 case ISO_FTYPE_JOLIET
:
515 ucsfntrans((u_int16_t
*)ep
->name
, idp
->current
.d_namlen
,
516 idp
->current
.d_name
, &namelen
,
517 isonum_711(ep
->flags
) & directoryBit
,
518 isonum_711(ep
->flags
) & associatedBit
);
519 idp
->current
.d_namlen
= (u_char
)namelen
;
520 if (idp
->current
.d_namlen
)
521 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
524 default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
525 strcpy(idp
->current
.d_name
,"..");
526 switch (ep
->name
[0]) {
528 idp
->current
.d_namlen
= 1;
529 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
532 idp
->current
.d_namlen
= 2;
533 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
536 isofntrans(ep
->name
,idp
->current
.d_namlen
,
537 idp
->current
.d_name
, &namelen
,
538 imp
->iso_ftype
== ISO_FTYPE_9660
,
539 isonum_711(ep
->flags
) & associatedBit
);
540 idp
->current
.d_namlen
= (u_char
)namelen
;
541 if (imp
->iso_ftype
== ISO_FTYPE_DEFAULT
)
542 error
= iso_shipdir(idp
);
544 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
551 entryoffsetinblock
+= reclen
;
554 if (!error
&& imp
->iso_ftype
== ISO_FTYPE_DEFAULT
) {
555 idp
->current
.d_namlen
= 0;
556 error
= iso_shipdir(idp
);
559 if (!error
&& ap
->a_ncookies
) {
560 struct dirent
*dirp
, *dpstart
;
566 * Only the NFS server uses cookies, and it loads the
567 * directory block into system space, so we can just look at
570 * We assume the entire transfer is done to a single contiguous buffer.
572 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
) || uio
->uio_iovcnt
!= 1)
573 panic("ufs_readdir: lost in space");
576 * Make a first pass over the buffer just generated,
577 * counting the number of entries:
579 // LP64todo - fix this!
580 dpstart
= (struct dirent
*)
581 CAST_DOWN(caddr_t
, (uio_iov_base(uio
) - (uio
->uio_offset
- startingOffset
)));
582 for (dirp
= dpstart
, bufferOffset
= startingOffset
, ncookies
= 0;
583 bufferOffset
< uio
->uio_offset
; ) {
584 if (dirp
->d_reclen
== 0)
586 bufferOffset
+= dirp
->d_reclen
;
588 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
590 lost
+= uio
->uio_offset
- bufferOffset
;
591 uio
->uio_offset
= bufferOffset
;
594 * Allocate a buffer to hold the cookies requested:
596 MALLOC(cookies
, u_long
*, ncookies
* sizeof(u_long
), M_TEMP
, M_WAITOK
);
597 *ap
->a_ncookies
= ncookies
;
598 *ap
->a_cookies
= cookies
;
601 * Fill in the offsets for each entry in the buffer just allocated:
603 for (bufferOffset
= startingOffset
, dirp
= dpstart
; bufferOffset
< uio
->uio_offset
; ) {
604 *(cookies
++) = bufferOffset
;
605 bufferOffset
+= dirp
->d_reclen
;
606 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
616 uio
->uio_offset
= idp
->uio_off
;
617 *ap
->a_eofflag
= idp
->eofflag
;
625 * Return target name of a symbolic link
626 * Shouldn't we get the parent vnode and read the data from there?
627 * This could eventually result in deadlocks in cd9660_lookup.
628 * But otherwise the block read here is in the block buffer two times.
630 typedef struct iso_directory_record ISODIR
;
631 typedef struct iso_node ISONODE
;
632 typedef struct iso_mnt ISOMNT
;
634 cd9660_readlink(struct vnop_readlink_args
*ap
)
649 if (imp
->iso_ftype
!= ISO_FTYPE_RRIP
)
653 * Get parents directory record block that this inode included.
655 error
= (int)buf_bread(imp
->im_devvp
,
656 (daddr64_t
)((unsigned)(ip
->i_number
>> imp
->im_bshift
)),
657 imp
->logical_block_size
, NOCRED
, &bp
);
664 * Setup the directory pointer for this inode
666 dirp
= (ISODIR
*)(buf_dataptr(bp
) + (ip
->i_number
& imp
->im_bmask
));
669 * Just make sure, we have a right one....
670 * 1: Check not cross boundary on block
672 if ((ip
->i_number
& imp
->im_bmask
) + isonum_711(dirp
->length
)
673 > imp
->logical_block_size
) {
680 * Abuse a namei buffer for now.
682 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
683 MALLOC_ZONE(symname
, char *, MAXPATHLEN
, M_NAMEI
, M_WAITOK
);
685 // LP64todo - fix this!
686 symname
= CAST_DOWN(caddr_t
, uio_iov_base(uio
));
689 * Ok, we just gathering a symbolic name in SL record.
691 if (cd9660_rrip_getsymname(dirp
, symname
, &symlen
, imp
) == 0) {
692 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
693 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
698 * Don't forget before you leave from home ;-)
703 * return with the symbolic name to caller's.
705 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
)) {
706 error
= uiomove(symname
, symlen
, uio
);
707 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
711 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
712 uio_iov_len_add(uio
, -((int64_t)symlen
));
714 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
715 uio_iov_len_add(uio
, -((int)symlen
));
717 uio_iov_base_add(uio
, symlen
);
723 * prepare and issue the I/O
726 cd9660_strategy(struct vnop_strategy_args
*ap
)
729 vnode_t vp
= buf_vnode(bp
);
730 struct iso_node
*ip
= VTOI(vp
);
732 return (buf_strategy(ip
->i_devvp
, ap
));
737 * Return POSIX pathconf information applicable to cd9660 filesystems.
740 cd9660_pathconf(struct vnop_pathconf_args
*ap
)
743 switch (ap
->a_name
) {
748 switch (VTOI(ap
->a_vp
)->i_mnt
->iso_ftype
) {
750 *ap
->a_retval
= ISO_RRIP_NAMEMAX
;
752 case ISO_FTYPE_JOLIET
:
753 *ap
->a_retval
= ISO_JOLIET_NAMEMAX
;
756 *ap
->a_retval
= ISO_NAMEMAX
;
760 *ap
->a_retval
= PATH_MAX
;
763 *ap
->a_retval
= PIPE_BUF
;
765 case _PC_CHOWN_RESTRICTED
:
778 * Unsupported operation
781 cd9660_enotsupp(void)
785 /* Pagein. similar to read */
787 cd9660_pagein(struct vnop_pagein_args
*ap
)
789 struct vnode
*vp
= ap
->a_vp
;
791 size_t size
= ap
->a_size
;
792 off_t f_offset
= ap
->a_f_offset
;
793 vm_offset_t pl_offset
= ap
->a_pl_offset
;
794 int flags
= ap
->a_flags
;
795 register struct iso_node
*ip
= VTOI(vp
);
799 * Copy the Apple Double header.
801 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (f_offset
== 0) && (size
== ADH_SIZE
)) {
802 apple_double_header_t header
;
806 kret
= ubc_upl_map(pl
, &ioaddr
);
807 if (kret
!= KERN_SUCCESS
)
808 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
810 bzero((caddr_t
)ioaddr
, ADH_SIZE
);
812 header
.magic
= APPLEDOUBLE_MAGIC
;
813 header
.version
= APPLEDOUBLE_VERSION
;
815 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
816 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
817 header
.entries
[0].length
= 32;
818 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
819 header
.entries
[1].offset
= ADH_SIZE
;
820 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
821 header
.finfo
.fdType
= ip
->i_FileType
;
822 header
.finfo
.fdCreator
= ip
->i_Creator
;
823 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
824 header
.finfo
.fdLocation
.v
= -1;
825 header
.finfo
.fdLocation
.h
= -1;
826 header
.finfo
.fdReserved
= 0;
828 bcopy((caddr_t
)&header
, (caddr_t
)ioaddr
, sizeof(apple_double_header_t
));
830 kret
= ubc_upl_unmap(pl
);
831 if (kret
!= KERN_SUCCESS
)
832 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
834 if ((flags
& UPL_NOCOMMIT
) == 0) {
835 ubc_upl_commit_range(pl
, pl_offset
, size
, UPL_COMMIT_FREE_ON_EMPTY
);
838 /* check pageouts are for reg file only and ubc info is present*/
840 panic("cd9660_pagein: Not a VREG");
841 UBCINFOCHECK("cd9660_pagein", vp
);
843 error
= cluster_pagein(vp
, pl
, pl_offset
, f_offset
, size
,
844 (off_t
)ip
->i_size
, flags
);
850 * cd9660_remove - not possible to remove a file from iso cds
852 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
855 cd9660_remove(__unused
struct vnop_remove_args
*ap
)
862 * cd9660_rmdir - not possible to remove a directory from iso cds
864 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
867 cd9660_rmdir(struct vnop_rmdir_args
*ap
)
869 (void) nop_rmdir(ap
);
876 #% getattrlist vp = = =
880 IN struct attrlist *alist;
881 INOUT struct uio *uio;
882 IN vfs_context_t context;
887 cd9660_getattrlist(struct vnop_getattrlist_args
*ap
)
889 struct attrlist
*alist
= ap
->a_alist
;
898 if ((alist
->bitmapcount
!= ATTR_BIT_MAP_COUNT
) ||
899 ((alist
->commonattr
& ~ATTR_CMN_VALIDMASK
) != 0) ||
900 ((alist
->volattr
& ~ATTR_VOL_VALIDMASK
) != 0) ||
901 ((alist
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) ||
902 ((alist
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) ||
903 ((alist
->forkattr
& ~ATTR_FORK_VALIDMASK
) != 0)) {
908 * Requesting volume information requires setting the ATTR_VOL_INFO bit and
909 * volume info requests are mutually exclusive with all other info requests:
911 if ((alist
->volattr
!= 0) &&
912 (((alist
->volattr
& ATTR_VOL_INFO
) == 0) ||
913 (alist
->dirattr
!= 0) ||
914 (alist
->fileattr
!= 0) ||
915 (alist
->forkattr
!= 0) )) {
920 * Reject requests for unsupported options for now:
922 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) return EINVAL
;
923 if (alist
->commonattr
& (ATTR_CMN_NAMEDATTRCOUNT
| ATTR_CMN_NAMEDATTRLIST
)) return EINVAL
;
924 if (alist
->fileattr
&
925 (ATTR_FILE_FILETYPE
|
926 ATTR_FILE_FORKCOUNT
|
928 ATTR_FILE_DATAEXTENTS
|
929 ATTR_FILE_RSRCEXTENTS
)) {
934 fixedblocksize
= attrcalcsize(alist
);
935 attrblocksize
= fixedblocksize
+ (sizeof(uint32_t)); /* uint32_t for length word */
936 if (alist
->commonattr
& ATTR_CMN_NAME
) attrblocksize
+= NAME_MAX
;
937 if (alist
->commonattr
& ATTR_CMN_NAMEDATTRLIST
) attrblocksize
+= 0; /* XXX PPD */
938 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) attrblocksize
+= PATH_MAX
;
939 if (alist
->volattr
& ATTR_VOL_NAME
) attrblocksize
+= NAME_MAX
;
940 if (alist
->fileattr
& ATTR_FILE_FORKLIST
) attrblocksize
+= 0; /* XXX PPD */
942 attrbufsize
= MIN(uio_resid(ap
->a_uio
), attrblocksize
);
943 MALLOC(attrbufptr
, void *, attrblocksize
, M_TEMP
, M_WAITOK
);
944 attrptr
= attrbufptr
;
945 *((uint32_t *)attrptr
) = 0; /* Set buffer length in case of errors */
946 ++((uint32_t *)attrptr
); /* Reserve space for length field */
947 varptr
= ((char *)attrptr
) + fixedblocksize
; /* Point to variable-length storage */
949 packattrblk(alist
, ap
->a_vp
, &attrptr
, &varptr
);
951 /* Store length of fixed + var block */
952 *((uint32_t *)attrbufptr
) = ((char*)varptr
- (char*)attrbufptr
);
953 /* Don't copy out more data than was generated */
954 attrbufsize
= MIN(attrbufsize
, (char*)varptr
- (char*)attrbufptr
);
956 error
= uiomove((caddr_t
)attrbufptr
, attrbufsize
, ap
->a_uio
);
958 FREE(attrbufptr
, M_TEMP
);
964 * Make a RIFF file header for a CD-ROM XA media file.
966 __private_extern__
void
967 cd9660_xa_init(struct iso_node
*ip
, struct iso_directory_record
*isodir
)
970 struct riff_header
*header
;
974 MALLOC(header
, struct riff_header
*, sizeof(struct riff_header
), M_TEMP
, M_WAITOK
);
976 sectors
= ip
->i_size
/ 2048;
978 strncpy(header
->riff
, "RIFF", 4);
979 header
->fileSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
) - 8);
980 strncpy(header
->cdxa
, "CDXA", 4);
981 strncpy(header
->fmt
, "fmt ", 4);
982 header
->fmtSize
= NXSwapHostLongToLittle(16);
983 strncpy(header
->data
, "data", 4);
984 header
->dataSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
);
987 * Copy the CD-ROM XA extended directory information into the header. As far as
988 * I can tell, it's always 14 bytes in the directory record, but allocated 16 bytes
989 * in the header (the last two being zeroed pad bytes).
991 name_len
= isonum_711(isodir
->name_len
);
992 cdxa
= &isodir
->name
[name_len
];
993 if ((name_len
& 0x01) == 0)
994 ++cdxa
; /* Skip pad byte */
995 bcopy(cdxa
, header
->fmtData
, 14);
996 header
->fmtData
[14] = 0;
997 header
->fmtData
[15] = 0;
1000 * Point this i-node to the "whole sector" device instead of the normal
1001 * device. This allows cd9660_strategy to be ignorant of the block
1004 ip
->i_devvp
= ip
->i_mnt
->phys_devvp
;
1006 ip
->i_size
= sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
);
1007 ip
->i_riff
= header
;
1011 * Helper routine for vnop_read and vnop_pagein of CD-ROM XA multimedia files.
1012 * This routine determines the physical location of the file, then reads
1013 * sectors directly from the device into a buffer. It also handles inserting
1014 * the RIFF header at the beginning of the file.
1016 * Exactly one of buffer or uio must be non-zero. It will either bcopy to
1017 * buffer, or uiomove via uio.
1019 * XXX Should this code be using buf_breadn and ip->i_lastr to support single-block
1020 * read-ahead? Should we try more aggressive read-ahead like cluster_io does?
1022 * XXX This could be made to do larger I/O to the device (reading all the
1023 * whole sectors directly into the buffer). That would make the code more
1024 * complex, and the current code only adds 2.5% overhead compared to reading
1025 * from the device directly (at least on my test machine).
1028 cd9660_xa_read_common(
1035 struct iso_node
*ip
= VTOI(vp
);
1037 off_t diff
; /* number of bytes from offset to file's EOF */
1038 daddr_t block
; /* physical disk block containing offset */
1039 off_t sect_off
; /* starting offset into current sector */
1040 u_int count
; /* number of bytes to transfer in current block */
1044 * Copy any part of the RIFF header.
1046 if (offset
< sizeof(struct riff_header
)) {
1049 p
= ((char *) ip
->i_riff
) + offset
;
1050 count
= min(amount
, sizeof(struct riff_header
) - offset
);
1052 bcopy(p
, buffer
, count
);
1055 error
= uiomove(p
, count
, uio
);
1064 * Loop over (possibly partial) blocks to transfer.
1066 while (error
== 0 && amount
> 0) {
1068 * Determine number of bytes until EOF. If we've hit
1071 diff
= ip
->i_size
- offset
;
1075 /* Get a block from the underlying device */
1076 block
= ip
->iso_start
+ (offset
- sizeof(struct riff_header
))/CDXA_SECTOR_SIZE
;
1077 error
= (int)buf_bread(ip
->i_devvp
, (daddr64_t
)((unsigned)block
), CDXA_SECTOR_SIZE
, NOCRED
, &bp
);
1082 if (buf_resid(bp
)) {
1083 printf("isofs: cd9660_xa_read_common: buf_bread didn't read full sector\n");
1087 /* Figure out which part of the block to copy, and copy it */
1088 sect_off
= (offset
- sizeof(struct riff_header
)) % CDXA_SECTOR_SIZE
;
1089 count
= min(CDXA_SECTOR_SIZE
-sect_off
, amount
);
1090 if (diff
< count
) /* Pin transfer amount to EOF */
1094 bcopy(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), buffer
, count
);
1097 error
= uiomove(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), count
, uio
);
1103 * If we copied through the end of the block, or the end of file, then
1104 * age the device block. This is optimized for sequential access.
1106 if (sect_off
+count
== CDXA_SECTOR_SIZE
|| offset
== (off_t
)ip
->i_size
)
1115 * Read from a CD-ROM XA multimedia file.
1117 * This uses the same common routine as pagein for doing the actual read
1120 * This routine doesn't do any caching beyond what the block device does.
1121 * Even then, cd9660_xa_read_common ages the blocks once we read up to
1124 * We don't even take advantage if the file has been memory mapped and has
1125 * valid pages already (in which case we could just uiomove from the page
1126 * to the caller). Since we're a read-only filesystem, there can't be
1127 * any cache coherency problems. Multimedia files are expected to be
1128 * large and streamed anyway, so caching file contents probably isn't
1132 cd9660_xa_read(struct vnop_read_args
*ap
)
1134 struct vnode
*vp
= ap
->a_vp
;
1135 register struct uio
*uio
= ap
->a_uio
;
1136 register struct iso_node
*ip
= VTOI(vp
);
1137 off_t offset
= uio
->uio_offset
;
1138 // LP64todo - fix this!
1139 size_t size
= uio_resid(uio
);
1141 /* Check for some obvious parameter problems */
1146 if (offset
>= ip
->i_size
)
1149 /* Pin the size of the read to the file's EOF */
1150 if (offset
+ size
> ip
->i_size
)
1151 size
= ip
->i_size
- offset
;
1153 return cd9660_xa_read_common(vp
, offset
, size
, NULL
, uio
);
1157 * Page in from a CD-ROM XA media file.
1159 * Since our device block size isn't a power of two, we can't use
1160 * cluster_pagein. Instead, we have to map the page and read into it.
1163 cd9660_xa_pagein(struct vnop_pagein_args
*ap
)
1165 struct vnode
*vp
= ap
->a_vp
;
1166 upl_t pl
= ap
->a_pl
;
1167 size_t size
= ap
->a_size
;
1168 off_t f_offset
= ap
->a_f_offset
;
1169 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1170 int flags
= ap
->a_flags
;
1171 register struct iso_node
*ip
= VTOI(vp
);
1176 /* check pageins are for reg file only and ubc info is present*/
1178 panic("cd9660_xa_pagein: Not a VREG");
1179 UBCINFOCHECK("cd9660_xa_pagein", vp
);
1182 panic("cd9660_xa_pagein: size = %d", size
);
1184 kret
= ubc_upl_map(pl
, &ioaddr
);
1185 if (kret
!= KERN_SUCCESS
)
1186 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1188 ioaddr
+= pl_offset
;
1190 /* Make sure pagein doesn't extend past EOF */
1191 if (f_offset
+ size
> ip
->i_size
)
1192 size
= ip
->i_size
- f_offset
; /* pin size to EOF */
1194 /* Read the data in using the underlying device */
1195 error
= cd9660_xa_read_common(vp
, f_offset
, size
, (caddr_t
)ioaddr
, NULL
);
1197 /* Zero fill part of page past EOF */
1198 if (ap
->a_size
> size
)
1199 bzero((caddr_t
)ioaddr
+size
, ap
->a_size
-size
);
1201 kret
= ubc_upl_unmap(pl
);
1202 if (kret
!= KERN_SUCCESS
)
1203 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1205 if ((flags
& UPL_NOCOMMIT
) == 0)
1208 ubc_upl_abort_range(pl
, pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
);
1210 ubc_upl_commit_range(pl
, pl_offset
, ap
->a_size
, UPL_COMMIT_FREE_ON_EMPTY
);
1217 * Global vfs data structures for isofs
1219 #define cd9660_create \
1220 ((int (*)(struct vnop_create_args *))err_create)
1221 #define cd9660_mknod ((int (*)(struct vnop_mknod_args *))err_mknod)
1222 #define cd9660_write ((int (*)(struct vnop_write_args *))cd9660_enotsupp)
1223 #define cd9660_fsync ((int (*)(struct vnop_fsync_args *))nullop)
1224 #define cd9660_rename \
1225 ((int (*)(struct vnop_rename_args *))err_rename)
1226 #define cd9660_copyfile \
1227 ((int (*)(struct vnop_copyfile_args *))err_copyfile)
1228 #define cd9660_link ((int (*)(struct vnop_link_args *))err_link)
1229 #define cd9660_mkdir ((int (*)(struct vnop_mkdir_args *))err_mkdir)
1230 #define cd9660_symlink \
1231 ((int (*)(struct vnop_symlink_args *))err_symlink)
1232 #define cd9660_advlock \
1233 ((int (*)(struct vnop_advlock_args *))cd9660_enotsupp)
1234 #define cd9660_bwrite \
1235 ((int (*)(struct vnop_bwrite_args *))cd9660_enotsupp)
1236 #define cd9660_pageout \
1237 ((int (*)(struct vnop_pageout_args *))cd9660_enotsupp)
1238 int cd9660_blktooff(struct vnop_blktooff_args
*ap
);
1239 int cd9660_offtoblk(struct vnop_offtoblk_args
*ap
);
1240 int cd9660_blockmap(struct vnop_blockmap_args
*ap
);
1242 #define VOPFUNC int (*)(void *)
1244 * Global vfs data structures for cd9660
1246 int (**cd9660_vnodeop_p
)(void *);
1247 struct vnodeopv_entry_desc cd9660_vnodeop_entries
[] = {
1248 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1249 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1250 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1251 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1252 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1253 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1254 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1255 { &vnop_read_desc
, (VOPFUNC
)cd9660_read
}, /* read */
1256 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1257 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1258 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1259 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1260 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1261 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1262 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1263 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1264 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1265 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1266 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1267 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1268 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1269 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1270 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1271 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1272 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1273 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1274 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1275 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1276 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1277 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1278 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1279 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1280 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1281 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1282 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1284 struct vnodeopv_desc cd9660_vnodeop_opv_desc
=
1285 { &cd9660_vnodeop_p
, cd9660_vnodeop_entries
};
1288 * The VOP table for CD-ROM XA (media) files is almost the same
1289 * as for ordinary files, except for read, and pagein.
1290 * Note that cd9660_xa_read doesn't use cluster I/O, so blockmap
1291 * isn't needed, and isn't implemented. Similarly, it doesn't
1292 * do buf_bread() on CD XA vnodes, so bmap, blktooff, offtoblk
1295 int (**cd9660_cdxaop_p
)(void *);
1296 struct vnodeopv_entry_desc cd9660_cdxaop_entries
[] = {
1297 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1298 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1299 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1300 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1301 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1302 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1303 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1304 { &vnop_read_desc
, (VOPFUNC
)cd9660_xa_read
}, /* read */
1305 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1306 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1307 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1308 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1309 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1310 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1311 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1312 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1313 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1314 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1315 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1316 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1317 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1318 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1319 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1320 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1321 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1322 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1323 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1324 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1325 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_xa_pagein
}, /* Pagein */
1326 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1327 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1328 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1330 struct vnodeopv_desc cd9660_cdxaop_opv_desc
=
1331 { &cd9660_cdxaop_p
, cd9660_cdxaop_entries
};
1334 * Special device vnode ops
1336 int (**cd9660_specop_p
)(void *);
1337 struct vnodeopv_entry_desc cd9660_specop_entries
[] = {
1338 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1339 { &vnop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
1340 { &vnop_create_desc
, (VOPFUNC
)spec_create
}, /* create */
1341 { &vnop_mknod_desc
, (VOPFUNC
)spec_mknod
}, /* mknod */
1342 { &vnop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
1343 { &vnop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
1344 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1345 { &vnop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
1346 { &vnop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
1347 { &vnop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
1348 { &vnop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
1349 { &vnop_mmap_desc
, (VOPFUNC
)spec_mmap
}, /* mmap */
1350 { &vnop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
1351 { &vnop_remove_desc
, (VOPFUNC
)spec_remove
}, /* remove */
1352 { &vnop_link_desc
, (VOPFUNC
)spec_link
}, /* link */
1353 { &vnop_rename_desc
, (VOPFUNC
)spec_rename
}, /* rename */
1354 { &vnop_mkdir_desc
, (VOPFUNC
)spec_mkdir
}, /* mkdir */
1355 { &vnop_rmdir_desc
, (VOPFUNC
)spec_rmdir
}, /* rmdir */
1356 { &vnop_symlink_desc
, (VOPFUNC
)spec_symlink
}, /* symlink */
1357 { &vnop_readdir_desc
, (VOPFUNC
)spec_readdir
}, /* readdir */
1358 { &vnop_readlink_desc
, (VOPFUNC
)spec_readlink
}, /* readlink */
1359 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1360 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1361 { &vnop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
1362 { &vnop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
1363 { &vnop_advlock_desc
, (VOPFUNC
)spec_advlock
}, /* advlock */
1364 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1365 { &vnop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
1366 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1367 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1368 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1369 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1370 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1371 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1373 struct vnodeopv_desc cd9660_specop_opv_desc
=
1374 { &cd9660_specop_p
, cd9660_specop_entries
};
1377 int (**cd9660_fifoop_p
)(void *);
1378 struct vnodeopv_entry_desc cd9660_fifoop_entries
[] = {
1379 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1380 { &vnop_lookup_desc
, (VOPFUNC
)fifo_lookup
}, /* lookup */
1381 { &vnop_create_desc
, (VOPFUNC
)fifo_create
}, /* create */
1382 { &vnop_mknod_desc
, (VOPFUNC
)fifo_mknod
}, /* mknod */
1383 { &vnop_open_desc
, (VOPFUNC
)fifo_open
}, /* open */
1384 { &vnop_close_desc
, (VOPFUNC
)fifo_close
}, /* close */
1385 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1386 { &vnop_read_desc
, (VOPFUNC
)fifo_read
}, /* read */
1387 { &vnop_write_desc
, (VOPFUNC
)fifo_write
}, /* write */
1388 { &vnop_ioctl_desc
, (VOPFUNC
)fifo_ioctl
}, /* ioctl */
1389 { &vnop_select_desc
, (VOPFUNC
)fifo_select
}, /* select */
1390 { &vnop_mmap_desc
, (VOPFUNC
)fifo_mmap
}, /* mmap */
1391 { &vnop_fsync_desc
, (VOPFUNC
)fifo_fsync
}, /* fsync */
1392 { &vnop_remove_desc
, (VOPFUNC
)fifo_remove
}, /* remove */
1393 { &vnop_link_desc
, (VOPFUNC
)fifo_link
} , /* link */
1394 { &vnop_rename_desc
, (VOPFUNC
)fifo_rename
}, /* rename */
1395 { &vnop_mkdir_desc
, (VOPFUNC
)fifo_mkdir
}, /* mkdir */
1396 { &vnop_rmdir_desc
, (VOPFUNC
)fifo_rmdir
}, /* rmdir */
1397 { &vnop_symlink_desc
, (VOPFUNC
)fifo_symlink
}, /* symlink */
1398 { &vnop_readdir_desc
, (VOPFUNC
)fifo_readdir
}, /* readdir */
1399 { &vnop_readlink_desc
, (VOPFUNC
)fifo_readlink
}, /* readlink */
1400 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1401 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1402 { &vnop_strategy_desc
, (VOPFUNC
)fifo_strategy
}, /* strategy */
1403 { &vnop_pathconf_desc
, (VOPFUNC
)fifo_pathconf
}, /* pathconf */
1404 { &vnop_advlock_desc
, (VOPFUNC
)fifo_advlock
}, /* advlock */
1405 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1406 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1407 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1408 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1409 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1410 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1412 struct vnodeopv_desc cd9660_fifoop_opv_desc
=
1413 { &cd9660_fifoop_p
, cd9660_fifoop_entries
};