2 * Copyright (c) 2000-2001 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 /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
24 * Copyright (c) 1989, 1993, 1995
25 * The Regents of the University of California. All rights reserved.
27 * Redistribution and use in source and binary forms, with or without
28 * modification, are permitted provided that the following conditions
30 * 1. Redistributions of source code must retain the above copyright
31 * notice, this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright
33 * notice, this list of conditions and the following disclaimer in the
34 * documentation and/or other materials provided with the distribution.
35 * 3. All advertising materials mentioning features or use of this software
36 * must display the following acknowledgement:
37 * This product includes software developed by the University of
38 * California, Berkeley and its contributors.
39 * 4. Neither the name of the University nor the names of its contributors
40 * may be used to endorse or promote products derived from this software
41 * without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
44 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
46 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55 * @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
58 #include <sys/param.h>
60 #include <sys/systm.h>
61 #include <sys/kernel.h>
64 #include <sys/mount.h>
65 #include <sys/namei.h>
66 #include <sys/vnode.h>
68 #include <sys/errno.h>
69 #include <sys/ioctl.h>
71 #include <sys/malloc.h>
73 #include <miscfs/specfs/specdev.h>
74 #include <vfs/vfs_support.h>
76 #include <sys/kdebug.h>
78 struct vnode
*speclisth
[SPECHSZ
];
80 /* symbolic sleep message strings for devices */
81 char devopn
[] = "devopn";
82 char devio
[] = "devio";
83 char devwait
[] = "devwait";
84 char devin
[] = "devin";
85 char devout
[] = "devout";
86 char devioc
[] = "devioc";
87 char devcls
[] = "devcls";
89 #define VOPFUNC int (*)(void *)
91 int (**spec_vnodeop_p
)(void *);
92 struct vnodeopv_entry_desc spec_vnodeop_entries
[] = {
93 { &vop_default_desc
, (VOPFUNC
)vn_default_error
},
94 { &vop_lookup_desc
, (VOPFUNC
)spec_lookup
}, /* lookup */
95 { &vop_create_desc
, (VOPFUNC
)err_create
}, /* create */
96 { &vop_mknod_desc
, (VOPFUNC
)err_mknod
}, /* mknod */
97 { &vop_open_desc
, (VOPFUNC
)spec_open
}, /* open */
98 { &vop_close_desc
, (VOPFUNC
)spec_close
}, /* close */
99 { &vop_access_desc
, (VOPFUNC
)spec_access
}, /* access */
100 { &vop_getattr_desc
, (VOPFUNC
)spec_getattr
}, /* getattr */
101 { &vop_setattr_desc
, (VOPFUNC
)spec_setattr
}, /* setattr */
102 { &vop_read_desc
, (VOPFUNC
)spec_read
}, /* read */
103 { &vop_write_desc
, (VOPFUNC
)spec_write
}, /* write */
104 { &vop_lease_desc
, (VOPFUNC
)nop_lease
}, /* lease */
105 { &vop_ioctl_desc
, (VOPFUNC
)spec_ioctl
}, /* ioctl */
106 { &vop_select_desc
, (VOPFUNC
)spec_select
}, /* select */
107 { &vop_revoke_desc
, (VOPFUNC
)nop_revoke
}, /* revoke */
108 { &vop_mmap_desc
, (VOPFUNC
)err_mmap
}, /* mmap */
109 { &vop_fsync_desc
, (VOPFUNC
)spec_fsync
}, /* fsync */
110 { &vop_seek_desc
, (VOPFUNC
)err_seek
}, /* seek */
111 { &vop_remove_desc
, (VOPFUNC
)err_remove
}, /* remove */
112 { &vop_link_desc
, (VOPFUNC
)err_link
}, /* link */
113 { &vop_rename_desc
, (VOPFUNC
)err_rename
}, /* rename */
114 { &vop_mkdir_desc
, (VOPFUNC
)err_mkdir
}, /* mkdir */
115 { &vop_rmdir_desc
, (VOPFUNC
)err_rmdir
}, /* rmdir */
116 { &vop_symlink_desc
, (VOPFUNC
)err_symlink
}, /* symlink */
117 { &vop_readdir_desc
, (VOPFUNC
)err_readdir
}, /* readdir */
118 { &vop_readlink_desc
, (VOPFUNC
)err_readlink
}, /* readlink */
119 { &vop_abortop_desc
, (VOPFUNC
)err_abortop
}, /* abortop */
120 { &vop_inactive_desc
, (VOPFUNC
)nop_inactive
}, /* inactive */
121 { &vop_reclaim_desc
, (VOPFUNC
)nop_reclaim
}, /* reclaim */
122 { &vop_lock_desc
, (VOPFUNC
)nop_lock
}, /* lock */
123 { &vop_unlock_desc
, (VOPFUNC
)nop_unlock
}, /* unlock */
124 { &vop_bmap_desc
, (VOPFUNC
)spec_bmap
}, /* bmap */
125 { &vop_strategy_desc
, (VOPFUNC
)spec_strategy
}, /* strategy */
126 { &vop_print_desc
, (VOPFUNC
)spec_print
}, /* print */
127 { &vop_islocked_desc
, (VOPFUNC
)nop_islocked
}, /* islocked */
128 { &vop_pathconf_desc
, (VOPFUNC
)spec_pathconf
}, /* pathconf */
129 { &vop_advlock_desc
, (VOPFUNC
)err_advlock
}, /* advlock */
130 { &vop_blkatoff_desc
, (VOPFUNC
)err_blkatoff
}, /* blkatoff */
131 { &vop_valloc_desc
, (VOPFUNC
)err_valloc
}, /* valloc */
132 { &vop_vfree_desc
, (VOPFUNC
)err_vfree
}, /* vfree */
133 { &vop_truncate_desc
, (VOPFUNC
)nop_truncate
}, /* truncate */
134 { &vop_update_desc
, (VOPFUNC
)nop_update
}, /* update */
135 { &vop_bwrite_desc
, (VOPFUNC
)spec_bwrite
}, /* bwrite */
136 { &vop_devblocksize_desc
, (VOPFUNC
)spec_devblocksize
}, /* devblocksize */
137 { &vop_pagein_desc
, (VOPFUNC
)err_pagein
}, /* Pagein */
138 { &vop_pageout_desc
, (VOPFUNC
)err_pageout
}, /* Pageout */
139 { &vop_copyfile_desc
, (VOPFUNC
)err_copyfile
}, /* Copyfile */
140 { &vop_blktooff_desc
, (VOPFUNC
)spec_blktooff
}, /* blktooff */
141 { &vop_offtoblk_desc
, (VOPFUNC
)spec_offtoblk
}, /* offtoblk */
142 { &vop_cmap_desc
, (VOPFUNC
)spec_cmap
}, /* cmap */
143 { (struct vnodeop_desc
*)NULL
, (int(*)())NULL
}
145 struct vnodeopv_desc spec_vnodeop_opv_desc
=
146 { &spec_vnodeop_p
, spec_vnodeop_entries
};
149 * Trivial lookup routine that always fails.
153 struct vop_lookup_args
/* {
155 struct vnode **a_vpp;
156 struct componentname *a_cnp;
165 set_blocksize(struct vnode
*vp
, dev_t dev
)
170 if ((major(dev
) < nblkdev
) && (size
= bdevsw
[major(dev
)].d_psize
)) {
171 rsize
= (*size
)(dev
);
172 if (rsize
<= 0) /* did size fail? */
173 vp
->v_specsize
= DEV_BSIZE
;
175 vp
->v_specsize
= rsize
;
178 vp
->v_specsize
= DEV_BSIZE
;
182 set_fsblocksize(struct vnode
*vp
)
185 if (vp
->v_type
== VBLK
) {
186 dev_t dev
= (dev_t
)vp
->v_rdev
;
187 int maj
= major(dev
);
189 if ((u_int
)maj
>= nblkdev
)
192 set_blocksize(vp
, dev
);
199 * Open a special file.
203 struct vop_open_args
/* {
206 struct ucred *a_cred;
210 struct proc
*p
= ap
->a_p
;
211 struct vnode
*bvp
, *vp
= ap
->a_vp
;
212 dev_t bdev
, dev
= (dev_t
)vp
->v_rdev
;
213 int maj
= major(dev
);
217 * Don't allow open if fs is mounted -nodev.
219 if (vp
->v_mount
&& (vp
->v_mount
->mnt_flag
& MNT_NODEV
))
222 switch (vp
->v_type
) {
225 if ((u_int
)maj
>= nchrdev
)
227 if (ap
->a_cred
!= FSCRED
&& (ap
->a_mode
& FWRITE
)) {
229 * When running in very secure mode, do not allow
230 * opens for writing of any disk character devices.
232 if (securelevel
>= 2 && isdisk(dev
, VCHR
))
235 * When running in secure mode, do not allow opens
236 * for writing of /dev/mem, /dev/kmem, or character
237 * devices whose corresponding block devices are
240 if (securelevel
>= 1) {
241 if ((bdev
= chrtoblk(dev
)) != NODEV
&&
242 vfinddev(bdev
, VBLK
, &bvp
) &&
243 bvp
->v_usecount
> 0 &&
244 (error
= vfs_mountedon(bvp
)))
250 if (cdevsw
[maj
].d_type
== D_TTY
)
251 vp
->v_flag
|= VISTTY
;
252 VOP_UNLOCK(vp
, 0, p
);
253 error
= (*cdevsw
[maj
].d_open
)(dev
, ap
->a_mode
, S_IFCHR
, p
);
254 vn_lock(vp
, LK_EXCLUSIVE
| LK_RETRY
, p
);
258 if ((u_int
)maj
>= nblkdev
)
261 * When running in very secure mode, do not allow
262 * opens for writing of any disk block devices.
264 if (securelevel
>= 2 && ap
->a_cred
!= FSCRED
&&
265 (ap
->a_mode
& FWRITE
) && bdevsw
[maj
].d_type
== D_DISK
)
268 * Do not allow opens of block devices that are
271 if (error
= vfs_mountedon(vp
))
273 error
= (*bdevsw
[maj
].d_open
)(dev
, ap
->a_mode
, S_IFBLK
, p
);
275 set_blocksize(vp
, dev
);
287 struct vop_read_args
/* {
291 struct ucred *a_cred;
294 register struct vnode
*vp
= ap
->a_vp
;
295 register struct uio
*uio
= ap
->a_uio
;
296 struct proc
*p
= uio
->uio_procp
;
301 int n
, on
, majordev
, (*ioctl
)();
306 if (uio
->uio_rw
!= UIO_READ
)
307 panic("spec_read mode");
308 if (uio
->uio_segflg
== UIO_USERSPACE
&& uio
->uio_procp
!= current_proc())
309 panic("spec_read proc");
311 if (uio
->uio_resid
== 0)
314 switch (vp
->v_type
) {
317 VOP_UNLOCK(vp
, 0, p
);
318 error
= (*cdevsw
[major(vp
->v_rdev
)].d_read
)
319 (vp
->v_rdev
, uio
, ap
->a_ioflag
);
320 vn_lock(vp
, LK_EXCLUSIVE
| LK_RETRY
, p
);
324 if (uio
->uio_offset
< 0)
329 devBlockSize
= vp
->v_specsize
;
331 if (devBlockSize
> PAGE_SIZE
)
334 bscale
= PAGE_SIZE
/ devBlockSize
;
335 bsize
= bscale
* devBlockSize
;
338 on
= uio
->uio_offset
% bsize
;
340 bn
= (uio
->uio_offset
/ devBlockSize
) &~ (bscale
- 1);
342 if (vp
->v_lastr
+ bscale
== bn
) {
343 nextbn
= bn
+ bscale
;
344 error
= breadn(vp
, bn
, (int)bsize
, &nextbn
,
345 (int *)&bsize
, 1, NOCRED
, &bp
);
347 error
= bread(vp
, bn
, (int)bsize
, NOCRED
, &bp
);
350 n
= bsize
- bp
->b_resid
;
351 if ((on
> n
) || error
) {
357 n
= min((unsigned)(n
- on
), uio
->uio_resid
);
359 error
= uiomove((char *)bp
->b_data
+ on
, n
, uio
);
361 bp
->b_flags
|= B_AGE
;
363 } while (error
== 0 && uio
->uio_resid
> 0 && n
!= 0);
367 panic("spec_read type");
377 struct vop_write_args
/* {
381 struct ucred *a_cred;
384 register struct vnode
*vp
= ap
->a_vp
;
385 register struct uio
*uio
= ap
->a_uio
;
386 struct proc
*p
= uio
->uio_procp
;
389 int bsize
, blkmask
, bscale
;
390 register int io_sync
;
391 register int io_size
;
398 if (uio
->uio_rw
!= UIO_WRITE
)
399 panic("spec_write mode");
400 if (uio
->uio_segflg
== UIO_USERSPACE
&& uio
->uio_procp
!= current_proc())
401 panic("spec_write proc");
404 switch (vp
->v_type
) {
407 VOP_UNLOCK(vp
, 0, p
);
408 error
= (*cdevsw
[major(vp
->v_rdev
)].d_write
)
409 (vp
->v_rdev
, uio
, ap
->a_ioflag
);
410 vn_lock(vp
, LK_EXCLUSIVE
| LK_RETRY
, p
);
414 if (uio
->uio_resid
== 0)
416 if (uio
->uio_offset
< 0)
419 io_sync
= (ap
->a_ioflag
& IO_SYNC
);
420 io_size
= uio
->uio_resid
;
424 devBlockSize
= vp
->v_specsize
;
425 if (devBlockSize
> PAGE_SIZE
)
428 bscale
= PAGE_SIZE
/ devBlockSize
;
429 blkmask
= bscale
- 1;
430 bsize
= bscale
* devBlockSize
;
434 bn
= (uio
->uio_offset
/ devBlockSize
) &~ blkmask
;
435 on
= uio
->uio_offset
% bsize
;
437 n
= min((unsigned)(bsize
- on
), uio
->uio_resid
);
440 bp
= getblk(vp
, bn
, bsize
, 0, 0, BLK_WRITE
);
442 error
= bread(vp
, bn
, bsize
, NOCRED
, &bp
);
448 n
= min(n
, bsize
- bp
->b_resid
);
450 error
= uiomove((char *)bp
->b_data
+ on
, n
, uio
);
452 bp
->b_flags
|= B_AGE
;
457 if ((n
+ on
) == bsize
)
462 } while (error
== 0 && uio
->uio_resid
> 0 && n
!= 0);
466 panic("spec_write type");
472 * Device ioctl operation.
476 struct vop_ioctl_args
/* {
481 struct ucred *a_cred;
485 dev_t dev
= ap
->a_vp
->v_rdev
;
487 switch (ap
->a_vp
->v_type
) {
490 return ((*cdevsw
[major(dev
)].d_ioctl
)(dev
, ap
->a_command
, ap
->a_data
,
491 ap
->a_fflag
, ap
->a_p
));
494 if (ap
->a_command
== 0 && (int)ap
->a_data
== B_TAPE
)
495 if (bdevsw
[major(dev
)].d_type
== D_TAPE
)
499 return ((*bdevsw
[major(dev
)].d_ioctl
)(dev
, ap
->a_command
, ap
->a_data
,
500 ap
->a_fflag
, ap
->a_p
));
510 struct vop_select_args
/* {
514 struct ucred *a_cred;
521 switch (ap
->a_vp
->v_type
) {
524 return (1); /* XXX */
527 dev
= ap
->a_vp
->v_rdev
;
528 return (*cdevsw
[major(dev
)].d_select
)(dev
, ap
->a_which
, ap
->a_wql
, ap
->a_p
);
532 * Synch buffers associated with a block device
537 struct vop_fsync_args
/* {
539 struct ucred *a_cred;
544 register struct vnode
*vp
= ap
->a_vp
;
545 register struct buf
*bp
;
549 if (vp
->v_type
== VCHR
)
552 * Flush all dirty buffers associated with a block device.
556 for (bp
= vp
->v_dirtyblkhd
.lh_first
; bp
; bp
= nbp
) {
557 nbp
= bp
->b_vnbufs
.le_next
;
558 if ((bp
->b_flags
& B_BUSY
))
560 if ((bp
->b_flags
& B_DELWRI
) == 0)
561 panic("spec_fsync: not dirty");
563 bp
->b_flags
|= B_BUSY
;
568 if (ap
->a_waitfor
== MNT_WAIT
) {
569 while (vp
->v_numoutput
) {
570 vp
->v_flag
|= VBWAIT
;
571 tsleep((caddr_t
)&vp
->v_numoutput
, PRIBIO
+ 1, "spec_fsync", 0);
574 if (vp
->v_dirtyblkhd
.lh_first
) {
575 vprint("spec_fsync: dirty", vp
);
586 * Just call the device strategy routine
589 struct vop_strategy_args
/* {
600 if (bp
->b_flags
& B_READ
)
602 if (bp
->b_flags
& B_ASYNC
)
605 if (bp
->b_flags
& B_META
)
607 else if (bp
->b_flags
& (B_PGIN
| B_PAGEOUT
))
610 KERNEL_DEBUG_CONSTANT(FSDBG_CODE(DBG_DKRW
, code
) | DBG_FUNC_NONE
,
611 bp
, bp
->b_dev
, bp
->b_blkno
, bp
->b_bcount
, 0);
613 (*bdevsw
[major(bp
->b_dev
)].d_strategy
)(bp
);
618 * This is a noop, simply returning what one has been given.
621 struct vop_bmap_args
/* {
624 struct vnode **a_vpp;
630 if (ap
->a_vpp
!= NULL
)
631 *ap
->a_vpp
= ap
->a_vp
;
632 if (ap
->a_bnp
!= NULL
)
633 *ap
->a_bnp
= ap
->a_bn
* (PAGE_SIZE
/ ap
->a_vp
->v_specsize
);
634 if (ap
->a_runp
!= NULL
)
635 *ap
->a_runp
= (MAXPHYSIO
/ PAGE_SIZE
) - 1;
640 * This is a noop, simply returning what one has been given.
643 struct vop_cmap_args
/* {
657 * Device close routine
661 struct vop_close_args
/* {
664 struct ucred *a_cred;
668 register struct vnode
*vp
= ap
->a_vp
;
669 dev_t dev
= vp
->v_rdev
;
670 int (*devclose
) __P((dev_t
, int, int, struct proc
*));
673 switch (vp
->v_type
) {
677 * Hack: a tty device that is a controlling terminal
678 * has a reference from the session structure.
679 * We cannot easily tell that a character device is
680 * a controlling terminal, unless it is the closing
681 * process' controlling terminal. In that case,
682 * if the reference count is 2 (this last descriptor
683 * plus the session), release the reference from the session.
685 if (vcount(vp
) == 2 && ap
->a_p
&&
686 vp
== ap
->a_p
->p_session
->s_ttyvp
) {
687 ap
->a_p
->p_session
->s_ttyvp
= NULL
;
691 * If the vnode is locked, then we are in the midst
692 * of forcably closing the device, otherwise we only
693 * close on last reference.
695 if (vcount(vp
) > 1 && (vp
->v_flag
& VXLOCK
) == 0)
697 devclose
= cdevsw
[major(dev
)].d_close
;
702 #ifdef DEVFS_IMPLEMENTS_LOCKING
704 * On last close of a block device (that isn't mounted)
705 * we must invalidate any in core blocks, so that
706 * we can, for instance, change floppy disks.
708 vn_lock(vp
, LK_EXCLUSIVE
| LK_RETRY
, ap
->a_p
);
709 error
= vinvalbuf(vp
, V_SAVE
, ap
->a_cred
, ap
->a_p
, 0, 0);
710 VOP_UNLOCK(vp
, 0, ap
->a_p
);
714 * We do not want to really close the device if it
715 * is still in use unless we are trying to close it
716 * forcibly. Since every use (buffer, vnode, swap, cmap)
717 * holds a reference to the vnode, and because we mark
718 * any other vnodes that alias this device, when the
719 * sum of the reference counts on all the aliased
720 * vnodes descends to one, we are on last close.
722 if (vcount(vp
) > 1 && (vp
->v_flag
& VXLOCK
) == 0)
724 #else /* DEVFS_IMPLEMENTS_LOCKING */
726 * We do not want to really close the device if it
727 * is still in use unless we are trying to close it
728 * forcibly. Since every use (buffer, vnode, swap, cmap)
729 * holds a reference to the vnode, and because we mark
730 * any other vnodes that alias this device, when the
731 * sum of the reference counts on all the aliased
732 * vnodes descends to one, we are on last close.
734 if (vcount(vp
) > 1 && (vp
->v_flag
& VXLOCK
) == 0)
738 * On last close of a block device (that isn't mounted)
739 * we must invalidate any in core blocks, so that
740 * we can, for instance, change floppy disks.
742 error
= vinvalbuf(vp
, V_SAVE
, ap
->a_cred
, ap
->a_p
, 0, 0);
745 #endif /* DEVFS_IMPLEMENTS_LOCKING */
746 devclose
= bdevsw
[major(dev
)].d_close
;
751 panic("spec_close: not special");
754 return ((*devclose
)(dev
, ap
->a_fflag
, mode
, ap
->a_p
));
758 * Print out the contents of a special device vnode.
761 struct vop_print_args
/* {
766 printf("tag VT_NON, dev %d, %d\n", major(ap
->a_vp
->v_rdev
),
767 minor(ap
->a_vp
->v_rdev
));
771 * Return POSIX pathconf information applicable to special devices.
774 struct vop_pathconf_args
/* {
781 switch (ap
->a_name
) {
783 *ap
->a_retval
= LINK_MAX
;
786 *ap
->a_retval
= MAX_CANON
;
789 *ap
->a_retval
= MAX_INPUT
;
792 *ap
->a_retval
= PIPE_BUF
;
794 case _PC_CHOWN_RESTRICTED
:
798 *ap
->a_retval
= _POSIX_VDISABLE
;
807 spec_devblocksize(ap
)
808 struct vop_devblocksize_args
/* {
813 *ap
->a_retval
= (ap
->a_vp
->v_specsize
);
818 * Special device failed operation
827 * Special device bad operation
832 panic("spec_badop called");
836 /* Blktooff derives file offset from logical block number */
839 struct vop_blktooff_args
/* {
845 register struct vnode
*vp
= ap
->a_vp
;
847 switch (vp
->v_type
) {
849 *ap
->a_offset
= (off_t
)-1; /* failure */
853 printf("spec_blktooff: not implemented for VBLK\n");
854 *ap
->a_offset
= (off_t
)-1; /* failure */
858 panic("spec_blktooff type");
863 /* Offtoblk derives logical block number from file offset */
866 struct vop_offtoblk_args
/* {
872 register struct vnode
*vp
= ap
->a_vp
;
874 switch (vp
->v_type
) {
876 *ap
->a_lblkno
= (daddr_t
)-1; /* failure */
880 printf("spec_offtoblk: not implemented for VBLK\n");
881 *ap
->a_lblkno
= (daddr_t
)-1; /* failure */
885 panic("spec_offtoblk type");