2 * Copyright (c) 2000-2004 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>
83 #include <sys/kauth.h>
85 #include <miscfs/specfs/specdev.h>
86 #include <miscfs/fifofs/fifo.h>
87 #include <sys/malloc.h>
90 #include <vfs/vfs_support.h>
91 #include <vm/vm_kern.h>
94 #include <sys/ubc_internal.h>
95 #include <sys/uio_internal.h>
96 #include <architecture/byte_order.h>
98 #include <vm/vm_map.h>
99 #include <vm/vm_kern.h> /* kmem_alloc, kmem_free */
101 #include <isofs/cd9660/iso.h>
102 #include <isofs/cd9660/cd9660_node.h>
103 #include <isofs/cd9660/iso_rrip.h>
111 cd9660_open(__unused
struct vnop_open_args
*ap
)
119 * Update the times on the inode on writeable file systems.
122 cd9660_close(__unused
struct vnop_close_args
*ap
)
128 cd9660_getattr(struct vnop_getattr_args
*ap
)
130 struct vnode
*vp
= ap
->a_vp
;
131 register struct vnode_attr
*vap
= ap
->a_vap
;
132 register struct iso_node
*ip
= VTOI(vp
);
134 VATTR_RETURN(vap
, va_fsid
, ip
->i_dev
);
135 VATTR_RETURN(vap
, va_fileid
, ip
->i_number
);
137 VATTR_RETURN(vap
, va_mode
, ip
->inode
.iso_mode
);
138 VATTR_RETURN(vap
, va_nlink
, ip
->inode
.iso_links
);
139 VATTR_RETURN(vap
, va_uid
, ip
->inode
.iso_uid
);
140 VATTR_RETURN(vap
, va_gid
, ip
->inode
.iso_gid
);
141 VATTR_RETURN(vap
, va_access_time
, ip
->inode
.iso_atime
);
142 VATTR_RETURN(vap
, va_modify_time
, ip
->inode
.iso_mtime
);
143 VATTR_RETURN(vap
, va_change_time
, ip
->inode
.iso_ctime
);
144 VATTR_RETURN(vap
, va_rdev
, ip
->inode
.iso_rdev
);
146 VATTR_RETURN(vap
, va_data_size
, (off_t
)ip
->i_size
);
147 if (ip
->i_size
== 0 && (vap
->va_mode
& S_IFMT
) == S_IFLNK
) {
148 struct vnop_readlink_args rdlnk
;
150 char uio_buf
[ UIO_SIZEOF(1) ];
153 MALLOC(cp
, char *, MAXPATHLEN
, M_TEMP
, M_WAITOK
);
154 auio
= uio_createwithbuffer(1, 0, UIO_SYSSPACE
, UIO_READ
,
155 &uio_buf
[0], sizeof(uio_buf
));
156 uio_addiov(auio
, CAST_USER_ADDR_T(cp
), MAXPATHLEN
);
159 rdlnk
.a_vp
= ap
->a_vp
;
160 rdlnk
.a_context
= ap
->a_context
;
161 if (cd9660_readlink(&rdlnk
) == 0)
162 // LP64todo - fix this!
163 VATTR_RETURN(vap
, va_data_size
, MAXPATHLEN
- uio_resid(auio
));
166 VATTR_RETURN(vap
, va_flags
, 0);
167 VATTR_RETURN(vap
, va_gen
, 1);
168 VATTR_RETURN(vap
, va_iosize
, ip
->i_mnt
->logical_block_size
);
169 VATTR_RETURN(vap
, va_total_size
, ip
->i_size
+ ip
->i_rsrcsize
);
176 * Vnode op for reading.
179 cd9660_read(struct vnop_read_args
*ap
)
181 struct vnode
*vp
= ap
->a_vp
;
182 register struct uio
*uio
= ap
->a_uio
;
183 register struct iso_node
*ip
= VTOI(vp
);
184 register struct iso_mnt
*imp
;
189 int rasize
, error
= 0;
192 if (uio_resid(uio
) == 0)
194 if (uio
->uio_offset
< 0)
199 if (UBCINFOEXISTS(vp
)) {
201 * Copy any part of the Apple Double header.
203 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (uio
->uio_offset
< ADH_SIZE
)) {
204 apple_double_header_t header
;
207 if (uio
->uio_offset
< sizeof(apple_double_header_t
)) {
208 header
.magic
= APPLEDOUBLE_MAGIC
;
209 header
.version
= APPLEDOUBLE_VERSION
;
211 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
212 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
213 header
.entries
[0].length
= 32;
214 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
215 header
.entries
[1].offset
= ADH_SIZE
;
216 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
217 header
.finfo
.fdType
= ip
->i_FileType
;
218 header
.finfo
.fdCreator
= ip
->i_Creator
;
219 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
220 header
.finfo
.fdLocation
.v
= -1;
221 header
.finfo
.fdLocation
.h
= -1;
222 header
.finfo
.fdReserved
= 0;
224 bytes
= min(uio_resid(uio
), sizeof(apple_double_header_t
) - uio
->uio_offset
);
225 error
= uiomove(((char *) &header
) + uio
->uio_offset
, bytes
, uio
);
229 if (uio_resid(uio
) && uio
->uio_offset
< ADH_SIZE
) {
232 if (kmem_alloc(kernel_map
, (vm_offset_t
*)&buffer
, ADH_SIZE
)) {
235 bytes
= min(uio_resid(uio
), ADH_SIZE
- uio
->uio_offset
);
236 error
= uiomove(((char *) buffer
) + uio
->uio_offset
, bytes
, uio
);
237 kmem_free(kernel_map
, (vm_offset_t
)buffer
, ADH_SIZE
);
242 if (uio_resid(uio
) > 0)
243 error
= cluster_read(vp
, uio
, (off_t
)ip
->i_size
, 0);
247 lbn
= lblkno(imp
, uio
->uio_offset
);
248 on
= blkoff(imp
, uio
->uio_offset
);
249 n
= min((u_int
)(imp
->logical_block_size
- on
),
251 diff
= (off_t
)ip
->i_size
- uio
->uio_offset
;
256 size
= blksize(imp
, ip
, lbn
);
257 rablock
= (daddr64_t
)lbn
+ 1;
259 if (ip
->i_lastr
+ 1 == lbn
&&
260 lblktosize(imp
, rablock
) < ip
->i_size
) {
261 rasize
= blksize(imp
, ip
, (daddr_t
)rablock
);
262 error
= (int)buf_breadn(vp
, (daddr64_t
)((unsigned)lbn
), size
, &rablock
,
263 &rasize
, 1, NOCRED
, &bp
);
265 error
= (int)buf_bread(vp
, (daddr64_t
)((unsigned)lbn
), size
, NOCRED
, &bp
);
268 n
= min(n
, size
- buf_resid(bp
));
274 error
= uiomove((caddr_t
)(buf_dataptr(bp
) + on
), (int)n
, uio
);
275 if (n
+ on
== imp
->logical_block_size
||
276 uio
->uio_offset
== (off_t
)ip
->i_size
)
279 } while (error
== 0 && uio_resid(uio
) > 0 && n
!= 0);
286 cd9660_ioctl(__unused
struct vnop_ioctl_args
*ap
)
292 cd9660_select(__unused
struct vnop_select_args
*ap
)
295 * We should really check to see if I/O is possible.
303 * NB Currently unsupported.
306 cd9660_mmap(__unused
struct vnop_mmap_args
*ap
)
313 * Structure for reading directories
316 struct dirent saveent
;
317 struct dirent current
;
328 iso_uiodir(struct isoreaddir
*idp
, struct dirent
*dp
, off_t off
)
332 dp
->d_name
[dp
->d_namlen
] = 0;
333 dp
->d_reclen
= DIRSIZ(dp
);
335 if (uio_resid(idp
->uio
) < dp
->d_reclen
) {
342 if (*idp
->ncookies
<= 0) {
347 **idp
->cookies
++ = off
;
352 if ( (error
= uiomove( (caddr_t
)dp
, dp
->d_reclen
, idp
->uio
)) )
359 iso_shipdir(struct isoreaddir
*idp
)
366 cl
= idp
->current
.d_namlen
;
367 cname
= idp
->current
.d_name
;
374 || bcmp(sname
,cname
,sl
)) {
375 if (idp
->saveent
.d_namlen
) {
376 if ( (error
= iso_uiodir(idp
,&idp
->saveent
,idp
->saveoff
)) )
378 idp
->saveent
.d_namlen
= 0;
382 idp
->current
.d_reclen
= DIRSIZ(&idp
->current
);
383 idp
->saveoff
= idp
->curroff
;
384 bcopy(&idp
->current
,&idp
->saveent
,idp
->current
.d_reclen
);
389 * Vnode op for readdir
391 * Note that directories are sector aligned (2K) and
392 * that an entry can cross a logical block but not
396 cd9660_readdir(struct vnop_readdir_args
*ap
)
398 register struct uio
*uio
= ap
->a_uio
;
399 off_t startingOffset
= uio
->uio_offset
;
401 struct isoreaddir
*idp
;
402 struct vnode
*vdp
= ap
->a_vp
;
405 struct buf
*bp
= NULL
;
406 struct iso_directory_record
*ep
;
407 int entryoffsetinblock
;
414 if (ap
->a_flags
& (VNODE_READDIR_EXTENDED
| VNODE_READDIR_REQSEEKOFF
))
419 bmask
= imp
->im_sector_size
- 1;
421 MALLOC(idp
, struct isoreaddir
*, sizeof(*idp
), M_TEMP
, M_WAITOK
);
422 idp
->saveent
.d_namlen
= 0;
425 * Is it worth trying to figure out the type?
427 idp
->saveent
.d_type
= idp
->current
.d_type
= DT_UNKNOWN
;
430 idp
->curroff
= uio
->uio_offset
;
432 if ((entryoffsetinblock
= idp
->curroff
& bmask
) &&
433 (error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
))) {
437 endsearch
= dp
->i_size
;
439 while (idp
->curroff
< endsearch
) {
441 * If offset is on a block boundary,
442 * read the next directory block.
443 * Release previous if it exists.
445 if ((idp
->curroff
& bmask
) == 0) {
448 if ((error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
)))
450 entryoffsetinblock
= 0;
453 * Get pointer to next entry.
455 ep
= (struct iso_directory_record
*)
456 (buf_dataptr(bp
) + entryoffsetinblock
);
458 reclen
= isonum_711(ep
->length
);
460 /* skip to next block, if any */
462 (idp
->curroff
& ~bmask
) + imp
->im_sector_size
;
466 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
) {
468 /* illegal entry, stop */
472 if (entryoffsetinblock
+ reclen
> imp
->im_sector_size
) {
474 /* illegal directory, so stop looking */
478 idp
->current
.d_namlen
= isonum_711(ep
->name_len
);
480 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
+ idp
->current
.d_namlen
) {
482 /* illegal entry, stop */
487 * Some poorly mastered discs have an incorrect directory
488 * file size. If the '.' entry has a better size (bigger)
489 * then use that instead.
491 if ((uio
->uio_offset
== 0) && (isonum_733(ep
->size
) > endsearch
)) {
492 dp
->i_size
= endsearch
= isonum_733(ep
->size
);
495 if ( isonum_711(ep
->flags
) & directoryBit
)
496 idp
->current
.d_fileno
= isodirino(ep
, imp
);
498 idp
->current
.d_fileno
= ((daddr_t
)buf_blkno(bp
) << imp
->im_bshift
) +
502 idp
->curroff
+= reclen
;
504 switch (imp
->iso_ftype
) {
506 cd9660_rrip_getname(ep
,idp
->current
.d_name
, &namelen
,
507 &idp
->current
.d_fileno
,imp
);
508 idp
->current
.d_namlen
= (u_char
)namelen
;
509 if (idp
->current
.d_namlen
)
510 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
513 case ISO_FTYPE_JOLIET
:
514 ucsfntrans((u_int16_t
*)ep
->name
, idp
->current
.d_namlen
,
515 idp
->current
.d_name
, &namelen
,
516 isonum_711(ep
->flags
) & directoryBit
,
517 isonum_711(ep
->flags
) & associatedBit
);
518 idp
->current
.d_namlen
= (u_char
)namelen
;
519 if (idp
->current
.d_namlen
)
520 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
523 default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
524 strcpy(idp
->current
.d_name
,"..");
525 switch (ep
->name
[0]) {
527 idp
->current
.d_namlen
= 1;
528 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
531 idp
->current
.d_namlen
= 2;
532 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
535 isofntrans(ep
->name
,idp
->current
.d_namlen
,
536 idp
->current
.d_name
, &namelen
,
537 imp
->iso_ftype
== ISO_FTYPE_9660
,
538 isonum_711(ep
->flags
) & associatedBit
);
539 idp
->current
.d_namlen
= (u_char
)namelen
;
540 if (imp
->iso_ftype
== ISO_FTYPE_DEFAULT
)
541 error
= iso_shipdir(idp
);
543 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
550 entryoffsetinblock
+= reclen
;
553 if (!error
&& imp
->iso_ftype
== ISO_FTYPE_DEFAULT
) {
554 idp
->current
.d_namlen
= 0;
555 error
= iso_shipdir(idp
);
558 if (!error
&& ap
->a_ncookies
) {
559 struct dirent
*dirp
, *dpstart
;
565 * Only the NFS server uses cookies, and it loads the
566 * directory block into system space, so we can just look at
569 * We assume the entire transfer is done to a single contiguous buffer.
571 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
) || uio
->uio_iovcnt
!= 1)
572 panic("ufs_readdir: lost in space");
575 * Make a first pass over the buffer just generated,
576 * counting the number of entries:
578 // LP64todo - fix this!
579 dpstart
= (struct dirent
*)
580 CAST_DOWN(caddr_t
, (uio_iov_base(uio
) - (uio
->uio_offset
- startingOffset
)));
581 for (dirp
= dpstart
, bufferOffset
= startingOffset
, ncookies
= 0;
582 bufferOffset
< uio
->uio_offset
; ) {
583 if (dirp
->d_reclen
== 0)
585 bufferOffset
+= dirp
->d_reclen
;
587 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
589 lost
+= uio
->uio_offset
- bufferOffset
;
590 uio
->uio_offset
= bufferOffset
;
593 * Allocate a buffer to hold the cookies requested:
595 MALLOC(cookies
, u_long
*, ncookies
* sizeof(u_long
), M_TEMP
, M_WAITOK
);
596 *ap
->a_ncookies
= ncookies
;
597 *ap
->a_cookies
= cookies
;
600 * Fill in the offsets for each entry in the buffer just allocated:
602 for (bufferOffset
= startingOffset
, dirp
= dpstart
; bufferOffset
< uio
->uio_offset
; ) {
603 *(cookies
++) = bufferOffset
;
604 bufferOffset
+= dirp
->d_reclen
;
605 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
615 uio
->uio_offset
= idp
->uio_off
;
616 *ap
->a_eofflag
= idp
->eofflag
;
624 * Return target name of a symbolic link
625 * Shouldn't we get the parent vnode and read the data from there?
626 * This could eventually result in deadlocks in cd9660_lookup.
627 * But otherwise the block read here is in the block buffer two times.
629 typedef struct iso_directory_record ISODIR
;
630 typedef struct iso_node ISONODE
;
631 typedef struct iso_mnt ISOMNT
;
633 cd9660_readlink(struct vnop_readlink_args
*ap
)
648 if (imp
->iso_ftype
!= ISO_FTYPE_RRIP
)
652 * Get parents directory record block that this inode included.
654 error
= (int)buf_bread(imp
->im_devvp
,
655 (daddr64_t
)((unsigned)(ip
->i_number
>> imp
->im_bshift
)),
656 imp
->logical_block_size
, NOCRED
, &bp
);
663 * Setup the directory pointer for this inode
665 dirp
= (ISODIR
*)(buf_dataptr(bp
) + (ip
->i_number
& imp
->im_bmask
));
668 * Just make sure, we have a right one....
669 * 1: Check not cross boundary on block
671 if ((ip
->i_number
& imp
->im_bmask
) + isonum_711(dirp
->length
)
672 > imp
->logical_block_size
) {
679 * Abuse a namei buffer for now.
681 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
682 MALLOC_ZONE(symname
, char *, MAXPATHLEN
, M_NAMEI
, M_WAITOK
);
684 // LP64todo - fix this!
685 symname
= CAST_DOWN(caddr_t
, uio_iov_base(uio
));
688 * Ok, we just gathering a symbolic name in SL record.
690 if (cd9660_rrip_getsymname(dirp
, symname
, &symlen
, imp
) == 0) {
691 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
692 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
697 * Don't forget before you leave from home ;-)
702 * return with the symbolic name to caller's.
704 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
)) {
705 error
= uiomove(symname
, symlen
, uio
);
706 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
710 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
711 uio_iov_len_add(uio
, -((int64_t)symlen
));
713 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
714 uio_iov_len_add(uio
, -((int)symlen
));
716 uio_iov_base_add(uio
, symlen
);
722 * prepare and issue the I/O
725 cd9660_strategy(struct vnop_strategy_args
*ap
)
728 vnode_t vp
= buf_vnode(bp
);
729 struct iso_node
*ip
= VTOI(vp
);
731 return (buf_strategy(ip
->i_devvp
, ap
));
736 * Return POSIX pathconf information applicable to cd9660 filesystems.
739 cd9660_pathconf(struct vnop_pathconf_args
*ap
)
742 switch (ap
->a_name
) {
747 switch (VTOI(ap
->a_vp
)->i_mnt
->iso_ftype
) {
749 *ap
->a_retval
= ISO_RRIP_NAMEMAX
;
751 case ISO_FTYPE_JOLIET
:
752 *ap
->a_retval
= ISO_JOLIET_NAMEMAX
;
755 *ap
->a_retval
= ISO_NAMEMAX
;
759 *ap
->a_retval
= PATH_MAX
;
762 *ap
->a_retval
= PIPE_BUF
;
764 case _PC_CHOWN_RESTRICTED
:
777 * Unsupported operation
780 cd9660_enotsupp(void)
784 /* Pagein. similar to read */
786 cd9660_pagein(struct vnop_pagein_args
*ap
)
788 struct vnode
*vp
= ap
->a_vp
;
790 size_t size
= ap
->a_size
;
791 off_t f_offset
= ap
->a_f_offset
;
792 vm_offset_t pl_offset
= ap
->a_pl_offset
;
793 int flags
= ap
->a_flags
;
794 register struct iso_node
*ip
= VTOI(vp
);
798 * Copy the Apple Double header.
800 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (f_offset
== 0) && (size
== ADH_SIZE
)) {
801 apple_double_header_t header
;
805 kret
= ubc_upl_map(pl
, &ioaddr
);
806 if (kret
!= KERN_SUCCESS
)
807 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
809 bzero((caddr_t
)ioaddr
, ADH_SIZE
);
811 header
.magic
= APPLEDOUBLE_MAGIC
;
812 header
.version
= APPLEDOUBLE_VERSION
;
814 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
815 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
816 header
.entries
[0].length
= 32;
817 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
818 header
.entries
[1].offset
= ADH_SIZE
;
819 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
820 header
.finfo
.fdType
= ip
->i_FileType
;
821 header
.finfo
.fdCreator
= ip
->i_Creator
;
822 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
823 header
.finfo
.fdLocation
.v
= -1;
824 header
.finfo
.fdLocation
.h
= -1;
825 header
.finfo
.fdReserved
= 0;
827 bcopy((caddr_t
)&header
, (caddr_t
)ioaddr
, sizeof(apple_double_header_t
));
829 kret
= ubc_upl_unmap(pl
);
830 if (kret
!= KERN_SUCCESS
)
831 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
833 if ((flags
& UPL_NOCOMMIT
) == 0) {
834 ubc_upl_commit_range(pl
, pl_offset
, size
, UPL_COMMIT_FREE_ON_EMPTY
);
837 /* check pageouts are for reg file only and ubc info is present*/
839 panic("cd9660_pagein: Not a VREG");
840 UBCINFOCHECK("cd9660_pagein", vp
);
842 error
= cluster_pagein(vp
, pl
, pl_offset
, f_offset
, size
,
843 (off_t
)ip
->i_size
, flags
);
849 * cd9660_remove - not possible to remove a file from iso cds
851 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
854 cd9660_remove(__unused
struct vnop_remove_args
*ap
)
861 * cd9660_rmdir - not possible to remove a directory from iso cds
863 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
866 cd9660_rmdir(struct vnop_rmdir_args
*ap
)
868 (void) nop_rmdir(ap
);
875 #% getattrlist vp = = =
879 IN struct attrlist *alist;
880 INOUT struct uio *uio;
881 IN vfs_context_t context;
886 cd9660_getattrlist(struct vnop_getattrlist_args
*ap
)
888 struct attrlist
*alist
= ap
->a_alist
;
897 if ((alist
->bitmapcount
!= ATTR_BIT_MAP_COUNT
) ||
898 ((alist
->commonattr
& ~ATTR_CMN_VALIDMASK
) != 0) ||
899 ((alist
->volattr
& ~ATTR_VOL_VALIDMASK
) != 0) ||
900 ((alist
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) ||
901 ((alist
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) ||
902 ((alist
->forkattr
& ~ATTR_FORK_VALIDMASK
) != 0)) {
907 * Requesting volume information requires setting the ATTR_VOL_INFO bit and
908 * volume info requests are mutually exclusive with all other info requests:
910 if ((alist
->volattr
!= 0) &&
911 (((alist
->volattr
& ATTR_VOL_INFO
) == 0) ||
912 (alist
->dirattr
!= 0) ||
913 (alist
->fileattr
!= 0) ||
914 (alist
->forkattr
!= 0) )) {
919 * Reject requests for unsupported options for now:
921 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) return EINVAL
;
922 if (alist
->commonattr
& (ATTR_CMN_NAMEDATTRCOUNT
| ATTR_CMN_NAMEDATTRLIST
)) return EINVAL
;
923 if (alist
->fileattr
&
924 (ATTR_FILE_FILETYPE
|
925 ATTR_FILE_FORKCOUNT
|
927 ATTR_FILE_DATAEXTENTS
|
928 ATTR_FILE_RSRCEXTENTS
)) {
933 fixedblocksize
= attrcalcsize(alist
);
934 attrblocksize
= fixedblocksize
+ (sizeof(uint32_t)); /* uint32_t for length word */
935 if (alist
->commonattr
& ATTR_CMN_NAME
) attrblocksize
+= NAME_MAX
;
936 if (alist
->commonattr
& ATTR_CMN_NAMEDATTRLIST
) attrblocksize
+= 0; /* XXX PPD */
937 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) attrblocksize
+= PATH_MAX
;
938 if (alist
->volattr
& ATTR_VOL_NAME
) attrblocksize
+= NAME_MAX
;
939 if (alist
->fileattr
& ATTR_FILE_FORKLIST
) attrblocksize
+= 0; /* XXX PPD */
941 attrbufsize
= MIN(uio_resid(ap
->a_uio
), attrblocksize
);
942 MALLOC(attrbufptr
, void *, attrblocksize
, M_TEMP
, M_WAITOK
);
943 attrptr
= attrbufptr
;
944 *((uint32_t *)attrptr
) = 0; /* Set buffer length in case of errors */
945 ++((uint32_t *)attrptr
); /* Reserve space for length field */
946 varptr
= ((char *)attrptr
) + fixedblocksize
; /* Point to variable-length storage */
948 packattrblk(alist
, ap
->a_vp
, &attrptr
, &varptr
);
950 /* Store length of fixed + var block */
951 *((uint32_t *)attrbufptr
) = ((char*)varptr
- (char*)attrbufptr
);
952 /* Don't copy out more data than was generated */
953 attrbufsize
= MIN(attrbufsize
, (char*)varptr
- (char*)attrbufptr
);
955 error
= uiomove((caddr_t
)attrbufptr
, attrbufsize
, ap
->a_uio
);
957 FREE(attrbufptr
, M_TEMP
);
963 * Make a RIFF file header for a CD-ROM XA media file.
965 __private_extern__
void
966 cd9660_xa_init(struct iso_node
*ip
, struct iso_directory_record
*isodir
)
969 struct riff_header
*header
;
973 MALLOC(header
, struct riff_header
*, sizeof(struct riff_header
), M_TEMP
, M_WAITOK
);
975 sectors
= ip
->i_size
/ 2048;
977 strncpy(header
->riff
, "RIFF", 4);
978 header
->fileSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
) - 8);
979 strncpy(header
->cdxa
, "CDXA", 4);
980 strncpy(header
->fmt
, "fmt ", 4);
981 header
->fmtSize
= NXSwapHostLongToLittle(16);
982 strncpy(header
->data
, "data", 4);
983 header
->dataSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
);
986 * Copy the CD-ROM XA extended directory information into the header. As far as
987 * I can tell, it's always 14 bytes in the directory record, but allocated 16 bytes
988 * in the header (the last two being zeroed pad bytes).
990 name_len
= isonum_711(isodir
->name_len
);
991 cdxa
= &isodir
->name
[name_len
];
992 if ((name_len
& 0x01) == 0)
993 ++cdxa
; /* Skip pad byte */
994 bcopy(cdxa
, header
->fmtData
, 14);
995 header
->fmtData
[14] = 0;
996 header
->fmtData
[15] = 0;
999 * Point this i-node to the "whole sector" device instead of the normal
1000 * device. This allows cd9660_strategy to be ignorant of the block
1003 ip
->i_devvp
= ip
->i_mnt
->phys_devvp
;
1005 ip
->i_size
= sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
);
1006 ip
->i_riff
= header
;
1010 * Helper routine for vnop_read and vnop_pagein of CD-ROM XA multimedia files.
1011 * This routine determines the physical location of the file, then reads
1012 * sectors directly from the device into a buffer. It also handles inserting
1013 * the RIFF header at the beginning of the file.
1015 * Exactly one of buffer or uio must be non-zero. It will either bcopy to
1016 * buffer, or uiomove via uio.
1018 * XXX Should this code be using buf_breadn and ip->i_lastr to support single-block
1019 * read-ahead? Should we try more aggressive read-ahead like cluster_io does?
1021 * XXX This could be made to do larger I/O to the device (reading all the
1022 * whole sectors directly into the buffer). That would make the code more
1023 * complex, and the current code only adds 2.5% overhead compared to reading
1024 * from the device directly (at least on my test machine).
1027 cd9660_xa_read_common(
1034 struct iso_node
*ip
= VTOI(vp
);
1036 off_t diff
; /* number of bytes from offset to file's EOF */
1037 daddr_t block
; /* physical disk block containing offset */
1038 off_t sect_off
; /* starting offset into current sector */
1039 u_int count
; /* number of bytes to transfer in current block */
1043 * Copy any part of the RIFF header.
1045 if (offset
< sizeof(struct riff_header
)) {
1048 p
= ((char *) ip
->i_riff
) + offset
;
1049 count
= min(amount
, sizeof(struct riff_header
) - offset
);
1051 bcopy(p
, buffer
, count
);
1054 error
= uiomove(p
, count
, uio
);
1063 * Loop over (possibly partial) blocks to transfer.
1065 while (error
== 0 && amount
> 0) {
1067 * Determine number of bytes until EOF. If we've hit
1070 diff
= ip
->i_size
- offset
;
1074 /* Get a block from the underlying device */
1075 block
= ip
->iso_start
+ (offset
- sizeof(struct riff_header
))/CDXA_SECTOR_SIZE
;
1076 error
= (int)buf_bread(ip
->i_devvp
, (daddr64_t
)((unsigned)block
), CDXA_SECTOR_SIZE
, NOCRED
, &bp
);
1081 if (buf_resid(bp
)) {
1082 printf("isofs: cd9660_xa_read_common: buf_bread didn't read full sector\n");
1086 /* Figure out which part of the block to copy, and copy it */
1087 sect_off
= (offset
- sizeof(struct riff_header
)) % CDXA_SECTOR_SIZE
;
1088 count
= min(CDXA_SECTOR_SIZE
-sect_off
, amount
);
1089 if (diff
< count
) /* Pin transfer amount to EOF */
1093 bcopy(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), buffer
, count
);
1096 error
= uiomove(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), count
, uio
);
1102 * If we copied through the end of the block, or the end of file, then
1103 * age the device block. This is optimized for sequential access.
1105 if (sect_off
+count
== CDXA_SECTOR_SIZE
|| offset
== (off_t
)ip
->i_size
)
1114 * Read from a CD-ROM XA multimedia file.
1116 * This uses the same common routine as pagein for doing the actual read
1119 * This routine doesn't do any caching beyond what the block device does.
1120 * Even then, cd9660_xa_read_common ages the blocks once we read up to
1123 * We don't even take advantage if the file has been memory mapped and has
1124 * valid pages already (in which case we could just uiomove from the page
1125 * to the caller). Since we're a read-only filesystem, there can't be
1126 * any cache coherency problems. Multimedia files are expected to be
1127 * large and streamed anyway, so caching file contents probably isn't
1131 cd9660_xa_read(struct vnop_read_args
*ap
)
1133 struct vnode
*vp
= ap
->a_vp
;
1134 register struct uio
*uio
= ap
->a_uio
;
1135 register struct iso_node
*ip
= VTOI(vp
);
1136 off_t offset
= uio
->uio_offset
;
1137 // LP64todo - fix this!
1138 size_t size
= uio_resid(uio
);
1140 /* Check for some obvious parameter problems */
1145 if (offset
>= ip
->i_size
)
1148 /* Pin the size of the read to the file's EOF */
1149 if (offset
+ size
> ip
->i_size
)
1150 size
= ip
->i_size
- offset
;
1152 return cd9660_xa_read_common(vp
, offset
, size
, NULL
, uio
);
1156 * Page in from a CD-ROM XA media file.
1158 * Since our device block size isn't a power of two, we can't use
1159 * cluster_pagein. Instead, we have to map the page and read into it.
1162 cd9660_xa_pagein(struct vnop_pagein_args
*ap
)
1164 struct vnode
*vp
= ap
->a_vp
;
1165 upl_t pl
= ap
->a_pl
;
1166 size_t size
= ap
->a_size
;
1167 off_t f_offset
= ap
->a_f_offset
;
1168 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1169 int flags
= ap
->a_flags
;
1170 register struct iso_node
*ip
= VTOI(vp
);
1175 /* check pageins are for reg file only and ubc info is present*/
1177 panic("cd9660_xa_pagein: Not a VREG");
1178 UBCINFOCHECK("cd9660_xa_pagein", vp
);
1181 panic("cd9660_xa_pagein: size = %d", size
);
1183 kret
= ubc_upl_map(pl
, &ioaddr
);
1184 if (kret
!= KERN_SUCCESS
)
1185 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1187 ioaddr
+= pl_offset
;
1189 /* Make sure pagein doesn't extend past EOF */
1190 if (f_offset
+ size
> ip
->i_size
)
1191 size
= ip
->i_size
- f_offset
; /* pin size to EOF */
1193 /* Read the data in using the underlying device */
1194 error
= cd9660_xa_read_common(vp
, f_offset
, size
, (caddr_t
)ioaddr
, NULL
);
1196 /* Zero fill part of page past EOF */
1197 if (ap
->a_size
> size
)
1198 bzero((caddr_t
)ioaddr
+size
, ap
->a_size
-size
);
1200 kret
= ubc_upl_unmap(pl
);
1201 if (kret
!= KERN_SUCCESS
)
1202 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1204 if ((flags
& UPL_NOCOMMIT
) == 0)
1207 ubc_upl_abort_range(pl
, pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
);
1209 ubc_upl_commit_range(pl
, pl_offset
, ap
->a_size
, UPL_COMMIT_FREE_ON_EMPTY
);
1216 * Global vfs data structures for isofs
1218 #define cd9660_create \
1219 ((int (*)(struct vnop_create_args *))err_create)
1220 #define cd9660_mknod ((int (*)(struct vnop_mknod_args *))err_mknod)
1221 #define cd9660_write ((int (*)(struct vnop_write_args *))cd9660_enotsupp)
1222 #define cd9660_fsync ((int (*)(struct vnop_fsync_args *))nullop)
1223 #define cd9660_rename \
1224 ((int (*)(struct vnop_rename_args *))err_rename)
1225 #define cd9660_copyfile \
1226 ((int (*)(struct vnop_copyfile_args *))err_copyfile)
1227 #define cd9660_link ((int (*)(struct vnop_link_args *))err_link)
1228 #define cd9660_mkdir ((int (*)(struct vnop_mkdir_args *))err_mkdir)
1229 #define cd9660_symlink \
1230 ((int (*)(struct vnop_symlink_args *))err_symlink)
1231 #define cd9660_advlock \
1232 ((int (*)(struct vnop_advlock_args *))cd9660_enotsupp)
1233 #define cd9660_bwrite \
1234 ((int (*)(struct vnop_bwrite_args *))cd9660_enotsupp)
1235 #define cd9660_pageout \
1236 ((int (*)(struct vnop_pageout_args *))cd9660_enotsupp)
1237 int cd9660_blktooff(struct vnop_blktooff_args
*ap
);
1238 int cd9660_offtoblk(struct vnop_offtoblk_args
*ap
);
1239 int cd9660_blockmap(struct vnop_blockmap_args
*ap
);
1241 #define VOPFUNC int (*)(void *)
1243 * Global vfs data structures for cd9660
1245 int (**cd9660_vnodeop_p
)(void *);
1246 struct vnodeopv_entry_desc cd9660_vnodeop_entries
[] = {
1247 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1248 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1249 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1250 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1251 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1252 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1253 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1254 { &vnop_read_desc
, (VOPFUNC
)cd9660_read
}, /* read */
1255 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1256 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1257 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1258 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1259 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1260 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1261 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1262 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1263 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1264 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1265 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1266 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1267 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1268 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1269 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1270 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1271 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1272 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1273 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1274 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1275 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1276 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1277 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1278 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1279 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1280 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1281 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1283 struct vnodeopv_desc cd9660_vnodeop_opv_desc
=
1284 { &cd9660_vnodeop_p
, cd9660_vnodeop_entries
};
1287 * The VOP table for CD-ROM XA (media) files is almost the same
1288 * as for ordinary files, except for read, and pagein.
1289 * Note that cd9660_xa_read doesn't use cluster I/O, so blockmap
1290 * isn't needed, and isn't implemented. Similarly, it doesn't
1291 * do buf_bread() on CD XA vnodes, so bmap, blktooff, offtoblk
1294 int (**cd9660_cdxaop_p
)(void *);
1295 struct vnodeopv_entry_desc cd9660_cdxaop_entries
[] = {
1296 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1297 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1298 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1299 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1300 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1301 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1302 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1303 { &vnop_read_desc
, (VOPFUNC
)cd9660_xa_read
}, /* read */
1304 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1305 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1306 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1307 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1308 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1309 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1310 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1311 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1312 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1313 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1314 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1315 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1316 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1317 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1318 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1319 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1320 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1321 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1322 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1323 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1324 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_xa_pagein
}, /* Pagein */
1325 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1326 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1327 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1329 struct vnodeopv_desc cd9660_cdxaop_opv_desc
=
1330 { &cd9660_cdxaop_p
, cd9660_cdxaop_entries
};
1333 * Special device vnode ops
1335 int (**cd9660_specop_p
)(void *);
1336 struct vnodeopv_entry_desc cd9660_specop_entries
[] = {
1337 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1338 { &vnop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
1339 { &vnop_create_desc
, (VOPFUNC
)spec_create
}, /* create */
1340 { &vnop_mknod_desc
, (VOPFUNC
)spec_mknod
}, /* mknod */
1341 { &vnop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
1342 { &vnop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
1343 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1344 { &vnop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
1345 { &vnop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
1346 { &vnop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
1347 { &vnop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
1348 { &vnop_mmap_desc
, (VOPFUNC
)spec_mmap
}, /* mmap */
1349 { &vnop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
1350 { &vnop_remove_desc
, (VOPFUNC
)spec_remove
}, /* remove */
1351 { &vnop_link_desc
, (VOPFUNC
)spec_link
}, /* link */
1352 { &vnop_rename_desc
, (VOPFUNC
)spec_rename
}, /* rename */
1353 { &vnop_mkdir_desc
, (VOPFUNC
)spec_mkdir
}, /* mkdir */
1354 { &vnop_rmdir_desc
, (VOPFUNC
)spec_rmdir
}, /* rmdir */
1355 { &vnop_symlink_desc
, (VOPFUNC
)spec_symlink
}, /* symlink */
1356 { &vnop_readdir_desc
, (VOPFUNC
)spec_readdir
}, /* readdir */
1357 { &vnop_readlink_desc
, (VOPFUNC
)spec_readlink
}, /* readlink */
1358 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1359 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1360 { &vnop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
1361 { &vnop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
1362 { &vnop_advlock_desc
, (VOPFUNC
)spec_advlock
}, /* advlock */
1363 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1364 { &vnop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
1365 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1366 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1367 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1368 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1369 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1370 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1372 struct vnodeopv_desc cd9660_specop_opv_desc
=
1373 { &cd9660_specop_p
, cd9660_specop_entries
};
1376 int (**cd9660_fifoop_p
)(void *);
1377 struct vnodeopv_entry_desc cd9660_fifoop_entries
[] = {
1378 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1379 { &vnop_lookup_desc
, (VOPFUNC
)fifo_lookup
}, /* lookup */
1380 { &vnop_create_desc
, (VOPFUNC
)fifo_create
}, /* create */
1381 { &vnop_mknod_desc
, (VOPFUNC
)fifo_mknod
}, /* mknod */
1382 { &vnop_open_desc
, (VOPFUNC
)fifo_open
}, /* open */
1383 { &vnop_close_desc
, (VOPFUNC
)fifo_close
}, /* close */
1384 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1385 { &vnop_read_desc
, (VOPFUNC
)fifo_read
}, /* read */
1386 { &vnop_write_desc
, (VOPFUNC
)fifo_write
}, /* write */
1387 { &vnop_ioctl_desc
, (VOPFUNC
)fifo_ioctl
}, /* ioctl */
1388 { &vnop_select_desc
, (VOPFUNC
)fifo_select
}, /* select */
1389 { &vnop_mmap_desc
, (VOPFUNC
)fifo_mmap
}, /* mmap */
1390 { &vnop_fsync_desc
, (VOPFUNC
)fifo_fsync
}, /* fsync */
1391 { &vnop_remove_desc
, (VOPFUNC
)fifo_remove
}, /* remove */
1392 { &vnop_link_desc
, (VOPFUNC
)fifo_link
} , /* link */
1393 { &vnop_rename_desc
, (VOPFUNC
)fifo_rename
}, /* rename */
1394 { &vnop_mkdir_desc
, (VOPFUNC
)fifo_mkdir
}, /* mkdir */
1395 { &vnop_rmdir_desc
, (VOPFUNC
)fifo_rmdir
}, /* rmdir */
1396 { &vnop_symlink_desc
, (VOPFUNC
)fifo_symlink
}, /* symlink */
1397 { &vnop_readdir_desc
, (VOPFUNC
)fifo_readdir
}, /* readdir */
1398 { &vnop_readlink_desc
, (VOPFUNC
)fifo_readlink
}, /* readlink */
1399 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1400 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1401 { &vnop_strategy_desc
, (VOPFUNC
)fifo_strategy
}, /* strategy */
1402 { &vnop_pathconf_desc
, (VOPFUNC
)fifo_pathconf
}, /* pathconf */
1403 { &vnop_advlock_desc
, (VOPFUNC
)fifo_advlock
}, /* advlock */
1404 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1405 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1406 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1407 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1408 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1409 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1411 struct vnodeopv_desc cd9660_fifoop_opv_desc
=
1412 { &cd9660_fifoop_p
, cd9660_fifoop_entries
};