Home | History | Annotate | Line # | Download | only in efs
efs_vnops.c revision 1.3.2.2
      1  1.3.2.2  ad /*	$NetBSD: efs_vnops.c,v 1.3.2.2 2007/07/15 16:15:31 ad Exp $	*/
      2  1.3.2.2  ad 
      3  1.3.2.2  ad /*
      4  1.3.2.2  ad  * Copyright (c) 2006 Stephen M. Rumble <rumble (at) ephemeral.org>
      5  1.3.2.2  ad  *
      6  1.3.2.2  ad  * Permission to use, copy, modify, and distribute this software for any
      7  1.3.2.2  ad  * purpose with or without fee is hereby granted, provided that the above
      8  1.3.2.2  ad  * copyright notice and this permission notice appear in all copies.
      9  1.3.2.2  ad  *
     10  1.3.2.2  ad  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  1.3.2.2  ad  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  1.3.2.2  ad  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  1.3.2.2  ad  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  1.3.2.2  ad  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  1.3.2.2  ad  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  1.3.2.2  ad  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  1.3.2.2  ad  */
     18  1.3.2.2  ad 
     19  1.3.2.2  ad #include <sys/cdefs.h>
     20  1.3.2.2  ad __KERNEL_RCSID(0, "$NetBSD: efs_vnops.c,v 1.3.2.2 2007/07/15 16:15:31 ad Exp $");
     21  1.3.2.2  ad 
     22  1.3.2.2  ad #include <sys/param.h>
     23  1.3.2.2  ad #include <sys/systm.h>
     24  1.3.2.2  ad #include <sys/proc.h>
     25  1.3.2.2  ad #include <sys/kernel.h>
     26  1.3.2.2  ad #include <sys/vnode.h>
     27  1.3.2.2  ad #include <sys/mount.h>
     28  1.3.2.2  ad #include <sys/malloc.h>
     29  1.3.2.2  ad #include <sys/namei.h>
     30  1.3.2.2  ad #include <sys/dirent.h>
     31  1.3.2.2  ad #include <sys/lockf.h>
     32  1.3.2.2  ad #include <sys/unistd.h>
     33  1.3.2.2  ad 
     34  1.3.2.2  ad #include <miscfs/genfs/genfs.h>
     35  1.3.2.2  ad #include <miscfs/genfs/genfs_node.h>
     36  1.3.2.2  ad 
     37  1.3.2.2  ad #include <fs/efs/efs.h>
     38  1.3.2.2  ad #include <fs/efs/efs_sb.h>
     39  1.3.2.2  ad #include <fs/efs/efs_dir.h>
     40  1.3.2.2  ad #include <fs/efs/efs_genfs.h>
     41  1.3.2.2  ad #include <fs/efs/efs_mount.h>
     42  1.3.2.2  ad #include <fs/efs/efs_extent.h>
     43  1.3.2.2  ad #include <fs/efs/efs_dinode.h>
     44  1.3.2.2  ad #include <fs/efs/efs_inode.h>
     45  1.3.2.2  ad #include <fs/efs/efs_subr.h>
     46  1.3.2.2  ad #include <fs/efs/efs_ihash.h>
     47  1.3.2.2  ad 
     48  1.3.2.2  ad MALLOC_DECLARE(M_EFSTMP);
     49  1.3.2.2  ad 
     50  1.3.2.2  ad /*
     51  1.3.2.2  ad  * Lookup a pathname component in the given directory.
     52  1.3.2.2  ad  *
     53  1.3.2.2  ad  * Returns 0 on success.
     54  1.3.2.2  ad  */
     55  1.3.2.2  ad static int
     56  1.3.2.2  ad efs_lookup(void *v)
     57  1.3.2.2  ad {
     58  1.3.2.2  ad 	struct vop_lookup_args /* {
     59  1.3.2.2  ad 		struct vnode *a_dvp;
     60  1.3.2.2  ad 		struct vnode **a_vpp;
     61  1.3.2.2  ad 		struct componentname *a_cnp;
     62  1.3.2.2  ad 	} */ *ap = v;
     63  1.3.2.2  ad 	struct componentname *cnp = ap->a_cnp;
     64  1.3.2.2  ad 	struct vnode *vp;
     65  1.3.2.2  ad 	ino_t ino;
     66  1.3.2.2  ad 	int err, nameiop = cnp->cn_nameiop;
     67  1.3.2.2  ad 
     68  1.3.2.2  ad 	/* ensure that the directory can be accessed first */
     69  1.3.2.2  ad         err = VOP_ACCESS(ap->a_dvp, VEXEC, cnp->cn_cred, cnp->cn_lwp);
     70  1.3.2.2  ad 	if (err)
     71  1.3.2.2  ad 		return (err);
     72  1.3.2.2  ad 
     73  1.3.2.2  ad 	err = cache_lookup(ap->a_dvp, ap->a_vpp, cnp);
     74  1.3.2.2  ad 	if (err != -1)
     75  1.3.2.2  ad 		return (err);
     76  1.3.2.2  ad 
     77  1.3.2.2  ad 	/*
     78  1.3.2.2  ad 	 * Handle the three lookup types: '.', '..', and everything else.
     79  1.3.2.2  ad 	 */
     80  1.3.2.2  ad 	if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') {
     81  1.3.2.2  ad 		vref(ap->a_dvp);
     82  1.3.2.2  ad 		*ap->a_vpp = ap->a_dvp;
     83  1.3.2.2  ad 	} else if (cnp->cn_flags & ISDOTDOT) {
     84  1.3.2.2  ad 		err = efs_inode_lookup(VFSTOEFS(ap->a_dvp->v_mount),
     85  1.3.2.2  ad 		    EFS_VTOI(ap->a_dvp), ap->a_cnp, &ino);
     86  1.3.2.2  ad 		if (err)
     87  1.3.2.2  ad 			return (err);
     88  1.3.2.2  ad 
     89  1.3.2.2  ad 		VOP_UNLOCK(ap->a_dvp, 0);	/* preserve lock order */
     90  1.3.2.2  ad 
     91  1.3.2.2  ad 		err = VFS_VGET(ap->a_dvp->v_mount, ino, &vp);
     92  1.3.2.2  ad 		if (err) {
     93  1.3.2.2  ad 			vn_lock(ap->a_dvp, LK_EXCLUSIVE | LK_RETRY);
     94  1.3.2.2  ad 			return (err);
     95  1.3.2.2  ad 		}
     96  1.3.2.2  ad 		vn_lock(ap->a_dvp, LK_EXCLUSIVE | LK_RETRY);
     97  1.3.2.2  ad 		*ap->a_vpp = vp;
     98  1.3.2.2  ad 	} else {
     99  1.3.2.2  ad 		err = efs_inode_lookup(VFSTOEFS(ap->a_dvp->v_mount),
    100  1.3.2.2  ad 		    EFS_VTOI(ap->a_dvp), ap->a_cnp, &ino);
    101  1.3.2.2  ad 		if (err) {
    102  1.3.2.2  ad 			if (err == ENOENT && (cnp->cn_flags & MAKEENTRY) &&
    103  1.3.2.2  ad 			    nameiop != CREATE)
    104  1.3.2.2  ad 				cache_enter(ap->a_dvp, NULL, cnp);
    105  1.3.2.2  ad 			if (err == ENOENT && (nameiop == CREATE ||
    106  1.3.2.2  ad 			    nameiop == RENAME)) {
    107  1.3.2.2  ad 				err = VOP_ACCESS(vp, VWRITE, cnp->cn_cred,
    108  1.3.2.2  ad 				    cnp->cn_lwp);
    109  1.3.2.2  ad 				if (err)
    110  1.3.2.2  ad 					return (err);
    111  1.3.2.2  ad 				cnp->cn_flags |= SAVENAME;
    112  1.3.2.2  ad 				return (EJUSTRETURN);
    113  1.3.2.2  ad 			}
    114  1.3.2.2  ad 			return (err);
    115  1.3.2.2  ad 		}
    116  1.3.2.2  ad 		err = VFS_VGET(ap->a_dvp->v_mount, ino, &vp);
    117  1.3.2.2  ad 		if (err)
    118  1.3.2.2  ad 			return (err);
    119  1.3.2.2  ad 		*ap->a_vpp = vp;
    120  1.3.2.2  ad 	}
    121  1.3.2.2  ad 
    122  1.3.2.2  ad 	if (cnp->cn_flags & MAKEENTRY)
    123  1.3.2.2  ad 		cache_enter(ap->a_dvp, *ap->a_vpp, cnp);
    124  1.3.2.2  ad 
    125  1.3.2.2  ad 	return (0);
    126  1.3.2.2  ad }
    127  1.3.2.2  ad 
    128  1.3.2.2  ad /*
    129  1.3.2.2  ad  * Determine the accessiblity of a file based on the permissions allowed by the
    130  1.3.2.2  ad  * specified credentials.
    131  1.3.2.2  ad  *
    132  1.3.2.2  ad  * Returns 0 on success.
    133  1.3.2.2  ad  */
    134  1.3.2.2  ad static int
    135  1.3.2.2  ad efs_access(void *v)
    136  1.3.2.2  ad {
    137  1.3.2.2  ad 	struct vop_access_args /* {
    138  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    139  1.3.2.2  ad 		struct vnode *a_vp;
    140  1.3.2.2  ad 		int a_mode;
    141  1.3.2.2  ad 		struct ucred *a_cred;
    142  1.3.2.2  ad 		struct lwp *a_l;
    143  1.3.2.2  ad 	} */ *ap = v;
    144  1.3.2.2  ad 	struct vnode *vp = ap->a_vp;
    145  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(vp);
    146  1.3.2.2  ad 
    147  1.3.2.2  ad 	if ((ap->a_mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY))
    148  1.3.2.2  ad 		return (EROFS);
    149  1.3.2.2  ad 
    150  1.3.2.2  ad 	return (vaccess(vp->v_type, eip->ei_mode, eip->ei_uid, eip->ei_gid,
    151  1.3.2.2  ad 	    ap->a_mode, ap->a_cred));
    152  1.3.2.2  ad }
    153  1.3.2.2  ad 
    154  1.3.2.2  ad /*
    155  1.3.2.2  ad  * Get specific vnode attributes on a file. See vattr(9).
    156  1.3.2.2  ad  *
    157  1.3.2.2  ad  * Returns 0 on success.
    158  1.3.2.2  ad  */
    159  1.3.2.2  ad static int
    160  1.3.2.2  ad efs_getattr(void *v)
    161  1.3.2.2  ad {
    162  1.3.2.2  ad 	struct vop_getattr_args /* {
    163  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    164  1.3.2.2  ad 		struct vnode *a_vp;
    165  1.3.2.2  ad 		struct vattr *a_vap;
    166  1.3.2.2  ad 		struct ucred *a_cred;
    167  1.3.2.2  ad 		struct lwp *a_l;
    168  1.3.2.2  ad 	} */ *ap = v;
    169  1.3.2.2  ad 
    170  1.3.2.2  ad 	struct vattr *vap = ap->a_vap;
    171  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    172  1.3.2.2  ad 
    173  1.3.2.2  ad 	vattr_null(ap->a_vap);
    174  1.3.2.2  ad 	vap->va_type		= ap->a_vp->v_type;
    175  1.3.2.2  ad 	vap->va_mode		= eip->ei_mode;
    176  1.3.2.2  ad 	vap->va_nlink		= eip->ei_nlink;
    177  1.3.2.2  ad 	vap->va_uid		= eip->ei_uid;
    178  1.3.2.2  ad 	vap->va_gid		= eip->ei_gid;
    179  1.3.2.2  ad 	vap->va_fsid 		= ap->a_vp->v_mount->mnt_stat.f_fsid;
    180  1.3.2.2  ad 	vap->va_fileid 		= eip->ei_number;
    181  1.3.2.2  ad 	vap->va_size 		= eip->ei_size;
    182  1.3.2.2  ad 
    183  1.3.2.2  ad 	if (ap->a_vp->v_type == VBLK)
    184  1.3.2.2  ad 		vap->va_blocksize = BLKDEV_IOSIZE;
    185  1.3.2.2  ad 	else if (ap->a_vp->v_type == VCHR)
    186  1.3.2.2  ad 		vap->va_blocksize = MAXBSIZE;
    187  1.3.2.2  ad 	else
    188  1.3.2.2  ad 		vap->va_blocksize = EFS_BB_SIZE;
    189  1.3.2.2  ad 
    190  1.3.2.2  ad 	vap->va_atime.tv_sec	= eip->ei_atime;
    191  1.3.2.2  ad 	vap->va_mtime.tv_sec	= eip->ei_mtime;
    192  1.3.2.2  ad 	vap->va_ctime.tv_sec	= eip->ei_ctime;
    193  1.3.2.2  ad /*	vap->va_birthtime 	= */
    194  1.3.2.2  ad 	vap->va_gen		= eip->ei_gen;
    195  1.3.2.2  ad 	vap->va_flags		= ap->a_vp->v_vflag | ap->a_vp->v_iflag;
    196  1.3.2.2  ad 
    197  1.3.2.2  ad 	if (ap->a_vp->v_type == VBLK || ap->a_vp->v_type == VCHR) {
    198  1.3.2.2  ad 		uint32_t dmaj, dmin;
    199  1.3.2.2  ad 
    200  1.3.2.2  ad 		if (be16toh(eip->ei_di.di_odev) != EFS_DINODE_ODEV_INVALID) {
    201  1.3.2.2  ad 			dmaj = EFS_DINODE_ODEV_MAJ(be16toh(eip->ei_di.di_odev));
    202  1.3.2.2  ad 			dmin = EFS_DINODE_ODEV_MIN(be16toh(eip->ei_di.di_odev));
    203  1.3.2.2  ad 		} else {
    204  1.3.2.2  ad 			dmaj = EFS_DINODE_NDEV_MAJ(be32toh(eip->ei_di.di_ndev));
    205  1.3.2.2  ad 			dmin = EFS_DINODE_NDEV_MIN(be32toh(eip->ei_di.di_ndev));
    206  1.3.2.2  ad 		}
    207  1.3.2.2  ad 
    208  1.3.2.2  ad 		vap->va_rdev = makedev(dmaj, dmin);
    209  1.3.2.2  ad 	}
    210  1.3.2.2  ad 
    211  1.3.2.2  ad 	vap->va_bytes		= eip->ei_size;
    212  1.3.2.2  ad /*	vap->va_filerev		= */
    213  1.3.2.2  ad /*	vap->va_vaflags		= */
    214  1.3.2.2  ad 
    215  1.3.2.2  ad 	return (0);
    216  1.3.2.2  ad }
    217  1.3.2.2  ad 
    218  1.3.2.2  ad /*
    219  1.3.2.2  ad  * Read a file.
    220  1.3.2.2  ad  *
    221  1.3.2.2  ad  * Returns 0 on success.
    222  1.3.2.2  ad  */
    223  1.3.2.2  ad static int
    224  1.3.2.2  ad efs_read(void *v)
    225  1.3.2.2  ad {
    226  1.3.2.2  ad 	struct vop_read_args /* {
    227  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    228  1.3.2.2  ad 		struct vnode *a_vp;
    229  1.3.2.2  ad 		struct uio *a_uio;
    230  1.3.2.2  ad 		int a_ioflag;
    231  1.3.2.2  ad 		struct ucred *a_cred;
    232  1.3.2.2  ad 	} */ *ap = v;
    233  1.3.2.2  ad 	struct efs_extent ex;
    234  1.3.2.2  ad 	struct efs_extent_iterator exi;
    235  1.3.2.2  ad 	void *win;
    236  1.3.2.2  ad 	struct uio *uio = ap->a_uio;
    237  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    238  1.3.2.2  ad 	off_t start;
    239  1.3.2.2  ad 	vsize_t len;
    240  1.3.2.2  ad 	int err, ret, flags;
    241  1.3.2.2  ad 	const int advice = IO_ADV_DECODE(ap->a_ioflag);
    242  1.3.2.2  ad 
    243  1.3.2.2  ad 	if (ap->a_vp->v_type == VDIR)
    244  1.3.2.2  ad 		return (EISDIR);
    245  1.3.2.2  ad 
    246  1.3.2.2  ad 	if (ap->a_vp->v_type != VREG)
    247  1.3.2.2  ad 		return (EINVAL);
    248  1.3.2.2  ad 
    249  1.3.2.2  ad 	efs_extent_iterator_init(&exi, eip, uio->uio_offset);
    250  1.3.2.2  ad 	ret = efs_extent_iterator_next(&exi, &ex);
    251  1.3.2.2  ad 	while (ret == 0) {
    252  1.3.2.2  ad 		if (uio->uio_offset < 0 || uio->uio_offset >= eip->ei_size ||
    253  1.3.2.2  ad 		    uio->uio_resid == 0)
    254  1.3.2.2  ad 			break;
    255  1.3.2.2  ad 
    256  1.3.2.2  ad 		start = ex.ex_offset * EFS_BB_SIZE;
    257  1.3.2.2  ad 		len   = ex.ex_length * EFS_BB_SIZE;
    258  1.3.2.2  ad 
    259  1.3.2.2  ad 		if (!(uio->uio_offset >= start &&
    260  1.3.2.2  ad 		      uio->uio_offset < (start + len))) {
    261  1.3.2.2  ad 			ret = efs_extent_iterator_next(&exi, &ex);
    262  1.3.2.2  ad 			continue;
    263  1.3.2.2  ad 		}
    264  1.3.2.2  ad 
    265  1.3.2.2  ad 		start = uio->uio_offset - start;
    266  1.3.2.2  ad 
    267  1.3.2.2  ad 		len = MIN(len - start, uio->uio_resid);
    268  1.3.2.2  ad 		len = MIN(len, eip->ei_size - uio->uio_offset);
    269  1.3.2.2  ad 
    270  1.3.2.2  ad 		win = ubc_alloc(&ap->a_vp->v_uobj, uio->uio_offset,
    271  1.3.2.2  ad 		    &len, advice, UBC_READ);
    272  1.3.2.2  ad 
    273  1.3.2.2  ad 		flags = UBC_WANT_UNMAP(ap->a_vp) ? UBC_UNMAP : 0;
    274  1.3.2.2  ad 
    275  1.3.2.2  ad 		err = uiomove(win, len, uio);
    276  1.3.2.2  ad 		ubc_release(win, flags);
    277  1.3.2.2  ad 		if (err) {
    278  1.3.2.2  ad 			EFS_DPRINTF(("efs_read: uiomove error %d\n",
    279  1.3.2.2  ad 			    err));
    280  1.3.2.2  ad 			return (err);
    281  1.3.2.2  ad 		}
    282  1.3.2.2  ad 	}
    283  1.3.2.2  ad 
    284  1.3.2.2  ad 	return ((ret == -1) ? 0 : ret);
    285  1.3.2.2  ad }
    286  1.3.2.2  ad 
    287  1.3.2.2  ad static int
    288  1.3.2.2  ad efs_readdir(void *v)
    289  1.3.2.2  ad {
    290  1.3.2.2  ad 	struct vop_readdir_args /* {
    291  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    292  1.3.2.2  ad 		struct vnode *a_vp;
    293  1.3.2.2  ad 		struct uio *a_uio;
    294  1.3.2.2  ad 		struct ucred *a_cred;
    295  1.3.2.2  ad 		int *a_eofflag;
    296  1.3.2.2  ad 		off_t **a_cookies;
    297  1.3.2.2  ad 		int *a_ncookies;
    298  1.3.2.2  ad 	} */ *ap = v;
    299  1.3.2.2  ad 	struct efs_dinode edi;
    300  1.3.2.2  ad 	struct efs_extent ex;
    301  1.3.2.2  ad 	struct efs_extent_iterator exi;
    302  1.3.2.2  ad 	struct buf *bp;
    303  1.3.2.2  ad 	struct dirent *dp;
    304  1.3.2.2  ad 	struct efs_dirent *de;
    305  1.3.2.2  ad 	struct efs_dirblk *db;
    306  1.3.2.2  ad 	struct uio *uio = ap->a_uio;
    307  1.3.2.2  ad 	struct efs_inode *ei = EFS_VTOI(ap->a_vp);
    308  1.3.2.2  ad 	off_t offset;
    309  1.3.2.2  ad 	int i, j, err, ret, s, slot;
    310  1.3.2.2  ad 
    311  1.3.2.2  ad 	/* XXX - ncookies, cookies for NFS */
    312  1.3.2.2  ad 
    313  1.3.2.2  ad 	if (ap->a_vp->v_type != VDIR)
    314  1.3.2.2  ad 		return (ENOTDIR);
    315  1.3.2.2  ad 
    316  1.3.2.2  ad 	offset = 0;
    317  1.3.2.2  ad 
    318  1.3.2.2  ad 	efs_extent_iterator_init(&exi, ei, 0);
    319  1.3.2.2  ad 	while ((ret = efs_extent_iterator_next(&exi, &ex)) == 0) {
    320  1.3.2.2  ad 		for (i = 0; i < ex.ex_length; i++) {
    321  1.3.2.2  ad 			err = efs_bread(VFSTOEFS(ap->a_vp->v_mount),
    322  1.3.2.2  ad 			    ex.ex_bn + i, NULL, &bp);
    323  1.3.2.2  ad 			if (err) {
    324  1.3.2.2  ad 				brelse(bp, 0);
    325  1.3.2.2  ad 				return (err);
    326  1.3.2.2  ad 			}
    327  1.3.2.2  ad 
    328  1.3.2.2  ad 			db = (struct efs_dirblk *)bp->b_data;
    329  1.3.2.2  ad 
    330  1.3.2.2  ad 			if (be16toh(db->db_magic) != EFS_DIRBLK_MAGIC) {
    331  1.3.2.2  ad 				printf("efs_readdir: bad dirblk\n");
    332  1.3.2.2  ad 				brelse(bp, 0);
    333  1.3.2.2  ad 				continue;
    334  1.3.2.2  ad 			}
    335  1.3.2.2  ad 
    336  1.3.2.2  ad 			for (j = 0; j < db->db_slots; j++) {
    337  1.3.2.2  ad 				slot = EFS_DIRENT_OFF_EXPND(db->db_space[j]);
    338  1.3.2.2  ad 				if (slot == EFS_DIRBLK_SLOT_FREE)
    339  1.3.2.2  ad 					continue;
    340  1.3.2.2  ad 
    341  1.3.2.2  ad 				if (!EFS_DIRENT_OFF_VALID(slot)) {
    342  1.3.2.2  ad 					printf("efs_readdir: bad dirent\n");
    343  1.3.2.2  ad 					continue;
    344  1.3.2.2  ad 				}
    345  1.3.2.2  ad 
    346  1.3.2.2  ad 				de = EFS_DIRBLK_TO_DIRENT(db, slot);
    347  1.3.2.2  ad 				s = _DIRENT_RECLEN(dp, de->de_namelen);
    348  1.3.2.2  ad 
    349  1.3.2.2  ad 				if (offset < uio->uio_offset) {
    350  1.3.2.2  ad 					offset += s;
    351  1.3.2.2  ad 					continue;
    352  1.3.2.2  ad 				}
    353  1.3.2.2  ad 
    354  1.3.2.2  ad 				if (offset > uio->uio_offset) {
    355  1.3.2.2  ad 					/* XXX - shouldn't happen, right? */
    356  1.3.2.2  ad 					brelse(bp, 0);
    357  1.3.2.2  ad 					return (0);
    358  1.3.2.2  ad 				}
    359  1.3.2.2  ad 
    360  1.3.2.2  ad 				if (s > uio->uio_resid) {
    361  1.3.2.2  ad 					brelse(bp, 0);
    362  1.3.2.2  ad 					return (0);
    363  1.3.2.2  ad 				}
    364  1.3.2.2  ad 
    365  1.3.2.2  ad 				dp = malloc(s, M_EFSTMP, M_ZERO | M_WAITOK);
    366  1.3.2.2  ad 				dp->d_fileno = be32toh(de->de_inumber);
    367  1.3.2.2  ad 				dp->d_reclen = s;
    368  1.3.2.2  ad 				dp->d_namlen = de->de_namelen;
    369  1.3.2.2  ad 				memcpy(dp->d_name, de->de_name,
    370  1.3.2.2  ad 				    de->de_namelen);
    371  1.3.2.2  ad 				dp->d_name[de->de_namelen] = '\0';
    372  1.3.2.2  ad 
    373  1.3.2.2  ad 				/* look up inode to get type */
    374  1.3.2.2  ad 				err = efs_read_inode(
    375  1.3.2.2  ad 				    VFSTOEFS(ap->a_vp->v_mount),
    376  1.3.2.2  ad 				    dp->d_fileno, NULL, &edi);
    377  1.3.2.2  ad 				if (err) {
    378  1.3.2.2  ad 					brelse(bp, 0);
    379  1.3.2.2  ad 					free(dp, M_EFSTMP);
    380  1.3.2.2  ad 					return (err);
    381  1.3.2.2  ad 				}
    382  1.3.2.2  ad 
    383  1.3.2.2  ad 				switch (be16toh(edi.di_mode) & EFS_IFMT) {
    384  1.3.2.2  ad 				case EFS_IFIFO:
    385  1.3.2.2  ad 					dp->d_type = DT_FIFO;
    386  1.3.2.2  ad 					break;
    387  1.3.2.2  ad 				case EFS_IFCHR:
    388  1.3.2.2  ad 					dp->d_type = DT_CHR;
    389  1.3.2.2  ad 					break;
    390  1.3.2.2  ad 				case EFS_IFDIR:
    391  1.3.2.2  ad 					dp->d_type = DT_DIR;
    392  1.3.2.2  ad 					break;
    393  1.3.2.2  ad 				case EFS_IFBLK:
    394  1.3.2.2  ad 					dp->d_type = DT_BLK;
    395  1.3.2.2  ad 					break;
    396  1.3.2.2  ad 				case EFS_IFREG:
    397  1.3.2.2  ad 					dp->d_type = DT_REG;
    398  1.3.2.2  ad 					break;
    399  1.3.2.2  ad 				case EFS_IFLNK:
    400  1.3.2.2  ad 					dp->d_type = DT_LNK;
    401  1.3.2.2  ad 					break;
    402  1.3.2.2  ad 				case EFS_IFSOCK:
    403  1.3.2.2  ad 					dp->d_type = DT_SOCK;
    404  1.3.2.2  ad 					break;
    405  1.3.2.2  ad 				default:
    406  1.3.2.2  ad 					dp->d_type = DT_UNKNOWN;
    407  1.3.2.2  ad 					break;
    408  1.3.2.2  ad 				}
    409  1.3.2.2  ad 
    410  1.3.2.2  ad 				err = uiomove(dp, s, uio);
    411  1.3.2.2  ad 				free(dp, M_EFSTMP);
    412  1.3.2.2  ad 				if (err) {
    413  1.3.2.2  ad 					brelse(bp, 0);
    414  1.3.2.2  ad 					return (err);
    415  1.3.2.2  ad 				}
    416  1.3.2.2  ad 
    417  1.3.2.2  ad 				offset += s;
    418  1.3.2.2  ad 			}
    419  1.3.2.2  ad 
    420  1.3.2.2  ad 			brelse(bp, 0);
    421  1.3.2.2  ad 		}
    422  1.3.2.2  ad 	}
    423  1.3.2.2  ad 
    424  1.3.2.2  ad 	if (ret != -1)
    425  1.3.2.2  ad 		return (ret);
    426  1.3.2.2  ad 
    427  1.3.2.2  ad 	if (ap->a_eofflag != NULL)
    428  1.3.2.2  ad 		*ap->a_eofflag = true;
    429  1.3.2.2  ad 
    430  1.3.2.2  ad 	return (0);
    431  1.3.2.2  ad }
    432  1.3.2.2  ad 
    433  1.3.2.2  ad static int
    434  1.3.2.2  ad efs_readlink(void *v)
    435  1.3.2.2  ad {
    436  1.3.2.2  ad 	struct vop_readlink_args /* {
    437  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    438  1.3.2.2  ad 		struct vnode *a_vp;
    439  1.3.2.2  ad 		struct uio *a_uio;
    440  1.3.2.2  ad 		struct ucred *a_cred;
    441  1.3.2.2  ad 	} */ *ap = v;
    442  1.3.2.2  ad 	struct uio *uio = ap->a_uio;
    443  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    444  1.3.2.2  ad 	char *buf;
    445  1.3.2.2  ad 	size_t len;
    446  1.3.2.2  ad 	int err, i;
    447  1.3.2.2  ad 
    448  1.3.2.2  ad 	if ((eip->ei_mode & EFS_IFMT) != EFS_IFLNK)
    449  1.3.2.2  ad 		return (EINVAL);
    450  1.3.2.2  ad 
    451  1.3.2.2  ad 	if (uio->uio_resid < 1)
    452  1.3.2.2  ad 		return (EINVAL);
    453  1.3.2.2  ad 
    454  1.3.2.2  ad 	buf = malloc(eip->ei_size + 1, M_EFSTMP, M_ZERO | M_WAITOK);
    455  1.3.2.2  ad 
    456  1.3.2.2  ad 	/* symlinks are either inlined in the inode, or in extents */
    457  1.3.2.2  ad 	if (eip->ei_numextents == 0) {
    458  1.3.2.2  ad 		if (eip->ei_size > sizeof(eip->ei_di.di_symlink)) {
    459  1.3.2.2  ad 			EFS_DPRINTF(("efs_readlink: too big for inline\n"));
    460  1.3.2.2  ad 			free(buf, M_EFSTMP);
    461  1.3.2.2  ad 			return (EBADF);
    462  1.3.2.2  ad 		}
    463  1.3.2.2  ad 
    464  1.3.2.2  ad 		memcpy(buf, eip->ei_di.di_symlink, eip->ei_size);
    465  1.3.2.2  ad 		len = MIN(uio->uio_resid, eip->ei_size + 1);
    466  1.3.2.2  ad 	} else {
    467  1.3.2.2  ad 		struct efs_extent_iterator exi;
    468  1.3.2.2  ad 		struct efs_extent ex;
    469  1.3.2.2  ad 		struct buf *bp;
    470  1.3.2.2  ad 		int resid, off, ret;
    471  1.3.2.2  ad 
    472  1.3.2.2  ad 		off = 0;
    473  1.3.2.2  ad 		resid = eip->ei_size;
    474  1.3.2.2  ad 
    475  1.3.2.2  ad 		efs_extent_iterator_init(&exi, eip, 0);
    476  1.3.2.2  ad 		while ((ret = efs_extent_iterator_next(&exi, &ex)) == 0) {
    477  1.3.2.2  ad 			for (i = 0; i < ex.ex_length; i++) {
    478  1.3.2.2  ad 				err = efs_bread(VFSTOEFS(ap->a_vp->v_mount),
    479  1.3.2.2  ad 				    ex.ex_bn + i, NULL, &bp);
    480  1.3.2.2  ad 				if (err) {
    481  1.3.2.2  ad 					brelse(bp, 0);
    482  1.3.2.2  ad 					free(buf, M_EFSTMP);
    483  1.3.2.2  ad 					return (err);
    484  1.3.2.2  ad 				}
    485  1.3.2.2  ad 
    486  1.3.2.2  ad 				len = MIN(resid, bp->b_bcount);
    487  1.3.2.2  ad 				memcpy(buf + off, bp->b_data, len);
    488  1.3.2.2  ad 				brelse(bp, 0);
    489  1.3.2.2  ad 
    490  1.3.2.2  ad 				off += len;
    491  1.3.2.2  ad 				resid -= len;
    492  1.3.2.2  ad 
    493  1.3.2.2  ad 				if (resid == 0)
    494  1.3.2.2  ad 					break;
    495  1.3.2.2  ad 			}
    496  1.3.2.2  ad 
    497  1.3.2.2  ad 			if (resid == 0)
    498  1.3.2.2  ad 				break;
    499  1.3.2.2  ad 		}
    500  1.3.2.2  ad 
    501  1.3.2.2  ad 		if (ret != 0 && ret != -1) {
    502  1.3.2.2  ad 			free(buf, M_EFSTMP);
    503  1.3.2.2  ad 			return (ret);
    504  1.3.2.2  ad 		}
    505  1.3.2.2  ad 
    506  1.3.2.2  ad 		len = off + 1;
    507  1.3.2.2  ad 	}
    508  1.3.2.2  ad 
    509  1.3.2.2  ad 	KASSERT(len >= 1 && len <= (eip->ei_size + 1));
    510  1.3.2.2  ad 	buf[len - 1] = '\0';
    511  1.3.2.2  ad 	err = uiomove(buf, len, uio);
    512  1.3.2.2  ad 	free(buf, M_EFSTMP);
    513  1.3.2.2  ad 
    514  1.3.2.2  ad 	return (err);
    515  1.3.2.2  ad }
    516  1.3.2.2  ad 
    517  1.3.2.2  ad /*
    518  1.3.2.2  ad  * Release an inactive vnode. The vnode _must_ be unlocked on return.
    519  1.3.2.2  ad  * It is either nolonger being used by the kernel, or an unmount is being
    520  1.3.2.2  ad  * forced.
    521  1.3.2.2  ad  *
    522  1.3.2.2  ad  * Returns 0 on success.
    523  1.3.2.2  ad  */
    524  1.3.2.2  ad static int
    525  1.3.2.2  ad efs_inactive(void *v)
    526  1.3.2.2  ad {
    527  1.3.2.2  ad 	struct vop_inactive_args /* {
    528  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    529  1.3.2.2  ad 		struct vnode *a_vp;
    530  1.3.2.2  ad 		struct lwp *a_l;
    531  1.3.2.2  ad 	} */ *ap = v;
    532  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    533  1.3.2.2  ad 
    534  1.3.2.2  ad 	VOP_UNLOCK(ap->a_vp, 0);
    535  1.3.2.2  ad 
    536  1.3.2.2  ad 	if (eip->ei_mode == 0)
    537  1.3.2.2  ad 		vrecycle(ap->a_vp, NULL, ap->a_l);
    538  1.3.2.2  ad 
    539  1.3.2.2  ad 	return (0);
    540  1.3.2.2  ad }
    541  1.3.2.2  ad 
    542  1.3.2.2  ad static int
    543  1.3.2.2  ad efs_reclaim(void *v)
    544  1.3.2.2  ad {
    545  1.3.2.2  ad 	struct vop_reclaim_args /* {
    546  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    547  1.3.2.2  ad 		struct vnode *a_vp;
    548  1.3.2.2  ad 		struct lwp *a_l;
    549  1.3.2.2  ad 	} */ *ap = v;
    550  1.3.2.2  ad 	struct vnode *vp = ap->a_vp;
    551  1.3.2.2  ad 
    552  1.3.2.2  ad 	efs_ihashrem(EFS_VTOI(vp));
    553  1.3.2.2  ad 	cache_purge(vp);
    554  1.3.2.2  ad 	genfs_node_destroy(vp);
    555  1.3.2.2  ad 	pool_put(&efs_inode_pool, vp->v_data);
    556  1.3.2.2  ad 	vp->v_data = NULL;
    557  1.3.2.2  ad 
    558  1.3.2.2  ad 	return (0);
    559  1.3.2.2  ad }
    560  1.3.2.2  ad 
    561  1.3.2.2  ad static int
    562  1.3.2.2  ad efs_bmap(void *v)
    563  1.3.2.2  ad {
    564  1.3.2.2  ad 	struct vop_bmap_args /* {
    565  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    566  1.3.2.2  ad 		struct vnode *a_vp;
    567  1.3.2.2  ad 		daddr_t a_bn;
    568  1.3.2.2  ad 		struct vnode **a_vpp;
    569  1.3.2.2  ad 		daddr_t *a_bnp;
    570  1.3.2.2  ad 		int *a_runp;
    571  1.3.2.2  ad 	} */ *ap = v;
    572  1.3.2.2  ad 	struct efs_extent ex;
    573  1.3.2.2  ad 	struct efs_extent_iterator exi;
    574  1.3.2.2  ad 	struct vnode *vp = ap->a_vp;
    575  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(vp);
    576  1.3.2.2  ad 	bool found;
    577  1.3.2.2  ad 	int ret;
    578  1.3.2.2  ad 
    579  1.3.2.2  ad 	if (ap->a_vpp != NULL)
    580  1.3.2.2  ad 		*ap->a_vpp = VFSTOEFS(vp->v_mount)->em_devvp;
    581  1.3.2.2  ad 
    582  1.3.2.2  ad 	found = false;
    583  1.3.2.2  ad 	efs_extent_iterator_init(&exi, eip, ap->a_bn * EFS_BB_SIZE);
    584  1.3.2.2  ad 	while ((ret = efs_extent_iterator_next(&exi, &ex)) == 0) {
    585  1.3.2.2  ad 		if (ap->a_bn >= ex.ex_offset &&
    586  1.3.2.2  ad 		    ap->a_bn < (ex.ex_offset + ex.ex_length)) {
    587  1.3.2.2  ad 			found = true;
    588  1.3.2.2  ad 			break;
    589  1.3.2.2  ad 		}
    590  1.3.2.2  ad 	}
    591  1.3.2.2  ad 
    592  1.3.2.2  ad 	KASSERT(!found || (found && ret == 0));
    593  1.3.2.2  ad 
    594  1.3.2.2  ad 	if (!found) {
    595  1.3.2.2  ad 		EFS_DPRINTF(("efs_bmap: ap->a_bn not in extents\n"));
    596  1.3.2.2  ad 		return ((ret == -1) ? EIO : ret);
    597  1.3.2.2  ad 	}
    598  1.3.2.2  ad 
    599  1.3.2.2  ad 	if (ex.ex_magic != EFS_EXTENT_MAGIC) {
    600  1.3.2.2  ad 		EFS_DPRINTF(("efs_bmap: exn.ex_magic != EFS_EXTENT_MAGIC\n"));
    601  1.3.2.2  ad 		return (EIO);
    602  1.3.2.2  ad 	}
    603  1.3.2.2  ad 
    604  1.3.2.2  ad 	if (ap->a_bn < ex.ex_offset) {
    605  1.3.2.2  ad 		EFS_DPRINTF(("efs_bmap: ap->a_bn < exn.ex_offset\n"));
    606  1.3.2.2  ad 		return (EIO);
    607  1.3.2.2  ad 	}
    608  1.3.2.2  ad 
    609  1.3.2.2  ad 	KASSERT(ap->a_bn >= ex.ex_offset);
    610  1.3.2.2  ad 	KASSERT(ex.ex_length > ap->a_bn - ex.ex_offset);
    611  1.3.2.2  ad 
    612  1.3.2.2  ad 	*ap->a_bnp = ex.ex_bn + (ap->a_bn - ex.ex_offset);
    613  1.3.2.2  ad 	if (ap->a_runp != NULL)
    614  1.3.2.2  ad 		*ap->a_runp = ex.ex_length - (ap->a_bn - ex.ex_offset) - 1;
    615  1.3.2.2  ad 
    616  1.3.2.2  ad 	return (0);
    617  1.3.2.2  ad }
    618  1.3.2.2  ad 
    619  1.3.2.2  ad static int
    620  1.3.2.2  ad efs_strategy(void *v)
    621  1.3.2.2  ad {
    622  1.3.2.2  ad 	struct vop_strategy_args /* {
    623  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    624  1.3.2.2  ad 		struct vnode *a_vp;
    625  1.3.2.2  ad 		struct buf *a_bp;
    626  1.3.2.2  ad 	} */ *ap = v;
    627  1.3.2.2  ad 	struct vnode *vp = ap->a_vp;
    628  1.3.2.2  ad 	struct buf *bp = ap->a_bp;
    629  1.3.2.2  ad 	int error;
    630  1.3.2.2  ad 
    631  1.3.2.2  ad 	if (vp == NULL) {
    632  1.3.2.2  ad 		biodone(bp, EIO, 0);
    633  1.3.2.2  ad 		return (EIO);
    634  1.3.2.2  ad 	}
    635  1.3.2.2  ad 
    636  1.3.2.2  ad 	if (bp->b_blkno == bp->b_lblkno) {
    637  1.3.2.2  ad 		error = VOP_BMAP(vp, bp->b_lblkno, NULL, &bp->b_blkno, NULL);
    638  1.3.2.2  ad 		if (error) {
    639  1.3.2.2  ad 			biodone(bp, error, 0);
    640  1.3.2.2  ad 			return (error);
    641  1.3.2.2  ad 		}
    642  1.3.2.2  ad 		if ((long)bp->b_blkno == -1)
    643  1.3.2.2  ad 			clrbuf(bp);
    644  1.3.2.2  ad 	}
    645  1.3.2.2  ad 
    646  1.3.2.2  ad 	if ((long)bp->b_blkno == -1) {
    647  1.3.2.2  ad 		biodone(bp, 0, bp->b_resid);
    648  1.3.2.2  ad 		return (0);
    649  1.3.2.2  ad 	}
    650  1.3.2.2  ad 
    651  1.3.2.2  ad 	return (VOP_STRATEGY(VFSTOEFS(vp->v_mount)->em_devvp, bp));
    652  1.3.2.2  ad }
    653  1.3.2.2  ad 
    654  1.3.2.2  ad static int
    655  1.3.2.2  ad efs_print(void *v)
    656  1.3.2.2  ad {
    657  1.3.2.2  ad 	struct vop_print_args /* {
    658  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    659  1.3.2.2  ad 		struct vnode *a_vp;
    660  1.3.2.2  ad 	} */ *ap = v;
    661  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    662  1.3.2.2  ad 
    663  1.3.2.2  ad 	printf(	"efs_inode (ino %lu):\n"
    664  1.3.2.2  ad 		"    ei_mode:         %07o\n"
    665  1.3.2.2  ad 		"    ei_nlink:        %d\n"
    666  1.3.2.2  ad 		"    ei_uid:          %d\n"
    667  1.3.2.2  ad 		"    ei_gid:          %d\n"
    668  1.3.2.2  ad 		"    ei_size:         %d\n"
    669  1.3.2.2  ad 		"    ei_atime:        %d\n"
    670  1.3.2.2  ad 		"    ei_mtime:        %d\n"
    671  1.3.2.2  ad 		"    ei_ctime:        %d\n"
    672  1.3.2.2  ad 		"    ei_gen:          %d\n"
    673  1.3.2.2  ad 		"    ei_numextents:   %d\n"
    674  1.3.2.2  ad 		"    ei_version:      %d\n",
    675  1.3.2.2  ad 		(unsigned long)eip->ei_number,
    676  1.3.2.2  ad 		(unsigned int)eip->ei_mode,
    677  1.3.2.2  ad 		eip->ei_nlink,
    678  1.3.2.2  ad 		eip->ei_uid,
    679  1.3.2.2  ad 		eip->ei_gid,
    680  1.3.2.2  ad 		eip->ei_size,
    681  1.3.2.2  ad 		(int32_t)eip->ei_atime,
    682  1.3.2.2  ad 		(int32_t)eip->ei_mtime,
    683  1.3.2.2  ad 		(int32_t)eip->ei_ctime,
    684  1.3.2.2  ad 		eip->ei_gen,
    685  1.3.2.2  ad 		eip->ei_numextents,
    686  1.3.2.2  ad 		eip->ei_version);
    687  1.3.2.2  ad 
    688  1.3.2.2  ad 	return (0);
    689  1.3.2.2  ad }
    690  1.3.2.2  ad 
    691  1.3.2.2  ad static int
    692  1.3.2.2  ad efs_pathconf(void *v)
    693  1.3.2.2  ad {
    694  1.3.2.2  ad 	struct vop_pathconf_args /* {
    695  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    696  1.3.2.2  ad 		struct vnode *a_vp;
    697  1.3.2.2  ad 		int a_name;
    698  1.3.2.2  ad 		register_t *a_retval;
    699  1.3.2.2  ad 	} */ *ap = v;
    700  1.3.2.2  ad 
    701  1.3.2.2  ad 	/* IRIX 4 values */
    702  1.3.2.2  ad 	switch (ap->a_name) {
    703  1.3.2.2  ad 	case _PC_LINK_MAX:
    704  1.3.2.2  ad 		*ap->a_retval = 30000;
    705  1.3.2.2  ad 		break;
    706  1.3.2.2  ad 	case _PC_NAME_MAX:
    707  1.3.2.2  ad 		*ap->a_retval = 255;
    708  1.3.2.2  ad 		break;
    709  1.3.2.2  ad 	case _PC_PATH_MAX:
    710  1.3.2.2  ad 		*ap->a_retval = 1024;
    711  1.3.2.2  ad 		break;
    712  1.3.2.2  ad 	case _PC_NO_TRUNC:
    713  1.3.2.2  ad 		*ap->a_retval = 1;
    714  1.3.2.2  ad 		break;
    715  1.3.2.2  ad 	case _PC_CHOWN_RESTRICTED:
    716  1.3.2.2  ad 		*ap->a_retval = 1;
    717  1.3.2.2  ad 		break;
    718  1.3.2.2  ad 	case _PC_SYNC_IO:
    719  1.3.2.2  ad 		*ap->a_retval = 1;
    720  1.3.2.2  ad 		break;
    721  1.3.2.2  ad 	case _PC_FILESIZEBITS:
    722  1.3.2.2  ad 		*ap->a_retval = 32;
    723  1.3.2.2  ad 		break;
    724  1.3.2.2  ad 	default:
    725  1.3.2.2  ad 		return (EINVAL);
    726  1.3.2.2  ad 	}
    727  1.3.2.2  ad 
    728  1.3.2.2  ad 	return (0);
    729  1.3.2.2  ad }
    730  1.3.2.2  ad 
    731  1.3.2.2  ad static int
    732  1.3.2.2  ad efs_advlock(void *v)
    733  1.3.2.2  ad {
    734  1.3.2.2  ad 	struct vop_advlock_args /* {
    735  1.3.2.2  ad 		const struct vnodeop_desc *a_desc;
    736  1.3.2.2  ad 		struct vnode *a_vp;
    737  1.3.2.2  ad 		void *a_id;
    738  1.3.2.2  ad 		int a_op;
    739  1.3.2.2  ad 		struct flock *a_fl;
    740  1.3.2.2  ad 		int a_flags;
    741  1.3.2.2  ad 	} */ *ap = v;
    742  1.3.2.2  ad 	struct efs_inode *eip = EFS_VTOI(ap->a_vp);
    743  1.3.2.2  ad 
    744  1.3.2.2  ad 	return (lf_advlock(ap, &eip->ei_lockf, eip->ei_size));
    745  1.3.2.2  ad }
    746  1.3.2.2  ad 
    747  1.3.2.2  ad /* Global vfs data structures for efs */
    748  1.3.2.2  ad int (**efs_vnodeop_p)(void *);
    749  1.3.2.2  ad const struct vnodeopv_entry_desc efs_vnodeop_entries[] = {
    750  1.3.2.2  ad 	{ &vop_default_desc,	vn_default_error},	/* error handler */
    751  1.3.2.2  ad 	{ &vop_lookup_desc,	efs_lookup	},	/* lookup */
    752  1.3.2.2  ad 	{ &vop_create_desc,	genfs_eopnotsupp},	/* create */
    753  1.3.2.2  ad 	{ &vop_mknod_desc,	genfs_eopnotsupp},	/* mknod */
    754  1.3.2.2  ad 	{ &vop_open_desc,	genfs_nullop	},	/* open */
    755  1.3.2.2  ad 	{ &vop_close_desc,	genfs_nullop	},	/* close */
    756  1.3.2.2  ad 	{ &vop_access_desc,	efs_access	},	/* access */
    757  1.3.2.2  ad 	{ &vop_getattr_desc,	efs_getattr	},	/* getattr */
    758  1.3.2.2  ad 	{ &vop_setattr_desc,	genfs_eopnotsupp},	/* setattr */
    759  1.3.2.2  ad 	{ &vop_read_desc,	efs_read	},	/* read */
    760  1.3.2.2  ad 	{ &vop_write_desc,	genfs_eopnotsupp},	/* write */
    761  1.3.2.2  ad 	{ &vop_ioctl_desc,	genfs_enoioctl	},	/* ioctl */
    762  1.3.2.2  ad 	{ &vop_fcntl_desc,	genfs_fcntl	},	/* fcntl */
    763  1.3.2.2  ad 	{ &vop_poll_desc,	genfs_poll	},	/* poll */
    764  1.3.2.2  ad 	{ &vop_kqfilter_desc,	genfs_kqfilter	},	/* kqfilter */
    765  1.3.2.2  ad 	{ &vop_revoke_desc,	genfs_revoke	},	/* revoke */
    766  1.3.2.2  ad 	{ &vop_mmap_desc,	genfs_mmap	},	/* mmap */
    767  1.3.2.2  ad 	{ &vop_fsync_desc,	genfs_eopnotsupp},	/* fsync */
    768  1.3.2.2  ad 	{ &vop_seek_desc,	genfs_seek	},	/* seek */
    769  1.3.2.2  ad 	{ &vop_remove_desc,	genfs_eopnotsupp},	/* remove */
    770  1.3.2.2  ad 	{ &vop_link_desc,	genfs_eopnotsupp},	/* link */
    771  1.3.2.2  ad 	{ &vop_rename_desc,	genfs_eopnotsupp},	/* rename */
    772  1.3.2.2  ad 	{ &vop_mkdir_desc,	genfs_eopnotsupp},	/* mkdir */
    773  1.3.2.2  ad 	{ &vop_rmdir_desc,	genfs_eopnotsupp},	/* rmdir */
    774  1.3.2.2  ad 	{ &vop_symlink_desc,	genfs_eopnotsupp},	/* symlink */
    775  1.3.2.2  ad 	{ &vop_readdir_desc,	efs_readdir	},	/* readdir */
    776  1.3.2.2  ad 	{ &vop_readlink_desc,	efs_readlink	},	/* readlink */
    777  1.3.2.2  ad 	{ &vop_abortop_desc,	genfs_abortop	},	/* abortop */
    778  1.3.2.2  ad 	{ &vop_inactive_desc,	efs_inactive	},	/* inactive */
    779  1.3.2.2  ad 	{ &vop_reclaim_desc,	efs_reclaim	},	/* reclaim */
    780  1.3.2.2  ad 	{ &vop_lock_desc,	genfs_lock,	},	/* lock */
    781  1.3.2.2  ad 	{ &vop_unlock_desc,	genfs_unlock,	},	/* unlock */
    782  1.3.2.2  ad 	{ &vop_islocked_desc,	genfs_islocked,	},	/* islocked */
    783  1.3.2.2  ad 	{ &vop_bmap_desc,	efs_bmap	},	/* bmap */
    784  1.3.2.2  ad 	{ &vop_print_desc,	efs_print	},	/* print */
    785  1.3.2.2  ad 	{ &vop_pathconf_desc,	efs_pathconf	},	/* pathconf */
    786  1.3.2.2  ad 	{ &vop_advlock_desc,	efs_advlock	},	/* advlock */
    787  1.3.2.2  ad 							/* blkatoff */
    788  1.3.2.2  ad 							/* valloc */
    789  1.3.2.2  ad 							/* balloc */
    790  1.3.2.2  ad 							/* vfree */
    791  1.3.2.2  ad 							/* truncate */
    792  1.3.2.2  ad 	{ &vop_lease_desc,	genfs_lease_check },	/* lease */
    793  1.3.2.2  ad 							/* whiteout */
    794  1.3.2.2  ad 	{ &vop_getpages_desc,	genfs_getpages	},	/* getpages */
    795  1.3.2.2  ad 	{ &vop_putpages_desc,	genfs_putpages	},	/* putpages */
    796  1.3.2.2  ad 	{ &vop_bwrite_desc,	vn_bwrite	},	/* bwrite */
    797  1.3.2.2  ad 	{ &vop_strategy_desc,	efs_strategy	},	/* strategy */
    798  1.3.2.2  ad 	{ NULL, NULL }
    799  1.3.2.2  ad };
    800  1.3.2.2  ad const struct vnodeopv_desc efs_vnodeop_opv_desc = {
    801  1.3.2.2  ad 	&efs_vnodeop_p,
    802  1.3.2.2  ad 	efs_vnodeop_entries
    803  1.3.2.2  ad };
    804