Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Remove a simplelock and replace with a kmutex
details: https://anonhg.NetBSD.org/src/rev/2054529455b7
branches: trunk
changeset: 327845:2054529455b7
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Mar 18 15:44:37 2014 +0000
description:
Remove a simplelock and replace with a kmutex
diffstat:
sys/dev/cgd.c | 14 +++++++-------
sys/dev/cgdvar.h | 6 ++----
2 files changed, 9 insertions(+), 11 deletions(-)
diffs (81 lines):
diff -r 34dbbfc9dc82 -r 2054529455b7 sys/dev/cgd.c
--- a/sys/dev/cgd.c Tue Mar 18 14:34:31 2014 +0000
+++ b/sys/dev/cgd.c Tue Mar 18 15:44:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.84 2014/03/16 05:20:26 dholland Exp $ */
+/* $NetBSD: cgd.c,v 1.85 2014/03/18 15:44:37 skrll Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.84 2014/03/16 05:20:26 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.85 2014/03/18 15:44:37 skrll Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -200,7 +200,7 @@
{
struct cgd_softc *sc = device_private(self);
- simple_lock_init(&sc->sc_slock);
+ mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_BIO);
dk_sc_init(&sc->sc_dksc, device_xname(self));
sc->sc_dksc.sc_dev = self;
disk_init(&sc->sc_dksc.sc_dkdev, sc->sc_dksc.sc_xname, &cgddkdriver);
@@ -354,12 +354,12 @@
struct cgd_softc *cs = (struct cgd_softc *)dksc;
void * data = NULL;
- simple_lock(&cs->sc_slock);
+ mutex_enter(&cs->sc_lock);
if (cs->sc_data_used == 0) {
cs->sc_data_used = 1;
data = cs->sc_data;
}
- simple_unlock(&cs->sc_slock);
+ mutex_exit(&cs->sc_lock);
if (data)
return data;
@@ -373,9 +373,9 @@
struct cgd_softc *cs = (struct cgd_softc *)dksc;
if (data == cs->sc_data) {
- simple_lock(&cs->sc_slock);
+ mutex_enter(&cs->sc_lock);
cs->sc_data_used = 0;
- simple_unlock(&cs->sc_slock);
+ mutex_exit(&cs->sc_lock);
} else {
free(data, M_DEVBUF);
}
diff -r 34dbbfc9dc82 -r 2054529455b7 sys/dev/cgdvar.h
--- a/sys/dev/cgdvar.h Tue Mar 18 14:34:31 2014 +0000
+++ b/sys/dev/cgdvar.h Tue Mar 18 15:44:37 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cgdvar.h,v 1.16 2012/12/05 02:23:20 christos Exp $ */
+/* $NetBSD: cgdvar.h,v 1.17 2014/03/18 15:44:37 skrll Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -32,8 +32,6 @@
#ifndef _DEV_CGDVAR_H_
#define _DEV_CGDVAR_H_
-#include <sys/simplelock.h>
-
/* ioctl(2) code: used by CGDIOCSET and CGDIOCCLR */
struct cgd_ioctl {
const char *ci_disk;
@@ -90,7 +88,7 @@
size_t sc_tpathlen; /* length of prior string */
struct cryptdata sc_cdata; /* crypto data */
const struct cryptfuncs *sc_cfuncs; /* encryption functions */
- struct simplelock sc_slock; /* our lock */
+ kmutex_t sc_lock; /* our lock */
};
#endif
Home |
Main Index |
Thread Index |
Old Index