Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/coda replace open-coded scan with macro; fix locking
details: https://anonhg.NetBSD.org/src/rev/4c3fd1c9cf16
branches: trunk
changeset: 791564:4c3fd1c9cf16
user: christos <christos%NetBSD.org@localhost>
date: Sat Nov 23 17:57:23 2013 +0000
description:
replace open-coded scan with macro; fix locking
diffstat:
sys/coda/coda_vfsops.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diffs (41 lines):
diff -r e881a182af75 -r 4c3fd1c9cf16 sys/coda/coda_vfsops.c
--- a/sys/coda/coda_vfsops.c Sat Nov 23 17:40:43 2013 +0000
+++ b/sys/coda/coda_vfsops.c Sat Nov 23 17:57:23 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coda_vfsops.c,v 1.75 2013/11/23 16:15:24 riz Exp $ */
+/* $NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $ */
/*
*
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.75 2013/11/23 16:15:24 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.76 2013/11/23 17:57:23 christos Exp $");
#ifndef _KERNEL_OPT
#define NVCODA 4
@@ -613,16 +613,16 @@
*/
struct mount *devtomp(dev_t dev)
{
- struct mount *mp, *nmp;
+ struct mount *mp;
- for (mp = mountlist.tqh_first; mp != (void*)&mountlist; mp = nmp) {
- nmp = mp->mnt_list.tqe_next;
+ 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 */
- return(mp);
+ break;
}
}
- /* mount structure wasn't found */
- return(NULL);
+ mutex_exit(&mountlist_lock);
+ return mp == TAILQ_END(&mountlist) ? NULL : mp;
}
Home |
Main Index |
Thread Index |
Old Index