Home | History | Annotate | Line # | Download | only in coda
coda_vfsops.c revision 1.46
      1 /*	$NetBSD: coda_vfsops.c,v 1.46 2005/09/23 12:10:32 jmmv Exp $	*/
      2 
      3 /*
      4  *
      5  *             Coda: an Experimental Distributed File System
      6  *                              Release 3.1
      7  *
      8  *           Copyright (c) 1987-1998 Carnegie Mellon University
      9  *                          All Rights Reserved
     10  *
     11  * Permission  to  use, copy, modify and distribute this software and its
     12  * documentation is hereby granted,  provided  that  both  the  copyright
     13  * notice  and  this  permission  notice  appear  in  all  copies  of the
     14  * software, derivative works or  modified  versions,  and  any  portions
     15  * thereof, and that both notices appear in supporting documentation, and
     16  * that credit is given to Carnegie Mellon University  in  all  documents
     17  * and publicity pertaining to direct or indirect use of this code or its
     18  * derivatives.
     19  *
     20  * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
     21  * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
     22  * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
     23  * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
     24  * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
     25  * ANY DERIVATIVE WORK.
     26  *
     27  * Carnegie  Mellon  encourages  users  of  this  software  to return any
     28  * improvements or extensions that  they  make,  and  to  grant  Carnegie
     29  * Mellon the rights to redistribute these changes without encumbrance.
     30  *
     31  * 	@(#) cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:26:45 rvb Exp $
     32  */
     33 
     34 /*
     35  * Mach Operating System
     36  * Copyright (c) 1989 Carnegie-Mellon University
     37  * All rights reserved.  The CMU software License Agreement specifies
     38  * the terms and conditions for use and redistribution.
     39  */
     40 
     41 /*
     42  * This code was written for the Coda file system at Carnegie Mellon
     43  * University.  Contributers include David Steere, James Kistler, and
     44  * M. Satyanarayanan.
     45  */
     46 
     47 #include <sys/cdefs.h>
     48 __KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.46 2005/09/23 12:10:32 jmmv Exp $");
     49 
     50 #ifdef	_LKM
     51 #define	NVCODA 4
     52 #else
     53 #include <vcoda.h>
     54 #endif
     55 
     56 #include <sys/param.h>
     57 #include <sys/systm.h>
     58 #include <sys/sysctl.h>
     59 #include <sys/malloc.h>
     60 #include <sys/conf.h>
     61 #include <sys/namei.h>
     62 #include <sys/dirent.h>
     63 #include <sys/mount.h>
     64 #include <sys/proc.h>
     65 #include <sys/select.h>
     66 
     67 #include <coda/coda.h>
     68 #include <coda/cnode.h>
     69 #include <coda/coda_vfsops.h>
     70 #include <coda/coda_venus.h>
     71 #include <coda/coda_subr.h>
     72 #include <coda/coda_opstats.h>
     73 /* for VN_RDEV */
     74 #include <miscfs/specfs/specdev.h>
     75 
     76 MALLOC_DEFINE(M_CODA, "coda", "Coda file system structures and tables");
     77 
     78 int codadebug = 0;
     79 
     80 int coda_vfsop_print_entry = 0;
     81 #define ENTRY if(coda_vfsop_print_entry) myprintf(("Entered %s\n",__func__))
     82 
     83 struct vnode *coda_ctlvp;
     84 struct coda_mntinfo coda_mnttbl[NVCODA]; /* indexed by minor device number */
     85 
     86 /* structure to keep statistics of internally generated/satisfied calls */
     87 
     88 struct coda_op_stats coda_vfsopstats[CODA_VFSOPS_SIZE];
     89 
     90 #define MARK_ENTRY(op) (coda_vfsopstats[op].entries++)
     91 #define MARK_INT_SAT(op) (coda_vfsopstats[op].sat_intrn++)
     92 #define MARK_INT_FAIL(op) (coda_vfsopstats[op].unsat_intrn++)
     93 #define MRAK_INT_GEN(op) (coda_vfsopstats[op].gen_intrn++)
     94 
     95 extern const struct cdevsw vcoda_cdevsw;
     96 extern const struct vnodeopv_desc coda_vnodeop_opv_desc;
     97 
     98 const struct vnodeopv_desc * const coda_vnodeopv_descs[] = {
     99 	&coda_vnodeop_opv_desc,
    100 	NULL,
    101 };
    102 
    103 struct vfsops coda_vfsops = {
    104     MOUNT_CODA,
    105     coda_mount,
    106     coda_start,
    107     coda_unmount,
    108     coda_root,
    109     coda_quotactl,
    110     coda_nb_statvfs,
    111     coda_sync,
    112     coda_vget,
    113     NULL,		/* vfs_fhtovp */
    114     NULL,		/* vfs_vptofh */
    115     coda_init,
    116     NULL,
    117     coda_done,
    118     (int (*)(void)) eopnotsupp,
    119     (int (*)(struct mount *, struct vnode *, struct timespec *)) eopnotsupp,
    120     vfs_stdextattrctl,
    121     coda_vnodeopv_descs,
    122     0
    123 };
    124 
    125 VFS_ATTACH(coda_vfsops);
    126 
    127 int
    128 coda_vfsopstats_init(void)
    129 {
    130 	int i;
    131 
    132 	for (i=0;i<CODA_VFSOPS_SIZE;i++) {
    133 		coda_vfsopstats[i].opcode = i;
    134 		coda_vfsopstats[i].entries = 0;
    135 		coda_vfsopstats[i].sat_intrn = 0;
    136 		coda_vfsopstats[i].unsat_intrn = 0;
    137 		coda_vfsopstats[i].gen_intrn = 0;
    138 	}
    139 
    140 	return 0;
    141 }
    142 
    143 /*
    144  * cfs mount vfsop
    145  * Set up mount info record and attach it to vfs struct.
    146  */
    147 /*ARGSUSED*/
    148 int
    149 coda_mount(struct mount *vfsp,	/* Allocated and initialized by mount(2) */
    150 	const char *path,	/* path covered: ignored by the fs-layer */
    151 	void *data,		/* Need to define a data type for this in netbsd? */
    152 	struct nameidata *ndp,	/* Clobber this to lookup the device name */
    153 	struct proc *p)		/* The ever-famous proc pointer */
    154 {
    155     struct vnode *dvp;
    156     struct cnode *cp;
    157     dev_t dev;
    158     struct coda_mntinfo *mi;
    159     struct vnode *rtvp;
    160     const struct cdevsw *cdev;
    161     CodaFid rootfid = INVAL_FID;
    162     CodaFid ctlfid = CTL_FID;
    163     int error;
    164 
    165     if (vfsp->mnt_flag & MNT_GETARGS)
    166 	return 0;
    167     ENTRY;
    168 
    169     coda_vfsopstats_init();
    170     coda_vnodeopstats_init();
    171 
    172     MARK_ENTRY(CODA_MOUNT_STATS);
    173     if (CODA_MOUNTED(vfsp)) {
    174 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    175 	return(EBUSY);
    176     }
    177 
    178     /* Validate mount device.  Similar to getmdev(). */
    179 
    180     NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p);
    181     error = namei(ndp);
    182     dvp = ndp->ni_vp;
    183 
    184     if (error) {
    185 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    186 	return (error);
    187     }
    188     if (dvp->v_type != VCHR) {
    189 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    190 	vrele(dvp);
    191 	return(ENXIO);
    192     }
    193     dev = dvp->v_specinfo->si_rdev;
    194     vrele(dvp);
    195     cdev = cdevsw_lookup(dev);
    196     if (cdev == NULL) {
    197 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    198 	return(ENXIO);
    199     }
    200 
    201     /*
    202      * See if the device table matches our expectations.
    203      */
    204     if (cdev != &vcoda_cdevsw)
    205     {
    206 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    207 	return(ENXIO);
    208     }
    209 
    210     if (minor(dev) >= NVCODA || minor(dev) < 0) {
    211 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    212 	return(ENXIO);
    213     }
    214 
    215     /*
    216      * Initialize the mount record and link it to the vfs struct
    217      */
    218     mi = &coda_mnttbl[minor(dev)];
    219 
    220     if (!VC_OPEN(&mi->mi_vcomm)) {
    221 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    222 	return(ENODEV);
    223     }
    224 
    225     /* No initialization (here) of mi_vcomm! */
    226     vfsp->mnt_data = mi;
    227     vfsp->mnt_stat.f_fsidx.__fsid_val[0] = 0;
    228     vfsp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_CODA);
    229     vfsp->mnt_stat.f_fsid = vfsp->mnt_stat.f_fsidx.__fsid_val[0];
    230     vfsp->mnt_stat.f_namemax = MAXNAMLEN;
    231     mi->mi_vfsp = vfsp;
    232 
    233     /*
    234      * Make a root vnode to placate the Vnode interface, but don't
    235      * actually make the CODA_ROOT call to venus until the first call
    236      * to coda_root in case a server is down while venus is starting.
    237      */
    238     cp = make_coda_node(&rootfid, vfsp, VDIR);
    239     rtvp = CTOV(cp);
    240     rtvp->v_flag |= VROOT;
    241 
    242 /*  cp = make_coda_node(&ctlfid, vfsp, VCHR);
    243     The above code seems to cause a loop in the cnode links.
    244     I don't totally understand when it happens, it is caught
    245     when closing down the system.
    246  */
    247     cp = make_coda_node(&ctlfid, 0, VCHR);
    248 
    249     coda_ctlvp = CTOV(cp);
    250 
    251     /* Add vfs and rootvp to chain of vfs hanging off mntinfo */
    252     mi->mi_vfsp = vfsp;
    253     mi->mi_rootvp = rtvp;
    254 
    255     /* set filesystem block size */
    256     vfsp->mnt_stat.f_bsize = 8192;	    /* XXX -JJK */
    257     vfsp->mnt_stat.f_frsize = 8192;	    /* XXX -JJK */
    258 
    259     /* error is currently guaranteed to be zero, but in case some
    260        code changes... */
    261     CODADEBUG(1,
    262 	     myprintf(("coda_mount returned %d\n",error)););
    263     if (error)
    264 	MARK_INT_FAIL(CODA_MOUNT_STATS);
    265     else
    266 	MARK_INT_SAT(CODA_MOUNT_STATS);
    267 
    268     return set_statvfs_info("/coda", UIO_SYSSPACE, "CODA", UIO_SYSSPACE, vfsp,
    269 	p);
    270 }
    271 
    272 int
    273 coda_start(struct mount *vfsp, int flags, struct proc *p)
    274 {
    275     ENTRY;
    276     vftomi(vfsp)->mi_started = 1;
    277     return (0);
    278 }
    279 
    280 int
    281 coda_unmount(struct mount *vfsp, int mntflags, struct proc *p)
    282 {
    283     struct coda_mntinfo *mi = vftomi(vfsp);
    284     int active, error = 0;
    285 
    286     ENTRY;
    287     MARK_ENTRY(CODA_UMOUNT_STATS);
    288     if (!CODA_MOUNTED(vfsp)) {
    289 	MARK_INT_FAIL(CODA_UMOUNT_STATS);
    290 	return(EINVAL);
    291     }
    292 
    293     if (mi->mi_vfsp == vfsp) {	/* We found the victim */
    294 	if (!IS_UNMOUNTING(VTOC(mi->mi_rootvp)))
    295 	    return (EBUSY); 	/* Venus is still running */
    296 
    297 #ifdef	DEBUG
    298 	printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
    299 #endif
    300 	mi->mi_started = 0;
    301 
    302 	vrele(mi->mi_rootvp);
    303 
    304 	active = coda_kill(vfsp, NOT_DOWNCALL);
    305 	mi->mi_rootvp->v_flag &= ~VROOT;
    306 	error = vflush(mi->mi_vfsp, NULLVP, FORCECLOSE);
    307 	printf("coda_unmount: active = %d, vflush active %d\n", active, error);
    308 	error = 0;
    309 
    310 	/* I'm going to take this out to allow lookups to go through. I'm
    311 	 * not sure it's important anyway. -- DCS 2/2/94
    312 	 */
    313 	/* vfsp->VFS_DATA = NULL; */
    314 
    315 	/* No more vfsp's to hold onto */
    316 	mi->mi_vfsp = NULL;
    317 	mi->mi_rootvp = NULL;
    318 
    319 	if (error)
    320 	    MARK_INT_FAIL(CODA_UMOUNT_STATS);
    321 	else
    322 	    MARK_INT_SAT(CODA_UMOUNT_STATS);
    323 
    324 	return(error);
    325     }
    326     return (EINVAL);
    327 }
    328 
    329 /*
    330  * find root of cfs
    331  */
    332 int
    333 coda_root(struct mount *vfsp, struct vnode **vpp)
    334 {
    335     struct coda_mntinfo *mi = vftomi(vfsp);
    336     int error;
    337     struct proc *p = curproc;    /* XXX - bnoble */
    338     CodaFid VFid;
    339     static const CodaFid invalfid = INVAL_FID;
    340 
    341     ENTRY;
    342     MARK_ENTRY(CODA_ROOT_STATS);
    343 
    344     if (vfsp == mi->mi_vfsp) {
    345     	if (memcmp(&VTOC(mi->mi_rootvp)->c_fid, &invalfid, sizeof(CodaFid)))
    346 	    { /* Found valid root. */
    347 		*vpp = mi->mi_rootvp;
    348 		/* On Mach, this is vref.  On NetBSD, VOP_LOCK */
    349 		vref(*vpp);
    350 		vn_lock(*vpp, LK_EXCLUSIVE);
    351 		MARK_INT_SAT(CODA_ROOT_STATS);
    352 		return(0);
    353 	    }
    354     }
    355 
    356     error = venus_root(vftomi(vfsp), p->p_cred->pc_ucred, p, &VFid);
    357 
    358     if (!error) {
    359 	/*
    360 	 * Save the new rootfid in the cnode, and rehash the cnode into the
    361 	 * cnode hash with the new fid key.
    362 	 */
    363 	coda_unsave(VTOC(mi->mi_rootvp));
    364 	VTOC(mi->mi_rootvp)->c_fid = VFid;
    365 	coda_save(VTOC(mi->mi_rootvp));
    366 
    367 	*vpp = mi->mi_rootvp;
    368 	vref(*vpp);
    369 	vn_lock(*vpp, LK_EXCLUSIVE);
    370 	MARK_INT_SAT(CODA_ROOT_STATS);
    371 	goto exit;
    372     } else if (error == ENODEV || error == EINTR) {
    373 	/* Gross hack here! */
    374 	/*
    375 	 * If Venus fails to respond to the CODA_ROOT call, coda_call returns
    376 	 * ENODEV. Return the uninitialized root vnode to allow vfs
    377 	 * operations such as unmount to continue. Without this hack,
    378 	 * there is no way to do an unmount if Venus dies before a
    379 	 * successful CODA_ROOT call is done. All vnode operations
    380 	 * will fail.
    381 	 */
    382 	*vpp = mi->mi_rootvp;
    383 	vref(*vpp);
    384 	vn_lock(*vpp, LK_EXCLUSIVE);
    385 	MARK_INT_FAIL(CODA_ROOT_STATS);
    386 	error = 0;
    387 	goto exit;
    388     } else {
    389 	CODADEBUG( CODA_ROOT, myprintf(("error %d in CODA_ROOT\n", error)); );
    390 	MARK_INT_FAIL(CODA_ROOT_STATS);
    391 
    392 	goto exit;
    393     }
    394  exit:
    395     return(error);
    396 }
    397 
    398 int
    399 coda_quotactl(struct mount *vfsp, int cmd, uid_t uid, void *arg,
    400 	struct proc *p)
    401 {
    402     ENTRY;
    403     return (EOPNOTSUPP);
    404 }
    405 
    406 /*
    407  * Get file system statistics.
    408  */
    409 int
    410 coda_nb_statvfs(struct mount *vfsp, struct statvfs *sbp, struct proc *p)
    411 {
    412     struct coda_statfs fsstat;
    413     int error;
    414 
    415     ENTRY;
    416     MARK_ENTRY(CODA_STATFS_STATS);
    417     if (!CODA_MOUNTED(vfsp)) {
    418 /*	MARK_INT_FAIL(CODA_STATFS_STATS); */
    419 	return(EINVAL);
    420     }
    421 
    422     /* XXX - what to do about f_flags, others? --bnoble */
    423     /* Below This is what AFS does
    424     	#define NB_SFS_SIZ 0x895440
    425      */
    426     /* Note: Normal fs's have a bsize of 0x400 == 1024 */
    427 
    428     error = venus_statfs(vftomi(vfsp), p->p_cred->pc_ucred, p, &fsstat);
    429 
    430     if (!error) {
    431 	sbp->f_bsize = 8192; /* XXX */
    432 	sbp->f_frsize = 8192; /* XXX */
    433 	sbp->f_iosize = 8192; /* XXX */
    434 	sbp->f_blocks = fsstat.f_blocks;
    435 	sbp->f_bfree  = fsstat.f_bfree;
    436 	sbp->f_bavail = fsstat.f_bavail;
    437 	sbp->f_bresvd = 0;
    438 	sbp->f_files  = fsstat.f_files;
    439 	sbp->f_ffree  = fsstat.f_ffree;
    440 	sbp->f_favail = fsstat.f_ffree;
    441 	sbp->f_fresvd = 0;
    442 	copy_statvfs_info(sbp, vfsp);
    443     }
    444 
    445     MARK_INT_SAT(CODA_STATFS_STATS);
    446     return(error);
    447 }
    448 
    449 /*
    450  * Flush any pending I/O.
    451  */
    452 int
    453 coda_sync(struct mount *vfsp, int waitfor, struct ucred *cred, struct proc *p)
    454 {
    455     ENTRY;
    456     MARK_ENTRY(CODA_SYNC_STATS);
    457     MARK_INT_SAT(CODA_SYNC_STATS);
    458     return(0);
    459 }
    460 
    461 int
    462 coda_vget(struct mount *vfsp, ino_t ino, struct vnode **vpp)
    463 {
    464     ENTRY;
    465     return (EOPNOTSUPP);
    466 }
    467 
    468 /*
    469  * fhtovp is now what vget used to be in 4.3-derived systems.  For
    470  * some silly reason, vget is now keyed by a 32 bit ino_t, rather than
    471  * a type-specific fid.
    472  */
    473 int
    474 coda_fhtovp(struct mount *vfsp, struct fid *fhp, struct mbuf *nam,
    475 	struct vnode **vpp, int *exflagsp, struct ucred **creadanonp)
    476 {
    477     struct cfid *cfid = (struct cfid *)fhp;
    478     struct cnode *cp = 0;
    479     int error;
    480     struct proc *p = curproc; /* XXX -mach */
    481     CodaFid VFid;
    482     int vtype;
    483 
    484     ENTRY;
    485 
    486     MARK_ENTRY(CODA_VGET_STATS);
    487     /* Check for vget of control object. */
    488     if (IS_CTL_FID(&cfid->cfid_fid)) {
    489 	*vpp = coda_ctlvp;
    490 	vref(coda_ctlvp);
    491 	MARK_INT_SAT(CODA_VGET_STATS);
    492 	return(0);
    493     }
    494 
    495     error = venus_fhtovp(vftomi(vfsp), &cfid->cfid_fid, p->p_cred->pc_ucred, p, &VFid, &vtype);
    496 
    497     if (error) {
    498 	CODADEBUG(CODA_VGET, myprintf(("vget error %d\n",error));)
    499 	    *vpp = (struct vnode *)0;
    500     } else {
    501 	CODADEBUG(CODA_VGET,
    502 		 myprintf(("vget: %s type %d result %d\n",
    503 			coda_f2s(&VFid), vtype, error)); )
    504 
    505 	cp = make_coda_node(&VFid, vfsp, vtype);
    506 	*vpp = CTOV(cp);
    507     }
    508     return(error);
    509 }
    510 
    511 int
    512 coda_vptofh(struct vnode *vnp, struct fid *fidp)
    513 {
    514     ENTRY;
    515     return (EOPNOTSUPP);
    516 }
    517 
    518 void
    519 coda_init(void)
    520 {
    521     ENTRY;
    522 }
    523 
    524 void
    525 coda_done(void)
    526 {
    527     ENTRY;
    528 }
    529 
    530 SYSCTL_SETUP(sysctl_vfs_coda_setup, "sysctl vfs.coda subtree setup")
    531 {
    532 	sysctl_createv(clog, 0, NULL, NULL,
    533 		       CTLFLAG_PERMANENT,
    534 		       CTLTYPE_NODE, "vfs", NULL,
    535 		       NULL, 0, NULL, 0,
    536 		       CTL_VFS, CTL_EOL);
    537 	sysctl_createv(clog, 0, NULL, NULL,
    538 		       CTLFLAG_PERMANENT,
    539 		       CTLTYPE_NODE, "coda",
    540 		       SYSCTL_DESCR("code vfs options"),
    541 		       NULL, 0, NULL, 0,
    542 		       CTL_VFS, 18, CTL_EOL);
    543 	/*
    544 	 * XXX the "18" above could be dynamic, thereby eliminating
    545 	 * one more instance of the "number to vfs" mapping problem,
    546 	 * but "18" is the order as taken from sys/mount.h
    547 	 */
    548 
    549 /*
    550 	sysctl_createv(clog, 0, NULL, NULL,
    551 		       CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
    552 		       CTLTYPE_INT, "clusterread",
    553 		       SYSCTL_DESCR( anyone? ),
    554 		       NULL, 0, &doclusterread, 0,
    555 		       CTL_VFS, 18, FFS_CLUSTERREAD, CTL_EOL);
    556 */
    557 }
    558 
    559 /*
    560  * To allow for greater ease of use, some vnodes may be orphaned when
    561  * Venus dies.  Certain operations should still be allowed to go
    562  * through, but without propagating orphan-ness.  So this function will
    563  * get a new vnode for the file from the current run of Venus.
    564  */
    565 
    566 int
    567 getNewVnode(struct vnode **vpp)
    568 {
    569     struct cfid cfid;
    570     struct coda_mntinfo *mi = vftomi((*vpp)->v_mount);
    571 
    572     ENTRY;
    573 
    574     cfid.cfid_len = (short)sizeof(CodaFid);
    575     cfid.cfid_fid = VTOC(*vpp)->c_fid;	/* Structure assignment. */
    576     /* XXX ? */
    577 
    578     /* We're guessing that if set, the 1st element on the list is a
    579      * valid vnode to use. If not, return ENODEV as venus is dead.
    580      */
    581     if (mi->mi_vfsp == NULL)
    582 	return ENODEV;
    583 
    584     return coda_fhtovp(mi->mi_vfsp, (struct fid*)&cfid, NULL, vpp,
    585 		      NULL, NULL);
    586 }
    587 
    588 #include <ufs/ufs/quota.h>
    589 #include <ufs/ufs/ufsmount.h>
    590 /* get the mount structure corresponding to a given device.  Assume
    591  * device corresponds to a UFS. Return NULL if no device is found.
    592  */
    593 struct mount *devtomp(dev_t dev)
    594 {
    595     struct mount *mp, *nmp;
    596 
    597     for (mp = mountlist.cqh_first; mp != (void*)&mountlist; mp = nmp) {
    598 	nmp = mp->mnt_list.cqe_next;
    599 	if ((!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) &&
    600 	    ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
    601 	    /* mount corresponds to UFS and the device matches one we want */
    602 	    return(mp);
    603 	}
    604     }
    605     /* mount structure wasn't found */
    606     return(NULL);
    607 }
    608