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