2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* $NetBSD: cd9660_vnops.c,v 1.22 1994/12/27 19:05:12 mycroft Exp $ */
32 * The Regents of the University of California. All rights reserved.
34 * This code is derived from software contributed to Berkeley
35 * by Pace Willisson (pace@blitz.com). The Rock Ridge Extension
36 * Support code is derived from software contributed to Berkeley
37 * by Atsushi Murai (amurai@spec.co.jp).
39 * Redistribution and use in source and binary forms, with or without
40 * modification, are permitted provided that the following conditions
42 * 1. Redistributions of source code must retain the above copyright
43 * notice, this list of conditions and the following disclaimer.
44 * 2. Redistributions in binary form must reproduce the above copyright
45 * notice, this list of conditions and the following disclaimer in the
46 * documentation and/or other materials provided with the distribution.
47 * 3. All advertising materials mentioning features or use of this software
48 * must display the following acknowledgement:
49 * This product includes software developed by the University of
50 * California, Berkeley and its contributors.
51 * 4. Neither the name of the University nor the names of its contributors
52 * may be used to endorse or promote products derived from this software
53 * without specific prior written permission.
55 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
56 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
57 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
58 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
59 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
60 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
61 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
62 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
63 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
64 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 * @(#)cd9660_vnops.c 8.15 (Berkeley) 12/5/94
70 * 02-Feb-00 chw Add cd9660_copyfile to return error
71 * 29-Sep-98 djb Add cd9660_getattrlist VOP for VDI support.
72 * 15-sep-98 added cd9660_rmdir to do proper unlocking - chw
73 * 12-aug-98 added cd9660_remove which will do proper unlocking - chw
74 * 17-Feb-98 radar 1669467 - changed lock protocols to use the lock manager - chw
75 * 22-Jan-98 radar 1669467 - ISO 9660 CD support - jwc
78 #include <sys/param.h>
79 #include <sys/systm.h>
80 #include <sys/vnode.h>
81 #include <sys/mount.h>
82 #include <sys/namei.h>
83 #include <sys/resourcevar.h>
84 #include <sys/kernel.h>
89 #include <sys/kauth.h>
91 #include <miscfs/specfs/specdev.h>
92 #include <miscfs/fifofs/fifo.h>
93 #include <sys/malloc.h>
96 #include <vfs/vfs_support.h>
97 #include <vm/vm_kern.h>
100 #include <sys/ubc_internal.h>
101 #include <sys/uio_internal.h>
102 #include <architecture/byte_order.h>
104 #include <vm/vm_map.h>
105 #include <vm/vm_kern.h> /* kmem_alloc, kmem_free */
107 #include <isofs/cd9660/iso.h>
108 #include <isofs/cd9660/cd9660_node.h>
109 #include <isofs/cd9660/iso_rrip.h>
117 cd9660_open(__unused
struct vnop_open_args
*ap
)
125 * Update the times on the inode on writeable file systems.
128 cd9660_close(__unused
struct vnop_close_args
*ap
)
134 cd9660_getattr(struct vnop_getattr_args
*ap
)
136 struct vnode
*vp
= ap
->a_vp
;
137 register struct vnode_attr
*vap
= ap
->a_vap
;
138 register struct iso_node
*ip
= VTOI(vp
);
140 VATTR_RETURN(vap
, va_fsid
, ip
->i_dev
);
141 VATTR_RETURN(vap
, va_fileid
, ip
->i_number
);
143 VATTR_RETURN(vap
, va_mode
, ip
->inode
.iso_mode
);
144 VATTR_RETURN(vap
, va_nlink
, ip
->inode
.iso_links
);
145 VATTR_RETURN(vap
, va_uid
, ip
->inode
.iso_uid
);
146 VATTR_RETURN(vap
, va_gid
, ip
->inode
.iso_gid
);
147 VATTR_RETURN(vap
, va_access_time
, ip
->inode
.iso_atime
);
148 VATTR_RETURN(vap
, va_modify_time
, ip
->inode
.iso_mtime
);
149 VATTR_RETURN(vap
, va_change_time
, ip
->inode
.iso_ctime
);
150 VATTR_RETURN(vap
, va_rdev
, ip
->inode
.iso_rdev
);
152 VATTR_RETURN(vap
, va_data_size
, (off_t
)ip
->i_size
);
153 if (ip
->i_size
== 0 && (vap
->va_mode
& S_IFMT
) == S_IFLNK
) {
154 struct vnop_readlink_args rdlnk
;
156 char uio_buf
[ UIO_SIZEOF(1) ];
159 MALLOC(cp
, char *, MAXPATHLEN
, M_TEMP
, M_WAITOK
);
160 auio
= uio_createwithbuffer(1, 0, UIO_SYSSPACE
, UIO_READ
,
161 &uio_buf
[0], sizeof(uio_buf
));
162 uio_addiov(auio
, CAST_USER_ADDR_T(cp
), MAXPATHLEN
);
165 rdlnk
.a_vp
= ap
->a_vp
;
166 rdlnk
.a_context
= ap
->a_context
;
167 if (cd9660_readlink(&rdlnk
) == 0)
168 // LP64todo - fix this!
169 VATTR_RETURN(vap
, va_data_size
, MAXPATHLEN
- uio_resid(auio
));
172 VATTR_RETURN(vap
, va_flags
, 0);
173 VATTR_RETURN(vap
, va_gen
, 1);
174 VATTR_RETURN(vap
, va_iosize
, ip
->i_mnt
->logical_block_size
);
175 VATTR_RETURN(vap
, va_total_size
, ip
->i_size
+ ip
->i_rsrcsize
);
182 * Vnode op for reading.
185 cd9660_read(struct vnop_read_args
*ap
)
187 struct vnode
*vp
= ap
->a_vp
;
188 register struct uio
*uio
= ap
->a_uio
;
189 register struct iso_node
*ip
= VTOI(vp
);
190 register struct iso_mnt
*imp
;
195 int rasize
, error
= 0;
198 if (uio_resid(uio
) == 0)
200 if (uio
->uio_offset
< 0)
205 if (UBCINFOEXISTS(vp
)) {
207 * Copy any part of the Apple Double header.
209 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (uio
->uio_offset
< ADH_SIZE
)) {
210 apple_double_header_t header
;
213 if (uio
->uio_offset
< sizeof(apple_double_header_t
)) {
214 header
.magic
= APPLEDOUBLE_MAGIC
;
215 header
.version
= APPLEDOUBLE_VERSION
;
217 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
218 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
219 header
.entries
[0].length
= 32;
220 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
221 header
.entries
[1].offset
= ADH_SIZE
;
222 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
223 header
.finfo
.fdType
= ip
->i_FileType
;
224 header
.finfo
.fdCreator
= ip
->i_Creator
;
225 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
226 header
.finfo
.fdLocation
.v
= -1;
227 header
.finfo
.fdLocation
.h
= -1;
228 header
.finfo
.fdReserved
= 0;
230 bytes
= min(uio_resid(uio
), sizeof(apple_double_header_t
) - uio
->uio_offset
);
231 error
= uiomove(((char *) &header
) + uio
->uio_offset
, bytes
, uio
);
235 if (uio_resid(uio
) && uio
->uio_offset
< ADH_SIZE
) {
238 if (kmem_alloc(kernel_map
, (vm_offset_t
*)&buffer
, ADH_SIZE
)) {
241 bytes
= min(uio_resid(uio
), ADH_SIZE
- uio
->uio_offset
);
242 error
= uiomove(((char *) buffer
) + uio
->uio_offset
, bytes
, uio
);
243 kmem_free(kernel_map
, (vm_offset_t
)buffer
, ADH_SIZE
);
248 if (uio_resid(uio
) > 0)
249 error
= cluster_read(vp
, uio
, (off_t
)ip
->i_size
, 0);
253 lbn
= lblkno(imp
, uio
->uio_offset
);
254 on
= blkoff(imp
, uio
->uio_offset
);
255 n
= min((u_int
)(imp
->logical_block_size
- on
),
257 diff
= (off_t
)ip
->i_size
- uio
->uio_offset
;
262 size
= blksize(imp
, ip
, lbn
);
263 rablock
= (daddr64_t
)lbn
+ 1;
265 if (ip
->i_lastr
+ 1 == lbn
&&
266 lblktosize(imp
, rablock
) < ip
->i_size
) {
267 rasize
= blksize(imp
, ip
, (daddr_t
)rablock
);
268 error
= (int)buf_breadn(vp
, (daddr64_t
)((unsigned)lbn
), size
, &rablock
,
269 &rasize
, 1, NOCRED
, &bp
);
271 error
= (int)buf_bread(vp
, (daddr64_t
)((unsigned)lbn
), size
, NOCRED
, &bp
);
274 n
= min(n
, size
- buf_resid(bp
));
280 error
= uiomove((caddr_t
)(buf_dataptr(bp
) + on
), (int)n
, uio
);
281 if (n
+ on
== imp
->logical_block_size
||
282 uio
->uio_offset
== (off_t
)ip
->i_size
)
285 } while (error
== 0 && uio_resid(uio
) > 0 && n
!= 0);
292 cd9660_ioctl(__unused
struct vnop_ioctl_args
*ap
)
298 cd9660_select(__unused
struct vnop_select_args
*ap
)
301 * We should really check to see if I/O is possible.
309 * NB Currently unsupported.
312 cd9660_mmap(__unused
struct vnop_mmap_args
*ap
)
319 * Structure for reading directories
322 struct dirent saveent
;
323 struct dirent current
;
334 iso_uiodir(struct isoreaddir
*idp
, struct dirent
*dp
, off_t off
)
338 dp
->d_name
[dp
->d_namlen
] = 0;
339 dp
->d_reclen
= DIRSIZ(dp
);
341 if (uio_resid(idp
->uio
) < dp
->d_reclen
) {
348 if (*idp
->ncookies
<= 0) {
353 **idp
->cookies
++ = off
;
358 if ( (error
= uiomove( (caddr_t
)dp
, dp
->d_reclen
, idp
->uio
)) )
365 iso_shipdir(struct isoreaddir
*idp
)
372 cl
= idp
->current
.d_namlen
;
373 cname
= idp
->current
.d_name
;
380 || bcmp(sname
,cname
,sl
)) {
381 if (idp
->saveent
.d_namlen
) {
382 if ( (error
= iso_uiodir(idp
,&idp
->saveent
,idp
->saveoff
)) )
384 idp
->saveent
.d_namlen
= 0;
388 idp
->current
.d_reclen
= DIRSIZ(&idp
->current
);
389 idp
->saveoff
= idp
->curroff
;
390 bcopy(&idp
->current
,&idp
->saveent
,idp
->current
.d_reclen
);
395 * Vnode op for readdir
397 * Note that directories are sector aligned (2K) and
398 * that an entry can cross a logical block but not
402 cd9660_readdir(struct vnop_readdir_args
*ap
)
404 register struct uio
*uio
= ap
->a_uio
;
405 off_t startingOffset
= uio
->uio_offset
;
407 struct isoreaddir
*idp
;
408 struct vnode
*vdp
= ap
->a_vp
;
411 struct buf
*bp
= NULL
;
412 struct iso_directory_record
*ep
;
413 int entryoffsetinblock
;
420 if (ap
->a_flags
& (VNODE_READDIR_EXTENDED
| VNODE_READDIR_REQSEEKOFF
))
425 bmask
= imp
->im_sector_size
- 1;
427 MALLOC(idp
, struct isoreaddir
*, sizeof(*idp
), M_TEMP
, M_WAITOK
);
428 idp
->saveent
.d_namlen
= 0;
431 * Is it worth trying to figure out the type?
433 idp
->saveent
.d_type
= idp
->current
.d_type
= DT_UNKNOWN
;
436 idp
->curroff
= uio
->uio_offset
;
438 if ((entryoffsetinblock
= idp
->curroff
& bmask
) &&
439 (error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
))) {
443 endsearch
= dp
->i_size
;
445 while (idp
->curroff
< endsearch
) {
447 * If offset is on a block boundary,
448 * read the next directory block.
449 * Release previous if it exists.
451 if ((idp
->curroff
& bmask
) == 0) {
454 if ((error
= cd9660_blkatoff(vdp
, SECTOFF(imp
, idp
->curroff
), NULL
, &bp
)))
456 entryoffsetinblock
= 0;
459 * Get pointer to next entry.
461 ep
= (struct iso_directory_record
*)
462 (buf_dataptr(bp
) + entryoffsetinblock
);
464 reclen
= isonum_711(ep
->length
);
466 /* skip to next block, if any */
468 (idp
->curroff
& ~bmask
) + imp
->im_sector_size
;
472 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
) {
474 /* illegal entry, stop */
478 if (entryoffsetinblock
+ reclen
> imp
->im_sector_size
) {
480 /* illegal directory, so stop looking */
484 idp
->current
.d_namlen
= isonum_711(ep
->name_len
);
486 if (reclen
< ISO_DIRECTORY_RECORD_SIZE
+ idp
->current
.d_namlen
) {
488 /* illegal entry, stop */
493 * Some poorly mastered discs have an incorrect directory
494 * file size. If the '.' entry has a better size (bigger)
495 * then use that instead.
497 if ((uio
->uio_offset
== 0) && (isonum_733(ep
->size
) > endsearch
)) {
498 dp
->i_size
= endsearch
= isonum_733(ep
->size
);
501 if ( isonum_711(ep
->flags
) & directoryBit
)
502 idp
->current
.d_fileno
= isodirino(ep
, imp
);
504 idp
->current
.d_fileno
= ((daddr_t
)buf_blkno(bp
) << imp
->im_bshift
) +
508 idp
->curroff
+= reclen
;
510 switch (imp
->iso_ftype
) {
512 cd9660_rrip_getname(ep
,idp
->current
.d_name
, &namelen
,
513 &idp
->current
.d_fileno
,imp
);
514 idp
->current
.d_namlen
= (u_char
)namelen
;
515 if (idp
->current
.d_namlen
)
516 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
519 case ISO_FTYPE_JOLIET
:
520 ucsfntrans((u_int16_t
*)ep
->name
, idp
->current
.d_namlen
,
521 idp
->current
.d_name
, &namelen
,
522 isonum_711(ep
->flags
) & directoryBit
,
523 isonum_711(ep
->flags
) & associatedBit
);
524 idp
->current
.d_namlen
= (u_char
)namelen
;
525 if (idp
->current
.d_namlen
)
526 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
529 default: /* ISO_FTYPE_DEFAULT || ISO_FTYPE_9660 */
530 strcpy(idp
->current
.d_name
,"..");
531 switch (ep
->name
[0]) {
533 idp
->current
.d_namlen
= 1;
534 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
537 idp
->current
.d_namlen
= 2;
538 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
541 isofntrans(ep
->name
,idp
->current
.d_namlen
,
542 idp
->current
.d_name
, &namelen
,
543 imp
->iso_ftype
== ISO_FTYPE_9660
,
544 isonum_711(ep
->flags
) & associatedBit
);
545 idp
->current
.d_namlen
= (u_char
)namelen
;
546 if (imp
->iso_ftype
== ISO_FTYPE_DEFAULT
)
547 error
= iso_shipdir(idp
);
549 error
= iso_uiodir(idp
,&idp
->current
,idp
->curroff
);
556 entryoffsetinblock
+= reclen
;
559 if (!error
&& imp
->iso_ftype
== ISO_FTYPE_DEFAULT
) {
560 idp
->current
.d_namlen
= 0;
561 error
= iso_shipdir(idp
);
564 if (!error
&& ap
->a_ncookies
) {
565 struct dirent
*dirp
, *dpstart
;
571 * Only the NFS server uses cookies, and it loads the
572 * directory block into system space, so we can just look at
575 * We assume the entire transfer is done to a single contiguous buffer.
577 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
) || uio
->uio_iovcnt
!= 1)
578 panic("ufs_readdir: lost in space");
581 * Make a first pass over the buffer just generated,
582 * counting the number of entries:
584 // LP64todo - fix this!
585 dpstart
= (struct dirent
*)
586 CAST_DOWN(caddr_t
, (uio_iov_base(uio
) - (uio
->uio_offset
- startingOffset
)));
587 for (dirp
= dpstart
, bufferOffset
= startingOffset
, ncookies
= 0;
588 bufferOffset
< uio
->uio_offset
; ) {
589 if (dirp
->d_reclen
== 0)
591 bufferOffset
+= dirp
->d_reclen
;
593 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
595 lost
+= uio
->uio_offset
- bufferOffset
;
596 uio
->uio_offset
= bufferOffset
;
599 * Allocate a buffer to hold the cookies requested:
601 MALLOC(cookies
, u_long
*, ncookies
* sizeof(u_long
), M_TEMP
, M_WAITOK
);
602 *ap
->a_ncookies
= ncookies
;
603 *ap
->a_cookies
= cookies
;
606 * Fill in the offsets for each entry in the buffer just allocated:
608 for (bufferOffset
= startingOffset
, dirp
= dpstart
; bufferOffset
< uio
->uio_offset
; ) {
609 *(cookies
++) = bufferOffset
;
610 bufferOffset
+= dirp
->d_reclen
;
611 dirp
= (struct dirent
*)((caddr_t
)dirp
+ dirp
->d_reclen
);
621 uio
->uio_offset
= idp
->uio_off
;
622 *ap
->a_eofflag
= idp
->eofflag
;
630 * Return target name of a symbolic link
631 * Shouldn't we get the parent vnode and read the data from there?
632 * This could eventually result in deadlocks in cd9660_lookup.
633 * But otherwise the block read here is in the block buffer two times.
635 typedef struct iso_directory_record ISODIR
;
636 typedef struct iso_node ISONODE
;
637 typedef struct iso_mnt ISOMNT
;
639 cd9660_readlink(struct vnop_readlink_args
*ap
)
654 if (imp
->iso_ftype
!= ISO_FTYPE_RRIP
)
658 * Get parents directory record block that this inode included.
660 error
= (int)buf_bread(imp
->im_devvp
,
661 (daddr64_t
)((unsigned)(ip
->i_number
>> imp
->im_bshift
)),
662 imp
->logical_block_size
, NOCRED
, &bp
);
669 * Setup the directory pointer for this inode
671 dirp
= (ISODIR
*)(buf_dataptr(bp
) + (ip
->i_number
& imp
->im_bmask
));
674 * Just make sure, we have a right one....
675 * 1: Check not cross boundary on block
677 if ((ip
->i_number
& imp
->im_bmask
) + isonum_711(dirp
->length
)
678 > imp
->logical_block_size
) {
685 * Abuse a namei buffer for now.
687 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
688 MALLOC_ZONE(symname
, char *, MAXPATHLEN
, M_NAMEI
, M_WAITOK
);
690 // LP64todo - fix this!
691 symname
= CAST_DOWN(caddr_t
, uio_iov_base(uio
));
694 * Ok, we just gathering a symbolic name in SL record.
696 if (cd9660_rrip_getsymname(dirp
, symname
, &symlen
, imp
) == 0) {
697 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
))
698 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
703 * Don't forget before you leave from home ;-)
708 * return with the symbolic name to caller's.
710 if (UIO_SEG_IS_USER_SPACE(uio
->uio_segflg
)) {
711 error
= uiomove(symname
, symlen
, uio
);
712 FREE_ZONE(symname
, MAXPATHLEN
, M_NAMEI
);
716 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
717 uio_iov_len_add(uio
, -((int64_t)symlen
));
719 uio_setresid(uio
, (uio_resid(uio
) - symlen
));
720 uio_iov_len_add(uio
, -((int)symlen
));
722 uio_iov_base_add(uio
, symlen
);
728 * prepare and issue the I/O
731 cd9660_strategy(struct vnop_strategy_args
*ap
)
734 vnode_t vp
= buf_vnode(bp
);
735 struct iso_node
*ip
= VTOI(vp
);
737 return (buf_strategy(ip
->i_devvp
, ap
));
742 * Return POSIX pathconf information applicable to cd9660 filesystems.
745 cd9660_pathconf(struct vnop_pathconf_args
*ap
)
748 switch (ap
->a_name
) {
753 switch (VTOI(ap
->a_vp
)->i_mnt
->iso_ftype
) {
755 *ap
->a_retval
= ISO_RRIP_NAMEMAX
;
757 case ISO_FTYPE_JOLIET
:
758 *ap
->a_retval
= ISO_JOLIET_NAMEMAX
;
761 *ap
->a_retval
= ISO_NAMEMAX
;
765 *ap
->a_retval
= PATH_MAX
;
768 *ap
->a_retval
= PIPE_BUF
;
770 case _PC_CHOWN_RESTRICTED
:
783 * Unsupported operation
786 cd9660_enotsupp(void)
790 /* Pagein. similar to read */
792 cd9660_pagein(struct vnop_pagein_args
*ap
)
794 struct vnode
*vp
= ap
->a_vp
;
796 size_t size
= ap
->a_size
;
797 off_t f_offset
= ap
->a_f_offset
;
798 vm_offset_t pl_offset
= ap
->a_pl_offset
;
799 int flags
= ap
->a_flags
;
800 register struct iso_node
*ip
= VTOI(vp
);
804 * Copy the Apple Double header.
806 if ((ip
->i_flag
& ISO_ASSOCIATED
) && (f_offset
== 0) && (size
== ADH_SIZE
)) {
807 apple_double_header_t header
;
811 kret
= ubc_upl_map(pl
, &ioaddr
);
812 if (kret
!= KERN_SUCCESS
)
813 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
815 bzero((caddr_t
)ioaddr
, ADH_SIZE
);
817 header
.magic
= APPLEDOUBLE_MAGIC
;
818 header
.version
= APPLEDOUBLE_VERSION
;
820 header
.entries
[0].entryID
= APPLEDOUBLE_FINDERINFO
;
821 header
.entries
[0].offset
= offsetof(apple_double_header_t
, finfo
);
822 header
.entries
[0].length
= 32;
823 header
.entries
[1].entryID
= APPLEDOUBLE_RESFORK
;
824 header
.entries
[1].offset
= ADH_SIZE
;
825 header
.entries
[1].length
= ip
->i_size
- ADH_SIZE
;
826 header
.finfo
.fdType
= ip
->i_FileType
;
827 header
.finfo
.fdCreator
= ip
->i_Creator
;
828 header
.finfo
.fdFlags
= ip
->i_FinderFlags
;
829 header
.finfo
.fdLocation
.v
= -1;
830 header
.finfo
.fdLocation
.h
= -1;
831 header
.finfo
.fdReserved
= 0;
833 bcopy((caddr_t
)&header
, (caddr_t
)ioaddr
, sizeof(apple_double_header_t
));
835 kret
= ubc_upl_unmap(pl
);
836 if (kret
!= KERN_SUCCESS
)
837 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
839 if ((flags
& UPL_NOCOMMIT
) == 0) {
840 ubc_upl_commit_range(pl
, pl_offset
, size
, UPL_COMMIT_FREE_ON_EMPTY
);
843 /* check pageouts are for reg file only and ubc info is present*/
845 panic("cd9660_pagein: Not a VREG");
846 UBCINFOCHECK("cd9660_pagein", vp
);
848 error
= cluster_pagein(vp
, pl
, pl_offset
, f_offset
, size
,
849 (off_t
)ip
->i_size
, flags
);
855 * cd9660_remove - not possible to remove a file from iso cds
857 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
860 cd9660_remove(__unused
struct vnop_remove_args
*ap
)
867 * cd9660_rmdir - not possible to remove a directory from iso cds
869 * Locking policy: a_dvp and vp locked on entry, unlocked on exit
872 cd9660_rmdir(struct vnop_rmdir_args
*ap
)
874 (void) nop_rmdir(ap
);
881 #% getattrlist vp = = =
885 IN struct attrlist *alist;
886 INOUT struct uio *uio;
887 IN vfs_context_t context;
892 cd9660_getattrlist(struct vnop_getattrlist_args
*ap
)
894 struct attrlist
*alist
= ap
->a_alist
;
903 if ((alist
->bitmapcount
!= ATTR_BIT_MAP_COUNT
) ||
904 ((alist
->commonattr
& ~ATTR_CMN_VALIDMASK
) != 0) ||
905 ((alist
->volattr
& ~ATTR_VOL_VALIDMASK
) != 0) ||
906 ((alist
->dirattr
& ~ATTR_DIR_VALIDMASK
) != 0) ||
907 ((alist
->fileattr
& ~ATTR_FILE_VALIDMASK
) != 0) ||
908 ((alist
->forkattr
& ~ATTR_FORK_VALIDMASK
) != 0)) {
913 * Requesting volume information requires setting the ATTR_VOL_INFO bit and
914 * volume info requests are mutually exclusive with all other info requests:
916 if ((alist
->volattr
!= 0) &&
917 (((alist
->volattr
& ATTR_VOL_INFO
) == 0) ||
918 (alist
->dirattr
!= 0) ||
919 (alist
->fileattr
!= 0) ||
920 (alist
->forkattr
!= 0) )) {
925 * Reject requests for unsupported options for now:
927 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) return EINVAL
;
928 if (alist
->commonattr
& (ATTR_CMN_NAMEDATTRCOUNT
| ATTR_CMN_NAMEDATTRLIST
)) return EINVAL
;
929 if (alist
->fileattr
&
930 (ATTR_FILE_FILETYPE
|
931 ATTR_FILE_FORKCOUNT
|
933 ATTR_FILE_DATAEXTENTS
|
934 ATTR_FILE_RSRCEXTENTS
)) {
939 fixedblocksize
= attrcalcsize(alist
);
940 attrblocksize
= fixedblocksize
+ (sizeof(uint32_t)); /* uint32_t for length word */
941 if (alist
->commonattr
& ATTR_CMN_NAME
) attrblocksize
+= NAME_MAX
;
942 if (alist
->commonattr
& ATTR_CMN_NAMEDATTRLIST
) attrblocksize
+= 0; /* XXX PPD */
943 if (alist
->volattr
& ATTR_VOL_MOUNTPOINT
) attrblocksize
+= PATH_MAX
;
944 if (alist
->volattr
& ATTR_VOL_NAME
) attrblocksize
+= NAME_MAX
;
945 if (alist
->fileattr
& ATTR_FILE_FORKLIST
) attrblocksize
+= 0; /* XXX PPD */
947 attrbufsize
= MIN(uio_resid(ap
->a_uio
), attrblocksize
);
948 MALLOC(attrbufptr
, void *, attrblocksize
, M_TEMP
, M_WAITOK
);
949 attrptr
= attrbufptr
;
950 *((uint32_t *)attrptr
) = 0; /* Set buffer length in case of errors */
951 ++((uint32_t *)attrptr
); /* Reserve space for length field */
952 varptr
= ((char *)attrptr
) + fixedblocksize
; /* Point to variable-length storage */
954 packattrblk(alist
, ap
->a_vp
, &attrptr
, &varptr
);
956 /* Store length of fixed + var block */
957 *((uint32_t *)attrbufptr
) = ((char*)varptr
- (char*)attrbufptr
);
958 /* Don't copy out more data than was generated */
959 attrbufsize
= MIN(attrbufsize
, (char*)varptr
- (char*)attrbufptr
);
961 error
= uiomove((caddr_t
)attrbufptr
, attrbufsize
, ap
->a_uio
);
963 FREE(attrbufptr
, M_TEMP
);
969 * Make a RIFF file header for a CD-ROM XA media file.
971 __private_extern__
void
972 cd9660_xa_init(struct iso_node
*ip
, struct iso_directory_record
*isodir
)
975 struct riff_header
*header
;
979 MALLOC(header
, struct riff_header
*, sizeof(struct riff_header
), M_TEMP
, M_WAITOK
);
981 sectors
= ip
->i_size
/ 2048;
983 strncpy(header
->riff
, "RIFF", 4);
984 header
->fileSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
) - 8);
985 strncpy(header
->cdxa
, "CDXA", 4);
986 strncpy(header
->fmt
, "fmt ", 4);
987 header
->fmtSize
= NXSwapHostLongToLittle(16);
988 strncpy(header
->data
, "data", 4);
989 header
->dataSize
= NXSwapHostLongToLittle(sectors
* CDXA_SECTOR_SIZE
);
992 * Copy the CD-ROM XA extended directory information into the header. As far as
993 * I can tell, it's always 14 bytes in the directory record, but allocated 16 bytes
994 * in the header (the last two being zeroed pad bytes).
996 name_len
= isonum_711(isodir
->name_len
);
997 cdxa
= &isodir
->name
[name_len
];
998 if ((name_len
& 0x01) == 0)
999 ++cdxa
; /* Skip pad byte */
1000 bcopy(cdxa
, header
->fmtData
, 14);
1001 header
->fmtData
[14] = 0;
1002 header
->fmtData
[15] = 0;
1005 * Point this i-node to the "whole sector" device instead of the normal
1006 * device. This allows cd9660_strategy to be ignorant of the block
1009 ip
->i_devvp
= ip
->i_mnt
->phys_devvp
;
1011 ip
->i_size
= sectors
* CDXA_SECTOR_SIZE
+ sizeof(struct riff_header
);
1012 ip
->i_riff
= header
;
1016 * Helper routine for vnop_read and vnop_pagein of CD-ROM XA multimedia files.
1017 * This routine determines the physical location of the file, then reads
1018 * sectors directly from the device into a buffer. It also handles inserting
1019 * the RIFF header at the beginning of the file.
1021 * Exactly one of buffer or uio must be non-zero. It will either bcopy to
1022 * buffer, or uiomove via uio.
1024 * XXX Should this code be using buf_breadn and ip->i_lastr to support single-block
1025 * read-ahead? Should we try more aggressive read-ahead like cluster_io does?
1027 * XXX This could be made to do larger I/O to the device (reading all the
1028 * whole sectors directly into the buffer). That would make the code more
1029 * complex, and the current code only adds 2.5% overhead compared to reading
1030 * from the device directly (at least on my test machine).
1033 cd9660_xa_read_common(
1040 struct iso_node
*ip
= VTOI(vp
);
1042 off_t diff
; /* number of bytes from offset to file's EOF */
1043 daddr_t block
; /* physical disk block containing offset */
1044 off_t sect_off
; /* starting offset into current sector */
1045 u_int count
; /* number of bytes to transfer in current block */
1049 * Copy any part of the RIFF header.
1051 if (offset
< sizeof(struct riff_header
)) {
1054 p
= ((char *) ip
->i_riff
) + offset
;
1055 count
= min(amount
, sizeof(struct riff_header
) - offset
);
1057 bcopy(p
, buffer
, count
);
1060 error
= uiomove(p
, count
, uio
);
1069 * Loop over (possibly partial) blocks to transfer.
1071 while (error
== 0 && amount
> 0) {
1073 * Determine number of bytes until EOF. If we've hit
1076 diff
= ip
->i_size
- offset
;
1080 /* Get a block from the underlying device */
1081 block
= ip
->iso_start
+ (offset
- sizeof(struct riff_header
))/CDXA_SECTOR_SIZE
;
1082 error
= (int)buf_bread(ip
->i_devvp
, (daddr64_t
)((unsigned)block
), CDXA_SECTOR_SIZE
, NOCRED
, &bp
);
1087 if (buf_resid(bp
)) {
1088 printf("isofs: cd9660_xa_read_common: buf_bread didn't read full sector\n");
1092 /* Figure out which part of the block to copy, and copy it */
1093 sect_off
= (offset
- sizeof(struct riff_header
)) % CDXA_SECTOR_SIZE
;
1094 count
= min(CDXA_SECTOR_SIZE
-sect_off
, amount
);
1095 if (diff
< count
) /* Pin transfer amount to EOF */
1099 bcopy(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), buffer
, count
);
1102 error
= uiomove(CAST_DOWN(caddr_t
, (buf_dataptr(bp
)+sect_off
)), count
, uio
);
1108 * If we copied through the end of the block, or the end of file, then
1109 * age the device block. This is optimized for sequential access.
1111 if (sect_off
+count
== CDXA_SECTOR_SIZE
|| offset
== (off_t
)ip
->i_size
)
1120 * Read from a CD-ROM XA multimedia file.
1122 * This uses the same common routine as pagein for doing the actual read
1125 * This routine doesn't do any caching beyond what the block device does.
1126 * Even then, cd9660_xa_read_common ages the blocks once we read up to
1129 * We don't even take advantage if the file has been memory mapped and has
1130 * valid pages already (in which case we could just uiomove from the page
1131 * to the caller). Since we're a read-only filesystem, there can't be
1132 * any cache coherency problems. Multimedia files are expected to be
1133 * large and streamed anyway, so caching file contents probably isn't
1137 cd9660_xa_read(struct vnop_read_args
*ap
)
1139 struct vnode
*vp
= ap
->a_vp
;
1140 register struct uio
*uio
= ap
->a_uio
;
1141 register struct iso_node
*ip
= VTOI(vp
);
1142 off_t offset
= uio
->uio_offset
;
1143 // LP64todo - fix this!
1144 size_t size
= uio_resid(uio
);
1146 /* Check for some obvious parameter problems */
1151 if (offset
>= ip
->i_size
)
1154 /* Pin the size of the read to the file's EOF */
1155 if (offset
+ size
> ip
->i_size
)
1156 size
= ip
->i_size
- offset
;
1158 return cd9660_xa_read_common(vp
, offset
, size
, NULL
, uio
);
1162 * Page in from a CD-ROM XA media file.
1164 * Since our device block size isn't a power of two, we can't use
1165 * cluster_pagein. Instead, we have to map the page and read into it.
1168 cd9660_xa_pagein(struct vnop_pagein_args
*ap
)
1170 struct vnode
*vp
= ap
->a_vp
;
1171 upl_t pl
= ap
->a_pl
;
1172 size_t size
= ap
->a_size
;
1173 off_t f_offset
= ap
->a_f_offset
;
1174 vm_offset_t pl_offset
= ap
->a_pl_offset
;
1175 int flags
= ap
->a_flags
;
1176 register struct iso_node
*ip
= VTOI(vp
);
1181 /* check pageins are for reg file only and ubc info is present*/
1183 panic("cd9660_xa_pagein: Not a VREG");
1184 UBCINFOCHECK("cd9660_xa_pagein", vp
);
1187 panic("cd9660_xa_pagein: size = %d", size
);
1189 kret
= ubc_upl_map(pl
, &ioaddr
);
1190 if (kret
!= KERN_SUCCESS
)
1191 panic("cd9660_xa_pagein: ubc_upl_map error = %d", kret
);
1193 ioaddr
+= pl_offset
;
1195 /* Make sure pagein doesn't extend past EOF */
1196 if (f_offset
+ size
> ip
->i_size
)
1197 size
= ip
->i_size
- f_offset
; /* pin size to EOF */
1199 /* Read the data in using the underlying device */
1200 error
= cd9660_xa_read_common(vp
, f_offset
, size
, (caddr_t
)ioaddr
, NULL
);
1202 /* Zero fill part of page past EOF */
1203 if (ap
->a_size
> size
)
1204 bzero((caddr_t
)ioaddr
+size
, ap
->a_size
-size
);
1206 kret
= ubc_upl_unmap(pl
);
1207 if (kret
!= KERN_SUCCESS
)
1208 panic("cd9660_xa_pagein: ubc_upl_unmap error = %d", kret
);
1210 if ((flags
& UPL_NOCOMMIT
) == 0)
1213 ubc_upl_abort_range(pl
, pl_offset
, ap
->a_size
, UPL_ABORT_FREE_ON_EMPTY
);
1215 ubc_upl_commit_range(pl
, pl_offset
, ap
->a_size
, UPL_COMMIT_FREE_ON_EMPTY
);
1222 * Global vfs data structures for isofs
1224 #define cd9660_create \
1225 ((int (*)(struct vnop_create_args *))err_create)
1226 #define cd9660_mknod ((int (*)(struct vnop_mknod_args *))err_mknod)
1227 #define cd9660_write ((int (*)(struct vnop_write_args *))cd9660_enotsupp)
1228 #define cd9660_fsync ((int (*)(struct vnop_fsync_args *))nullop)
1229 #define cd9660_rename \
1230 ((int (*)(struct vnop_rename_args *))err_rename)
1231 #define cd9660_copyfile \
1232 ((int (*)(struct vnop_copyfile_args *))err_copyfile)
1233 #define cd9660_link ((int (*)(struct vnop_link_args *))err_link)
1234 #define cd9660_mkdir ((int (*)(struct vnop_mkdir_args *))err_mkdir)
1235 #define cd9660_symlink \
1236 ((int (*)(struct vnop_symlink_args *))err_symlink)
1237 #define cd9660_advlock \
1238 ((int (*)(struct vnop_advlock_args *))cd9660_enotsupp)
1239 #define cd9660_bwrite \
1240 ((int (*)(struct vnop_bwrite_args *))cd9660_enotsupp)
1241 #define cd9660_pageout \
1242 ((int (*)(struct vnop_pageout_args *))cd9660_enotsupp)
1243 int cd9660_blktooff(struct vnop_blktooff_args
*ap
);
1244 int cd9660_offtoblk(struct vnop_offtoblk_args
*ap
);
1245 int cd9660_blockmap(struct vnop_blockmap_args
*ap
);
1247 #define VOPFUNC int (*)(void *)
1249 * Global vfs data structures for cd9660
1251 int (**cd9660_vnodeop_p
)(void *);
1252 struct vnodeopv_entry_desc cd9660_vnodeop_entries
[] = {
1253 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1254 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1255 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1256 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1257 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1258 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1259 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1260 { &vnop_read_desc
, (VOPFUNC
)cd9660_read
}, /* read */
1261 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1262 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1263 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1264 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1265 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1266 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1267 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1268 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1269 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1270 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1271 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1272 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1273 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1274 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1275 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1276 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1277 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1278 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1279 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1280 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1281 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1282 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1283 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1284 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1285 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1286 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1287 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1289 struct vnodeopv_desc cd9660_vnodeop_opv_desc
=
1290 { &cd9660_vnodeop_p
, cd9660_vnodeop_entries
};
1293 * The VOP table for CD-ROM XA (media) files is almost the same
1294 * as for ordinary files, except for read, and pagein.
1295 * Note that cd9660_xa_read doesn't use cluster I/O, so blockmap
1296 * isn't needed, and isn't implemented. Similarly, it doesn't
1297 * do buf_bread() on CD XA vnodes, so bmap, blktooff, offtoblk
1300 int (**cd9660_cdxaop_p
)(void *);
1301 struct vnodeopv_entry_desc cd9660_cdxaop_entries
[] = {
1302 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1303 { &vnop_lookup_desc
, (VOPFUNC
)cd9660_lookup
}, /* lookup */
1304 { &vnop_create_desc
, (VOPFUNC
)cd9660_create
}, /* create */
1305 { &vnop_mknod_desc
, (VOPFUNC
)cd9660_mknod
}, /* mknod */
1306 { &vnop_open_desc
, (VOPFUNC
)cd9660_open
}, /* open */
1307 { &vnop_close_desc
, (VOPFUNC
)cd9660_close
}, /* close */
1308 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1309 { &vnop_read_desc
, (VOPFUNC
)cd9660_xa_read
}, /* read */
1310 { &vnop_write_desc
, (VOPFUNC
)cd9660_write
}, /* write */
1311 { &vnop_ioctl_desc
, (VOPFUNC
)cd9660_ioctl
}, /* ioctl */
1312 { &vnop_select_desc
, (VOPFUNC
)cd9660_select
}, /* select */
1313 { &vnop_mmap_desc
, (VOPFUNC
)cd9660_mmap
}, /* mmap */
1314 { &vnop_fsync_desc
, (VOPFUNC
)cd9660_fsync
}, /* fsync */
1315 { &vnop_remove_desc
, (VOPFUNC
)cd9660_remove
}, /* remove */
1316 { &vnop_link_desc
, (VOPFUNC
)cd9660_link
}, /* link */
1317 { &vnop_rename_desc
, (VOPFUNC
)cd9660_rename
}, /* rename */
1318 { &vnop_copyfile_desc
, (VOPFUNC
)cd9660_copyfile
},/* copyfile */
1319 { &vnop_mkdir_desc
, (VOPFUNC
)cd9660_mkdir
}, /* mkdir */
1320 { &vnop_rmdir_desc
, (VOPFUNC
)cd9660_rmdir
}, /* rmdir */
1321 { &vnop_symlink_desc
, (VOPFUNC
)cd9660_symlink
}, /* symlink */
1322 { &vnop_readdir_desc
, (VOPFUNC
)cd9660_readdir
}, /* readdir */
1323 { &vnop_readlink_desc
, (VOPFUNC
)cd9660_readlink
},/* readlink */
1324 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1325 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1326 { &vnop_strategy_desc
, (VOPFUNC
)cd9660_strategy
},/* strategy */
1327 { &vnop_pathconf_desc
, (VOPFUNC
)cd9660_pathconf
},/* pathconf */
1328 { &vnop_advlock_desc
, (VOPFUNC
)cd9660_advlock
}, /* advlock */
1329 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1330 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_xa_pagein
}, /* Pagein */
1331 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1332 { &vnop_getattrlist_desc
, (VOPFUNC
)cd9660_getattrlist
}, /* getattrlist */
1333 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1335 struct vnodeopv_desc cd9660_cdxaop_opv_desc
=
1336 { &cd9660_cdxaop_p
, cd9660_cdxaop_entries
};
1339 * Special device vnode ops
1341 int (**cd9660_specop_p
)(void *);
1342 struct vnodeopv_entry_desc cd9660_specop_entries
[] = {
1343 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1344 { &vnop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
1345 { &vnop_create_desc
, (VOPFUNC
)spec_create
}, /* create */
1346 { &vnop_mknod_desc
, (VOPFUNC
)spec_mknod
}, /* mknod */
1347 { &vnop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
1348 { &vnop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
1349 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1350 { &vnop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
1351 { &vnop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
1352 { &vnop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
1353 { &vnop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
1354 { &vnop_mmap_desc
, (VOPFUNC
)spec_mmap
}, /* mmap */
1355 { &vnop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
1356 { &vnop_remove_desc
, (VOPFUNC
)spec_remove
}, /* remove */
1357 { &vnop_link_desc
, (VOPFUNC
)spec_link
}, /* link */
1358 { &vnop_rename_desc
, (VOPFUNC
)spec_rename
}, /* rename */
1359 { &vnop_mkdir_desc
, (VOPFUNC
)spec_mkdir
}, /* mkdir */
1360 { &vnop_rmdir_desc
, (VOPFUNC
)spec_rmdir
}, /* rmdir */
1361 { &vnop_symlink_desc
, (VOPFUNC
)spec_symlink
}, /* symlink */
1362 { &vnop_readdir_desc
, (VOPFUNC
)spec_readdir
}, /* readdir */
1363 { &vnop_readlink_desc
, (VOPFUNC
)spec_readlink
}, /* readlink */
1364 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1365 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1366 { &vnop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
1367 { &vnop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
1368 { &vnop_advlock_desc
, (VOPFUNC
)spec_advlock
}, /* advlock */
1369 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1370 { &vnop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
1371 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1372 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1373 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1374 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1375 { &vnop_blockmap_desc
, (VOPFUNC
)cd9660_blockmap
}, /* blockmap */
1376 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1378 struct vnodeopv_desc cd9660_specop_opv_desc
=
1379 { &cd9660_specop_p
, cd9660_specop_entries
};
1382 int (**cd9660_fifoop_p
)(void *);
1383 struct vnodeopv_entry_desc cd9660_fifoop_entries
[] = {
1384 { &vnop_default_desc
, (VOPFUNC
)vn_default_error
},
1385 { &vnop_lookup_desc
, (VOPFUNC
)fifo_lookup
}, /* lookup */
1386 { &vnop_create_desc
, (VOPFUNC
)fifo_create
}, /* create */
1387 { &vnop_mknod_desc
, (VOPFUNC
)fifo_mknod
}, /* mknod */
1388 { &vnop_open_desc
, (VOPFUNC
)fifo_open
}, /* open */
1389 { &vnop_close_desc
, (VOPFUNC
)fifo_close
}, /* close */
1390 { &vnop_getattr_desc
, (VOPFUNC
)cd9660_getattr
}, /* getattr */
1391 { &vnop_read_desc
, (VOPFUNC
)fifo_read
}, /* read */
1392 { &vnop_write_desc
, (VOPFUNC
)fifo_write
}, /* write */
1393 { &vnop_ioctl_desc
, (VOPFUNC
)fifo_ioctl
}, /* ioctl */
1394 { &vnop_select_desc
, (VOPFUNC
)fifo_select
}, /* select */
1395 { &vnop_mmap_desc
, (VOPFUNC
)fifo_mmap
}, /* mmap */
1396 { &vnop_fsync_desc
, (VOPFUNC
)fifo_fsync
}, /* fsync */
1397 { &vnop_remove_desc
, (VOPFUNC
)fifo_remove
}, /* remove */
1398 { &vnop_link_desc
, (VOPFUNC
)fifo_link
} , /* link */
1399 { &vnop_rename_desc
, (VOPFUNC
)fifo_rename
}, /* rename */
1400 { &vnop_mkdir_desc
, (VOPFUNC
)fifo_mkdir
}, /* mkdir */
1401 { &vnop_rmdir_desc
, (VOPFUNC
)fifo_rmdir
}, /* rmdir */
1402 { &vnop_symlink_desc
, (VOPFUNC
)fifo_symlink
}, /* symlink */
1403 { &vnop_readdir_desc
, (VOPFUNC
)fifo_readdir
}, /* readdir */
1404 { &vnop_readlink_desc
, (VOPFUNC
)fifo_readlink
}, /* readlink */
1405 { &vnop_inactive_desc
, (VOPFUNC
)cd9660_inactive
},/* inactive */
1406 { &vnop_reclaim_desc
, (VOPFUNC
)cd9660_reclaim
}, /* reclaim */
1407 { &vnop_strategy_desc
, (VOPFUNC
)fifo_strategy
}, /* strategy */
1408 { &vnop_pathconf_desc
, (VOPFUNC
)fifo_pathconf
}, /* pathconf */
1409 { &vnop_advlock_desc
, (VOPFUNC
)fifo_advlock
}, /* advlock */
1410 { &vnop_bwrite_desc
, (VOPFUNC
)vn_bwrite
},
1411 { &vnop_pagein_desc
, (VOPFUNC
)cd9660_pagein
}, /* Pagein */
1412 { &vnop_pageout_desc
, (VOPFUNC
)cd9660_pageout
}, /* Pageout */
1413 { &vnop_blktooff_desc
, (VOPFUNC
)cd9660_blktooff
}, /* blktooff */
1414 { &vnop_offtoblk_desc
, (VOPFUNC
)cd9660_offtoblk
}, /* offtoblk */
1415 { (struct vnodeop_desc
*)NULL
, (VOPFUNC
)NULL
}
1417 struct vnodeopv_desc cd9660_fifoop_opv_desc
=
1418 { &cd9660_fifoop_p
, cd9660_fifoop_entries
};