Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/coda Use spec_node_lookup_by_dev() and spec_node_getmoun...



details:   https://anonhg.NetBSD.org/src/rev/570bca2da8cc
branches:  trunk
changeset: 352486:570bca2da8cc
user:      hannken <hannken%NetBSD.org@localhost>
date:      Tue Apr 04 07:36:38 2017 +0000

description:
Use spec_node_lookup_by_dev() and spec_node_getmountedfs() to
retrieve a mount by device.

diffstat:

 sys/coda/coda_vfsops.c |  25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

diffs (51 lines):

diff -r 50e12ab9841d -r 570bca2da8cc sys/coda/coda_vfsops.c
--- a/sys/coda/coda_vfsops.c    Tue Apr 04 04:34:43 2017 +0000
+++ b/sys/coda/coda_vfsops.c    Tue Apr 04 07:36:38 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vfsops.c,v 1.85 2017/02/17 08:31:23 hannken Exp $ */
+/*     $NetBSD: coda_vfsops.c,v 1.86 2017/04/04 07:36:38 hannken Exp $ */
 
 /*
  *
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.85 2017/02/17 08:31:23 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.86 2017/04/04 07:36:38 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -624,23 +624,20 @@
                      NULL, NULL);
 }
 
-#include <ufs/ufs/quota.h>
-#include <ufs/ufs/ufsmount.h>
-/* get the mount structure corresponding to a given device.  Assume
- * device corresponds to a UFS. Return NULL if no device is found.
+/* Get the mount structure corresponding to a given device.
+ * Return NULL if no device is found or the device is not mounted.
  */
 struct mount *devtomp(dev_t dev)
 {
     struct mount *mp;
+    struct vnode *vp;
 
-    mutex_enter(&mountlist_lock);
-    TAILQ_FOREACH(mp, &mountlist, mnt_list) {
-       if ((!strcmp(mp->mnt_op->vfs_name, MOUNT_UFS)) &&
-           ((VFSTOUFS(mp))->um_dev == (dev_t) dev)) {
-           /* mount corresponds to UFS and the device matches one we want */
-           break;
-       }
+    if (spec_node_lookup_by_dev(VBLK, dev, &vp) == 0) {
+       mp = spec_node_getmountedfs(vp);
+       vrele(vp);
+    } else {
+       mp = NULL;
     }
-    mutex_exit(&mountlist_lock);
+
     return mp;
 }



Home | Main Index | Thread Index | Old Index