Replace some uses of lockmgr().
This commit is contained in:
parent
5aaa0be03a
commit
b5a9ff06f1
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wd.c,v 1.340 2007/07/09 21:00:31 ad Exp $ */
|
||||
/* $NetBSD: wd.c,v 1.341 2007/07/21 19:51:47 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
|
||||
@ -66,7 +66,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.340 2007/07/09 21:00:31 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.341 2007/07/21 19:51:47 ad Exp $");
|
||||
|
||||
#include "opt_ata.h"
|
||||
|
||||
@ -904,8 +904,7 @@ wdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
|
||||
part = WDPART(dev);
|
||||
|
||||
if ((error = lockmgr(&wd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&wd->sc_dk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -965,14 +964,14 @@ wdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
wd->sc_dk.dk_openmask =
|
||||
wd->sc_dk.dk_copenmask | wd->sc_dk.dk_bopenmask;
|
||||
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
return 0;
|
||||
|
||||
bad2:
|
||||
if (wd->sc_dk.dk_openmask == 0)
|
||||
wd->atabus->ata_delref(wd->drvp);
|
||||
bad1:
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -981,12 +980,10 @@ wdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
{
|
||||
struct wd_softc *wd = device_lookup(&wd_cd, WDUNIT(dev));
|
||||
int part = WDPART(dev);
|
||||
int error;
|
||||
|
||||
ATADEBUG_PRINT(("wdclose\n"), DEBUG_FUNCS);
|
||||
|
||||
if ((error = lockmgr(&wd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return error;
|
||||
mutex_enter(&wd->sc_dk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -1008,7 +1005,7 @@ wdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
wd->atabus->ata_delref(wd->drvp);
|
||||
}
|
||||
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1279,9 +1276,7 @@ wdioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
|
||||
#endif
|
||||
lp = (struct disklabel *)addr;
|
||||
|
||||
if ((error = lockmgr(&wd->sc_dk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
goto bad;
|
||||
mutex_enter(&wd->sc_dk.dk_openlock);
|
||||
wd->sc_flags |= WDF_LABELLING;
|
||||
|
||||
error = setdisklabel(wd->sc_dk.dk_label,
|
||||
@ -1304,8 +1299,7 @@ wdioctl(dev_t dev, u_long xfer, void *addr, int flag, struct lwp *l)
|
||||
}
|
||||
|
||||
wd->sc_flags &= ~WDF_LABELLING;
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
bad:
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
#ifdef __HAVE_OLD_DISKLABEL
|
||||
if (newlabel != NULL)
|
||||
free(newlabel, M_TEMP);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dksubr.c,v 1.29 2007/06/26 15:22:23 cube Exp $ */
|
||||
/* $NetBSD: dksubr.c,v 1.30 2007/07/21 19:51:47 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc.
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.29 2007/06/26 15:22:23 cube Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.30 2007/07/21 19:51:47 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -100,9 +100,7 @@ dk_open(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
DPRINTF_FOLLOW(("dk_open(%s, %p, 0x%x, 0x%x)\n",
|
||||
di->di_dkname, dksc, dev, flags));
|
||||
|
||||
if ((ret = lockmgr(&dk->dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return ret;
|
||||
|
||||
mutex_enter(&dk->dk_openlock);
|
||||
part = DISKPART(dev);
|
||||
|
||||
/*
|
||||
@ -149,7 +147,7 @@ dk_open(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
dk->dk_openmask = dk->dk_copenmask | dk->dk_bopenmask;
|
||||
|
||||
done:
|
||||
lockmgr(&dk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&dk->dk_openlock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -160,14 +158,12 @@ dk_close(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
{
|
||||
int part = DISKPART(dev);
|
||||
int pmask = 1 << part;
|
||||
int ret;
|
||||
struct disk *dk = &dksc->sc_dkdev;
|
||||
|
||||
DPRINTF_FOLLOW(("dk_close(%s, %p, 0x%x, 0x%x)\n",
|
||||
di->di_dkname, dksc, dev, flags));
|
||||
|
||||
if ((ret = lockmgr(&dk->dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return ret;
|
||||
mutex_enter(&dk->dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -179,7 +175,7 @@ dk_close(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
}
|
||||
dk->dk_openmask = dk->dk_copenmask | dk->dk_bopenmask;
|
||||
|
||||
lockmgr(&dk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&dk->dk_openlock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -376,11 +372,7 @@ dk_ioctl(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
lp = (struct disklabel *)data;
|
||||
|
||||
dk = &dksc->sc_dkdev;
|
||||
error = lockmgr(&dk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
if (error) {
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_enter(&dk->dk_openlock);
|
||||
dksc->sc_flags |= DKF_LABELLING;
|
||||
|
||||
error = setdisklabel(dksc->sc_dkdev.dk_label,
|
||||
@ -397,7 +389,7 @@ dk_ioctl(struct dk_intf *di, struct dk_softc *dksc, dev_t dev,
|
||||
}
|
||||
|
||||
dksc->sc_flags &= ~DKF_LABELLING;
|
||||
error = lockmgr(&dk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&dk->dk_openlock);
|
||||
break;
|
||||
|
||||
case DIOCWLABEL:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: dk.c,v 1.26 2007/07/09 21:00:32 ad Exp $ */
|
||||
/* $NetBSD: dk.c,v 1.27 2007/07/21 19:51:47 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -37,7 +37,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.26 2007/07/09 21:00:32 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.27 2007/07/21 19:51:47 ad Exp $");
|
||||
|
||||
#include "opt_dkwedge.h"
|
||||
|
||||
@ -57,7 +57,6 @@ __KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.26 2007/07/09 21:00:32 ad Exp $");
|
||||
#include <sys/conf.h>
|
||||
#include <sys/callout.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kauth.h>
|
||||
@ -122,12 +121,10 @@ const struct cdevsw dk_cdevsw = {
|
||||
|
||||
static struct dkwedge_softc **dkwedges;
|
||||
static u_int ndkwedges;
|
||||
static struct lock dkwedges_lock = LOCK_INITIALIZER(PRIBIO, "dkwgs", 0, 0);
|
||||
static krwlock_t dkwedges_lock;
|
||||
|
||||
static LIST_HEAD(, dkwedge_discovery_method) dkwedge_discovery_methods;
|
||||
static int dkwedge_discovery_methods_initialized;
|
||||
static struct lock dkwedge_discovery_methods_lock =
|
||||
LOCK_INITIALIZER(PRIBIO, "dkddm", 0, 0);
|
||||
static krwlock_t dkwedge_discovery_methods_lock;
|
||||
|
||||
/*
|
||||
* dkwedge_match:
|
||||
@ -173,26 +170,6 @@ CFDRIVER_DECL(dk, DV_DISK, NULL);
|
||||
CFATTACH_DECL(dk, sizeof(struct device),
|
||||
dkwedge_match, dkwedge_attach, dkwedge_detach, NULL);
|
||||
|
||||
static int dkwedge_cfglue_initialized;
|
||||
static struct simplelock dkwedge_cfglue_initialized_slock =
|
||||
SIMPLELOCK_INITIALIZER;
|
||||
|
||||
static void
|
||||
dkwedge_cfglue_init(void)
|
||||
{
|
||||
|
||||
simple_lock(&dkwedge_cfglue_initialized_slock);
|
||||
if (dkwedge_cfglue_initialized == 0) {
|
||||
if (config_cfdriver_attach(&dk_cd) != 0)
|
||||
panic("dkwedge: unable to attach cfdriver");
|
||||
if (config_cfattach_attach(dk_cd.cd_name, &dk_ca) != 0)
|
||||
panic("dkwedge: unable to attach cfattach");
|
||||
|
||||
dkwedge_cfglue_initialized = 1;
|
||||
}
|
||||
simple_unlock(&dkwedge_cfglue_initialized_slock);
|
||||
}
|
||||
|
||||
/*
|
||||
* dkwedge_wait_drain:
|
||||
*
|
||||
@ -276,9 +253,6 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
int error;
|
||||
dev_t pdev;
|
||||
|
||||
if (dkwedge_cfglue_initialized == 0)
|
||||
dkwedge_cfglue_init();
|
||||
|
||||
dkw->dkw_parent[sizeof(dkw->dkw_parent) - 1] = '\0';
|
||||
pdk = disk_find(dkw->dkw_parent);
|
||||
if (pdk == NULL)
|
||||
@ -313,7 +287,7 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
* Wedge will be added; increment the wedge count for the parent.
|
||||
* Only allow this to happend if RAW_PART is the only thing open.
|
||||
*/
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&pdk->dk_openlock);
|
||||
if (pdk->dk_openmask & ~(1 << RAW_PART))
|
||||
error = EBUSY;
|
||||
else {
|
||||
@ -340,7 +314,7 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
LIST_INSERT_HEAD(&pdk->dk_wedges, sc, sc_plink);
|
||||
}
|
||||
}
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
if (error) {
|
||||
bufq_free(sc->sc_bufq);
|
||||
free(sc, M_DKWEDGE);
|
||||
@ -354,7 +328,7 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
sc->sc_cfdata.cf_fstate = FSTATE_STAR;
|
||||
|
||||
/* Insert the larval wedge into the array. */
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (error = 0;;) {
|
||||
struct dkwedge_softc **scpp;
|
||||
|
||||
@ -388,12 +362,12 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
if (error) {
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&pdk->dk_openlock);
|
||||
pdk->dk_nwedges--;
|
||||
LIST_REMOVE(sc, sc_plink);
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
|
||||
bufq_free(sc->sc_bufq);
|
||||
free(sc, M_DKWEDGE);
|
||||
@ -413,14 +387,14 @@ dkwedge_add(struct dkwedge_info *dkw)
|
||||
aprint_error("%s%u: unable to attach pseudo-device\n",
|
||||
sc->sc_cfdata.cf_name, sc->sc_cfdata.cf_unit);
|
||||
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
dkwedges[sc->sc_cfdata.cf_unit] = NULL;
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&pdk->dk_openlock);
|
||||
pdk->dk_nwedges--;
|
||||
LIST_REMOVE(sc, sc_plink);
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
|
||||
bufq_free(sc->sc_bufq);
|
||||
free(sc, M_DKWEDGE);
|
||||
@ -466,7 +440,7 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
|
||||
/* Find our softc. */
|
||||
dkw->dkw_devname[sizeof(dkw->dkw_devname) - 1] = '\0';
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (unit = 0; unit < ndkwedges; unit++) {
|
||||
if ((sc = dkwedges[unit]) != NULL &&
|
||||
strcmp(sc->sc_dev->dv_xname, dkw->dkw_devname) == 0 &&
|
||||
@ -476,7 +450,7 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
break;
|
||||
}
|
||||
}
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
if (unit == ndkwedges)
|
||||
return (ESRCH);
|
||||
|
||||
@ -504,8 +478,8 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
vdevgone(cmaj, unit, unit, VCHR);
|
||||
|
||||
/* Clean up the parent. */
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
mutex_enter(&sc->sc_parent->dk_rawlock);
|
||||
if (sc->sc_dk.dk_openmask) {
|
||||
if (sc->sc_parent->dk_rawopens-- == 1) {
|
||||
KASSERT(sc->sc_parent->dk_rawvp != NULL);
|
||||
@ -515,8 +489,8 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
}
|
||||
sc->sc_dk.dk_openmask = 0;
|
||||
}
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_RELEASE, NULL);
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_rawlock);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
|
||||
/* Announce our departure. */
|
||||
aprint_normal("%s at %s (%s) deleted\n", sc->sc_dev->dv_xname,
|
||||
@ -526,10 +500,10 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
/* Delete our pseudo-device. */
|
||||
(void) config_detach(sc->sc_dev, DETACH_FORCE | DETACH_QUIET);
|
||||
|
||||
(void) lockmgr(&sc->sc_parent->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_parent->dk_openlock);
|
||||
sc->sc_parent->dk_nwedges--;
|
||||
LIST_REMOVE(sc, sc_plink);
|
||||
(void) lockmgr(&sc->sc_parent->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_openlock);
|
||||
|
||||
/* Delete our buffer queue. */
|
||||
bufq_free(sc->sc_bufq);
|
||||
@ -538,10 +512,10 @@ dkwedge_del(struct dkwedge_info *dkw)
|
||||
disk_detach(&sc->sc_dk);
|
||||
|
||||
/* Poof. */
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
dkwedges[unit] = NULL;
|
||||
sc->sc_state = DKW_STATE_DEAD;
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
|
||||
free(sc, M_DKWEDGE);
|
||||
|
||||
@ -561,15 +535,15 @@ dkwedge_delall(struct disk *pdk)
|
||||
struct dkwedge_softc *sc;
|
||||
|
||||
for (;;) {
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&pdk->dk_openlock);
|
||||
if ((sc = LIST_FIRST(&pdk->dk_wedges)) == NULL) {
|
||||
KASSERT(pdk->dk_nwedges == 0);
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
return;
|
||||
}
|
||||
strcpy(dkw.dkw_parent, pdk->dk_name);
|
||||
strcpy(dkw.dkw_devname, sc->sc_dev->dv_xname);
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
(void) dkwedge_del(&dkw);
|
||||
}
|
||||
}
|
||||
@ -611,7 +585,7 @@ dkwedge_list(struct disk *pdk, struct dkwedge_list *dkwl, struct lwp *l)
|
||||
|
||||
dkwl->dkwl_ncopied = 0;
|
||||
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&pdk->dk_openlock);
|
||||
LIST_FOREACH(sc, &pdk->dk_wedges, sc_plink) {
|
||||
if (uio.uio_resid < sizeof(dkw))
|
||||
break;
|
||||
@ -633,7 +607,7 @@ dkwedge_list(struct disk *pdk, struct dkwedge_list *dkwl, struct lwp *l)
|
||||
dkwl->dkwl_ncopied++;
|
||||
}
|
||||
dkwl->dkwl_nwedges = pdk->dk_nwedges;
|
||||
(void) lockmgr(&pdk->dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&pdk->dk_openlock);
|
||||
|
||||
if (l != NULL) {
|
||||
uvmspace_free(vm);
|
||||
@ -649,7 +623,7 @@ dkwedge_find_by_wname(const char *wname)
|
||||
struct dkwedge_softc *sc;
|
||||
int i;
|
||||
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (i = 0; i < ndkwedges; i++) {
|
||||
if ((sc = dkwedges[i]) == NULL)
|
||||
continue;
|
||||
@ -664,7 +638,7 @@ dkwedge_find_by_wname(const char *wname)
|
||||
dv = sc->sc_dev;
|
||||
}
|
||||
}
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
return dv;
|
||||
}
|
||||
|
||||
@ -674,13 +648,13 @@ dkwedge_print_wnames(void)
|
||||
struct dkwedge_softc *sc;
|
||||
int i;
|
||||
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (i = 0; i < ndkwedges; i++) {
|
||||
if ((sc = dkwedges[i]) == NULL)
|
||||
continue;
|
||||
printf(" wedge:%s", sc->sc_wname);
|
||||
}
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -695,7 +669,7 @@ dkwedge_set_bootwedge(struct device *parent, daddr_t startblk, uint64_t nblks)
|
||||
struct dkwedge_softc *sc;
|
||||
int i;
|
||||
|
||||
(void) lockmgr(&dkwedges_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_enter(&dkwedges_lock, RW_WRITER);
|
||||
for (i = 0; i < ndkwedges; i++) {
|
||||
if ((sc = dkwedges[i]) == NULL)
|
||||
continue;
|
||||
@ -718,7 +692,7 @@ dkwedge_set_bootwedge(struct device *parent, daddr_t startblk, uint64_t nblks)
|
||||
* XXX What if we don't find one? Should we create a special
|
||||
* XXX root wedge?
|
||||
*/
|
||||
(void) lockmgr(&dkwedges_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedges_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -729,24 +703,26 @@ static struct dkwedge_discovery_method dummy_discovery_method;
|
||||
__link_set_add_bss(dkwedge_methods, dummy_discovery_method);
|
||||
|
||||
/*
|
||||
* dkwedge_discover_init:
|
||||
* dkwedge_init:
|
||||
*
|
||||
* Initialize the disk wedge discovery method list.
|
||||
* Initialize the disk wedge subsystem.
|
||||
*/
|
||||
static void
|
||||
dkwedge_discover_init(void)
|
||||
void
|
||||
dkwedge_init(void)
|
||||
{
|
||||
__link_set_decl(dkwedge_methods, struct dkwedge_discovery_method);
|
||||
struct dkwedge_discovery_method * const *ddmp;
|
||||
struct dkwedge_discovery_method *lddm, *ddm;
|
||||
|
||||
(void) lockmgr(&dkwedge_discovery_methods_lock, LK_EXCLUSIVE, NULL);
|
||||
rw_init(&dkwedges_lock);
|
||||
rw_init(&dkwedge_discovery_methods_lock);
|
||||
|
||||
if (dkwedge_discovery_methods_initialized) {
|
||||
(void) lockmgr(&dkwedge_discovery_methods_lock, LK_RELEASE,
|
||||
NULL);
|
||||
return;
|
||||
}
|
||||
if (config_cfdriver_attach(&dk_cd) != 0)
|
||||
panic("dkwedge: unable to attach cfdriver");
|
||||
if (config_cfattach_attach(dk_cd.cd_name, &dk_ca) != 0)
|
||||
panic("dkwedge: unable to attach cfattach");
|
||||
|
||||
rw_enter(&dkwedge_discovery_methods_lock, RW_WRITER);
|
||||
|
||||
LIST_INIT(&dkwedge_discovery_methods);
|
||||
|
||||
@ -782,9 +758,7 @@ dkwedge_discover_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
dkwedge_discovery_methods_initialized = 1;
|
||||
|
||||
(void) lockmgr(&dkwedge_discovery_methods_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedge_discovery_methods_lock);
|
||||
}
|
||||
|
||||
#ifdef DKWEDGE_AUTODISCOVER
|
||||
@ -812,10 +786,7 @@ dkwedge_discover(struct disk *pdk)
|
||||
if (dkwedge_autodiscover == 0)
|
||||
return;
|
||||
|
||||
if (dkwedge_discovery_methods_initialized == 0)
|
||||
dkwedge_discover_init();
|
||||
|
||||
(void) lockmgr(&dkwedge_discovery_methods_lock, LK_SHARED, NULL);
|
||||
rw_enter(&dkwedge_discovery_methods_lock, RW_READER);
|
||||
|
||||
error = dkwedge_compute_pdev(pdk->dk_name, &pdev);
|
||||
if (error) {
|
||||
@ -868,7 +839,7 @@ dkwedge_discover(struct disk *pdk)
|
||||
/* We'll just assume the vnode has been cleaned up. */
|
||||
}
|
||||
out:
|
||||
(void) lockmgr(&dkwedge_discovery_methods_lock, LK_RELEASE, NULL);
|
||||
rw_exit(&dkwedge_discovery_methods_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -939,8 +910,8 @@ dkopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
* opened. The reason? We see one dkopen() per open call, but
|
||||
* only dkclose() on the last close.
|
||||
*/
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
mutex_enter(&sc->sc_parent->dk_rawlock);
|
||||
if (sc->sc_dk.dk_openmask == 0) {
|
||||
if (sc->sc_parent->dk_rawopens == 0) {
|
||||
KASSERT(sc->sc_parent->dk_rawvp == NULL);
|
||||
@ -972,8 +943,8 @@ dkopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
|
||||
|
||||
popen_fail:
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_RELEASE, NULL);
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_rawlock);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -990,8 +961,8 @@ dkclose(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
|
||||
KASSERT(sc->sc_dk.dk_openmask != 0);
|
||||
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
mutex_enter(&sc->sc_parent->dk_rawlock);
|
||||
|
||||
if (fmt == S_IFCHR)
|
||||
sc->sc_dk.dk_copenmask &= ~1;
|
||||
@ -1009,8 +980,8 @@ dkclose(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
}
|
||||
}
|
||||
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_RELEASE, NULL);
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_rawlock);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -1268,8 +1239,8 @@ dksize(dev_t dev)
|
||||
if (sc->sc_state != DKW_STATE_RUNNING)
|
||||
return (ENXIO);
|
||||
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
mutex_enter(&sc->sc_parent->dk_rawlock);
|
||||
|
||||
/* Our content type is static, no need to open the device. */
|
||||
|
||||
@ -1281,8 +1252,8 @@ dksize(dev_t dev)
|
||||
rv = (int) sc->sc_size;
|
||||
}
|
||||
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_RELEASE, NULL);
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_rawlock);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
|
||||
return (rv);
|
||||
}
|
||||
@ -1305,8 +1276,8 @@ dkdump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
if (sc->sc_state != DKW_STATE_RUNNING)
|
||||
return (ENXIO);
|
||||
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL);
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_EXCLUSIVE, NULL);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
mutex_enter(&sc->sc_parent->dk_rawlock);
|
||||
|
||||
/* Our content type is static, no need to open the device. */
|
||||
|
||||
@ -1330,8 +1301,8 @@ dkdump(dev_t dev, daddr_t blkno, void *va, size_t size)
|
||||
rv = (*bdev->d_dump)(sc->sc_pdev, blkno + sc->sc_offset, va, size);
|
||||
|
||||
out:
|
||||
(void) lockmgr(&sc->sc_parent->dk_rawlock, LK_RELEASE, NULL);
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_parent->dk_rawlock);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
26
sys/dev/ld.c
26
sys/dev/ld.c
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ld.c,v 1.47 2007/04/30 17:23:09 tron Exp $ */
|
||||
/* $NetBSD: ld.c,v 1.48 2007/07/21 19:51:47 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
|
||||
@ -41,7 +41,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.47 2007/04/30 17:23:09 tron Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.48 2007/07/21 19:51:47 ad Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -293,8 +293,7 @@ ldopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
return (ENODEV);
|
||||
part = DISKPART(dev);
|
||||
|
||||
if ((error = lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
|
||||
if (sc->sc_dk.dk_openmask == 0) {
|
||||
/* Load the partition info if not already loaded. */
|
||||
@ -321,11 +320,9 @@ ldopen(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
sc->sc_dk.dk_openmask =
|
||||
sc->sc_dk.dk_copenmask | sc->sc_dk.dk_bopenmask;
|
||||
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
return (0);
|
||||
|
||||
error = 0;
|
||||
bad1:
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -334,14 +331,13 @@ static int
|
||||
ldclose(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
{
|
||||
struct ld_softc *sc;
|
||||
int error, part, unit;
|
||||
int part, unit;
|
||||
|
||||
unit = DISKUNIT(dev);
|
||||
part = DISKPART(dev);
|
||||
sc = device_lookup(&ld_cd, unit);
|
||||
|
||||
if ((error = lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -362,7 +358,7 @@ ldclose(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
sc->sc_flags &= ~LDF_VLABEL;
|
||||
}
|
||||
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -439,9 +435,7 @@ ldioctl(dev_t dev, u_long cmd, void *addr, int32_t flag, struct lwp *l)
|
||||
if ((flag & FWRITE) == 0)
|
||||
return (EBADF);
|
||||
|
||||
if ((error = lockmgr(&sc->sc_dk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&sc->sc_dk.dk_openlock);
|
||||
sc->sc_flags |= LDF_LABELLING;
|
||||
|
||||
error = setdisklabel(sc->sc_dk.dk_label,
|
||||
@ -458,7 +452,7 @@ ldioctl(dev_t dev, u_long cmd, void *addr, int32_t flag, struct lwp *l)
|
||||
sc->sc_dk.dk_cpulabel);
|
||||
|
||||
sc->sc_flags &= ~LDF_LABELLING;
|
||||
(void) lockmgr(&sc->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sc->sc_dk.dk_openlock);
|
||||
break;
|
||||
|
||||
case DIOCKLABEL:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ed_mca.c,v 1.35 2007/03/04 06:02:14 christos Exp $ */
|
||||
/* $NetBSD: ed_mca.c,v 1.36 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.35 2007/03/04 06:02:14 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.36 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -297,8 +297,7 @@ edmcaopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
|
||||
part = DISKPART(dev);
|
||||
|
||||
if ((error = lockmgr(&wd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&wd->sc_dk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -354,11 +353,9 @@ edmcaopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
wd->sc_dk.dk_openmask =
|
||||
wd->sc_dk.dk_copenmask | wd->sc_dk.dk_bopenmask;
|
||||
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
return 0;
|
||||
|
||||
error = 0;
|
||||
bad1:
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -367,12 +364,10 @@ edmcaclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
{
|
||||
struct ed_softc *wd = device_lookup(&ed_cd, DISKUNIT(dev));
|
||||
int part = DISKPART(dev);
|
||||
int error;
|
||||
|
||||
ATADEBUG_PRINT(("edmcaclose\n"), DEBUG_FUNCS);
|
||||
|
||||
if ((error = lockmgr(&wd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&wd->sc_dk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -395,7 +390,7 @@ edmcaclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
wd->sc_flags &= ~WDF_LOADED;
|
||||
}
|
||||
|
||||
(void) lockmgr(&wd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&wd->sc_dk.dk_openlock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -510,9 +505,7 @@ edmcaioctl(dev, xfer, addr, flag, l)
|
||||
if ((flag & FWRITE) == 0)
|
||||
return EBADF;
|
||||
|
||||
if ((error = lockmgr(&ed->sc_dk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&ed->sc_dk.dk_openlock);
|
||||
ed->sc_flags |= WDF_LABELLING;
|
||||
|
||||
error = setdisklabel(ed->sc_dk.dk_label,
|
||||
@ -530,7 +523,7 @@ edmcaioctl(dev, xfer, addr, flag, l)
|
||||
}
|
||||
|
||||
ed->sc_flags &= ~WDF_LABELLING;
|
||||
(void) lockmgr(&ed->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&ed->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mscp_disk.c,v 1.54 2007/03/04 06:02:14 christos Exp $ */
|
||||
/* $NetBSD: mscp_disk.c,v 1.55 2007/07/21 19:51:48 ad Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
@ -81,7 +81,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.54 2007/03/04 06:02:14 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mscp_disk.c,v 1.55 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -245,9 +245,7 @@ raopen(dev, flag, fmt, l)
|
||||
|
||||
part = DISKPART(dev);
|
||||
|
||||
if ((error = lockmgr(&ra->ra_disk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&ra->ra_disk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -301,11 +299,9 @@ raopen(dev, flag, fmt, l)
|
||||
break;
|
||||
}
|
||||
ra->ra_disk.dk_openmask |= mask;
|
||||
(void) lockmgr(&ra->ra_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
return 0;
|
||||
|
||||
error = 0;
|
||||
bad1:
|
||||
(void) lockmgr(&ra->ra_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&ra->ra_disk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -318,11 +314,9 @@ raclose(dev, flags, fmt, l)
|
||||
{
|
||||
int unit = DISKUNIT(dev);
|
||||
struct ra_softc *ra = ra_cd.cd_devs[unit];
|
||||
int error, mask = (1 << DISKPART(dev));
|
||||
int mask = (1 << DISKPART(dev));
|
||||
|
||||
if ((error = lockmgr(&ra->ra_disk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&ra->ra_disk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -350,7 +344,7 @@ raclose(dev, flags, fmt, l)
|
||||
ra->ra_wlabel = 0;
|
||||
}
|
||||
#endif
|
||||
(void) lockmgr(&ra->ra_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&ra->ra_disk.dk_openlock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -489,9 +483,7 @@ raioctl(dev, cmd, data, flag, l)
|
||||
if ((flag & FWRITE) == 0)
|
||||
error = EBADF;
|
||||
else {
|
||||
if ((error = lockmgr(&ra->ra_disk.dk_openlock,
|
||||
LK_EXCLUSIVE, NULL)) != 0)
|
||||
break;
|
||||
mutex_enter(&ra->ra_disk.dk_openlock);
|
||||
error = setdisklabel(lp, tp, 0, 0);
|
||||
if ((error == 0) && (cmd == DIOCWDINFO
|
||||
#ifdef __HAVE_OLD_DISKLABEL
|
||||
@ -503,8 +495,7 @@ raioctl(dev, cmd, data, flag, l)
|
||||
error = writedisklabel(dev, rastrategy, lp,0);
|
||||
ra->ra_wlabel = 0;
|
||||
}
|
||||
(void) lockmgr(&ra->ra_disk.dk_openlock,
|
||||
LK_RELEASE, NULL);
|
||||
mutex_exit(&ra->ra_disk.dk_openlock);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ofdisk.c,v 1.35 2007/03/04 06:02:15 christos Exp $ */
|
||||
/* $NetBSD: ofdisk.c,v 1.36 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.35 2007/03/04 06:02:15 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ofdisk.c,v 1.36 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/buf.h>
|
||||
@ -162,8 +162,7 @@ ofdisk_open(dev_t dev, int flags, int fmt, struct lwp *lwp)
|
||||
|
||||
part = DISKPART(dev);
|
||||
|
||||
if ((error = lockmgr(&of->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&of->sc_dk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -225,11 +224,10 @@ ofdisk_open(dev_t dev, int flags, int fmt, struct lwp *lwp)
|
||||
of->sc_dk.dk_openmask =
|
||||
of->sc_dk.dk_copenmask | of->sc_dk.dk_bopenmask;
|
||||
|
||||
(void) lockmgr(&of->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
return 0;
|
||||
|
||||
error = 0;
|
||||
bad1:
|
||||
(void) lockmgr(&of->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&of->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -237,10 +235,8 @@ int
|
||||
ofdisk_close(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
{
|
||||
struct ofdisk_softc *of = ofdisk_cd.cd_devs[DISKUNIT(dev)];
|
||||
int error;
|
||||
|
||||
if ((error = lockmgr(&of->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&of->sc_dk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -263,7 +259,7 @@ ofdisk_close(dev_t dev, int flags, int fmt, struct lwp *l)
|
||||
of->sc_ihandle = 0;
|
||||
}
|
||||
|
||||
(void) lockmgr(&of->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&of->sc_dk.dk_openlock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -387,9 +383,7 @@ ofdisk_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
if ((flag & FWRITE) == 0)
|
||||
return EBADF;
|
||||
|
||||
if ((error = lockmgr(&of->sc_dk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&of->sc_dk.dk_openlock);
|
||||
|
||||
error = setdisklabel(of->sc_dk.dk_label,
|
||||
lp, /*of->sc_dk.dk_openmask */0,
|
||||
@ -403,7 +397,7 @@ ofdisk_ioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
|
||||
DISKUNIT(dev), RAW_PART), ofdisk_strategy,
|
||||
of->sc_dk.dk_label, of->sc_dk.dk_cpulabel);
|
||||
|
||||
(void) lockmgr(&of->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&of->sc_dk.dk_openlock);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rl.c,v 1.33 2007/03/10 00:52:46 christos Exp $ */
|
||||
/* $NetBSD: rl.c,v 1.34 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.33 2007/03/10 00:52:46 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.34 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/device.h>
|
||||
@ -306,9 +306,7 @@ rlopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
|
||||
part = DISKPART(dev);
|
||||
|
||||
if ((error = lockmgr(&rc->rc_disk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&rc->rc_disk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -363,24 +361,20 @@ rlopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
break;
|
||||
}
|
||||
rc->rc_disk.dk_openmask |= mask;
|
||||
(void) lockmgr(&rc->rc_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
return 0;
|
||||
|
||||
error = 0;
|
||||
bad1:
|
||||
(void) lockmgr(&rc->rc_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&rc->rc_disk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
int
|
||||
rlclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
{
|
||||
int error, unit = DISKUNIT(dev);
|
||||
int unit = DISKUNIT(dev);
|
||||
struct rl_softc *rc = rl_cd.cd_devs[unit];
|
||||
int mask = (1 << DISKPART(dev));
|
||||
|
||||
if ((error = lockmgr(&rc->rc_disk.dk_openlock, LK_EXCLUSIVE,
|
||||
NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&rc->rc_disk.dk_openlock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -395,7 +389,7 @@ rlclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
|
||||
if (rc->rc_disk.dk_openmask == 0)
|
||||
rc->rc_state = DK_CLOSED; /* May change pack */
|
||||
(void) lockmgr(&rc->rc_disk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&rc->rc_disk.dk_openlock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -490,9 +484,7 @@ rlioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
if ((flag & FWRITE) == 0)
|
||||
err = EBADF;
|
||||
else {
|
||||
if ((err = lockmgr(&rc->rc_disk.dk_openlock,
|
||||
LK_EXCLUSIVE, NULL)) != 0)
|
||||
break;
|
||||
mutex_enter(&rc->rc_disk.dk_openlock);
|
||||
err = ((
|
||||
#ifdef __HAVE_OLD_DISKLABEL
|
||||
cmd == ODIOCSDINFO ||
|
||||
@ -500,8 +492,7 @@ rlioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
cmd == DIOCSDINFO) ?
|
||||
setdisklabel(lp, tp, 0, 0) :
|
||||
writedisklabel(dev, rlstrategy, lp, 0));
|
||||
(void) lockmgr(&rc->rc_disk.dk_openlock,
|
||||
LK_RELEASE, NULL);
|
||||
mutex_exit(&rc->rc_disk.dk_openlock);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cd.c,v 1.265 2007/07/09 21:01:21 ad Exp $ */
|
||||
/* $NetBSD: cd.c,v 1.266 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2001, 2003, 2004, 2005 The NetBSD Foundation, Inc.
|
||||
@ -57,7 +57,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.265 2007/07/09 21:01:21 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cd.c,v 1.266 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include "rnd.h"
|
||||
|
||||
@ -242,7 +242,7 @@ cdattach(struct device *parent, struct device *self, void *aux)
|
||||
|
||||
SC_DEBUG(periph, SCSIPI_DB2, ("cdattach: "));
|
||||
|
||||
lockinit(&cd->sc_lock, PRIBIO | PCATCH, "cdlock", 0, 0);
|
||||
mutex_init(&cd->sc_lock, MUTEX_DEFAULT, IPL_NONE);
|
||||
|
||||
if (scsipi_periph_bustype(sa->sa_periph) == SCSIPI_BUSTYPE_SCSI &&
|
||||
periph->periph_version == 0)
|
||||
@ -312,7 +312,6 @@ cddetach(struct device *self, int flags)
|
||||
/* locate the major number */
|
||||
bmaj = bdevsw_lookup_major(&cd_bdevsw);
|
||||
cmaj = cdevsw_lookup_major(&cd_cdevsw);
|
||||
|
||||
/* Nuke the vnodes for any open instances */
|
||||
for (i = 0; i < MAXPARTITIONS; i++) {
|
||||
mn = CDMINOR(device_unit(self), i);
|
||||
@ -335,7 +334,7 @@ cddetach(struct device *self, int flags)
|
||||
|
||||
splx(s);
|
||||
|
||||
lockmgr(&cd->sc_lock, LK_DRAIN, 0);
|
||||
mutex_destroy(&cd->sc_lock);
|
||||
|
||||
/* Detach from the disk list. */
|
||||
disk_detach(&cd->sc_dk);
|
||||
@ -390,8 +389,7 @@ cdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
(error = scsipi_adapter_addref(adapt)) != 0)
|
||||
return (error);
|
||||
|
||||
if ((error = lockmgr(&cd->sc_lock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
goto bad4;
|
||||
mutex_enter(&cd->sc_lock);
|
||||
|
||||
rawpart = (part == RAW_PART && fmt == S_IFCHR);
|
||||
if ((periph->periph_flags & PERIPH_OPEN) != 0) {
|
||||
@ -495,7 +493,7 @@ out: /* Insure only one open at a time. */
|
||||
cd->sc_dk.dk_copenmask | cd->sc_dk.dk_bopenmask;
|
||||
|
||||
SC_DEBUG(periph, SCSIPI_DB3, ("open complete\n"));
|
||||
lockmgr(&cd->sc_lock, LK_RELEASE, NULL);
|
||||
mutex_exit(&cd->sc_lock);
|
||||
return (0);
|
||||
|
||||
periph->periph_flags &= ~PERIPH_MEDIA_LOADED;
|
||||
@ -508,8 +506,7 @@ bad:
|
||||
}
|
||||
|
||||
bad3:
|
||||
lockmgr(&cd->sc_lock, LK_RELEASE, NULL);
|
||||
bad4:
|
||||
mutex_exit(&cd->sc_lock);
|
||||
if (cd->sc_dk.dk_openmask == 0)
|
||||
scsipi_adapter_delref(adapt);
|
||||
return (error);
|
||||
@ -526,10 +523,8 @@ cdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
struct scsipi_periph *periph = cd->sc_periph;
|
||||
struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
|
||||
int part = CDPART(dev);
|
||||
int error;
|
||||
|
||||
if ((error = lockmgr(&cd->sc_lock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&cd->sc_lock);
|
||||
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
@ -555,7 +550,7 @@ cdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
scsipi_adapter_delref(adapt);
|
||||
}
|
||||
|
||||
lockmgr(&cd->sc_lock, LK_RELEASE, NULL);
|
||||
mutex_exit(&cd->sc_lock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1335,8 +1330,7 @@ cdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
#endif
|
||||
lp = addr;
|
||||
|
||||
if ((error = lockmgr(&cd->sc_lock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
goto bad;
|
||||
mutex_enter(&cd->sc_lock);
|
||||
cd->flags |= CDF_LABELLING;
|
||||
|
||||
error = setdisklabel(cd->sc_dk.dk_label,
|
||||
@ -1347,8 +1341,7 @@ cdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
}
|
||||
|
||||
cd->flags &= ~CDF_LABELLING;
|
||||
lockmgr(&cd->sc_lock, LK_RELEASE, NULL);
|
||||
bad:
|
||||
mutex_exit(&cd->sc_lock);
|
||||
#ifdef __HAVE_OLD_DISKLABEL
|
||||
if (newlabel != NULL)
|
||||
free(newlabel, M_TEMP);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cdvar.h,v 1.26 2005/12/11 12:23:50 christos Exp $ */
|
||||
/* $NetBSD: cdvar.h,v 1.27 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Manuel Bouyer. All rights reserved.
|
||||
@ -34,7 +34,7 @@
|
||||
struct cd_softc {
|
||||
struct device sc_dev;
|
||||
struct disk sc_dk;
|
||||
struct lock sc_lock;
|
||||
kmutex_t sc_lock;
|
||||
|
||||
int flags;
|
||||
#define CDF_WLABEL 0x04 /* label is writable */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: sd.c,v 1.262 2007/07/09 21:01:22 ad Exp $ */
|
||||
/* $NetBSD: sd.c,v 1.263 2007/07/21 19:51:48 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 2003, 2004 The NetBSD Foundation, Inc.
|
||||
@ -54,7 +54,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.262 2007/07/09 21:01:22 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.263 2007/07/21 19:51:48 ad Exp $");
|
||||
|
||||
#include "opt_scsi.h"
|
||||
#include "rnd.h"
|
||||
@ -426,8 +426,7 @@ sdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
|
||||
part = SDPART(dev);
|
||||
|
||||
if ((error = lockmgr(&sd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
mutex_enter(&sd->sc_dk.dk_openlock);
|
||||
|
||||
/*
|
||||
* If there are wedges, and this is not RAW_PART, then we
|
||||
@ -568,7 +567,7 @@ sdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
sd->sc_dk.dk_copenmask | sd->sc_dk.dk_bopenmask;
|
||||
|
||||
SC_DEBUG(periph, SCSIPI_DB3, ("open complete\n"));
|
||||
(void) lockmgr(&sd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sd->sc_dk.dk_openlock);
|
||||
return (0);
|
||||
|
||||
bad3:
|
||||
@ -586,7 +585,7 @@ sdopen(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
scsipi_adapter_delref(adapt);
|
||||
|
||||
bad1:
|
||||
(void) lockmgr(&sd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sd->sc_dk.dk_openlock);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -601,11 +600,8 @@ sdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
struct scsipi_periph *periph = sd->sc_periph;
|
||||
struct scsipi_adapter *adapt = periph->periph_channel->chan_adapter;
|
||||
int part = SDPART(dev);
|
||||
int error;
|
||||
|
||||
if ((error = lockmgr(&sd->sc_dk.dk_openlock, LK_EXCLUSIVE, NULL)) != 0)
|
||||
return (error);
|
||||
|
||||
mutex_enter(&sd->sc_dk.dk_openlock);
|
||||
switch (fmt) {
|
||||
case S_IFCHR:
|
||||
sd->sc_dk.dk_copenmask &= ~(1 << part);
|
||||
@ -645,7 +641,7 @@ sdclose(dev_t dev, int flag, int fmt, struct lwp *l)
|
||||
scsipi_adapter_delref(adapt);
|
||||
}
|
||||
|
||||
(void) lockmgr(&sd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
mutex_exit(&sd->sc_dk.dk_openlock);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -1099,9 +1095,7 @@ sdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
#endif
|
||||
lp = (struct disklabel *)addr;
|
||||
|
||||
if ((error = lockmgr(&sd->sc_dk.dk_openlock,
|
||||
LK_EXCLUSIVE, NULL)) != 0)
|
||||
goto bad;
|
||||
mutex_enter(&sd->sc_dk.dk_openlock);
|
||||
sd->flags |= SDF_LABELLING;
|
||||
|
||||
error = setdisklabel(sd->sc_dk.dk_label,
|
||||
@ -1119,8 +1113,7 @@ sdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
|
||||
}
|
||||
|
||||
sd->flags &= ~SDF_LABELLING;
|
||||
(void) lockmgr(&sd->sc_dk.dk_openlock, LK_RELEASE, NULL);
|
||||
bad:
|
||||
mutex_exit(&sd->sc_dk.dk_openlock);
|
||||
#ifdef __HAVE_OLD_DISKLABEL
|
||||
if (newlabel != NULL)
|
||||
free(newlabel, M_TEMP);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_main.c,v 1.308 2007/07/20 22:15:47 tsutsui Exp $ */
|
||||
/* $NetBSD: init_main.c,v 1.309 2007/07/21 19:51:49 ad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
|
||||
@ -71,7 +71,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.308 2007/07/20 22:15:47 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.309 2007/07/21 19:51:49 ad Exp $");
|
||||
|
||||
#include "opt_ipsec.h"
|
||||
#include "opt_multiprocessor.h"
|
||||
@ -126,6 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.308 2007/07/20 22:15:47 tsutsui Exp
|
||||
#include <sys/vmem.h>
|
||||
#include <sys/uuid.h>
|
||||
#include <sys/extent.h>
|
||||
#include <sys/disk.h>
|
||||
#ifdef FAST_IPSEC
|
||||
#include <netipsec/ipsec.h>
|
||||
#endif
|
||||
@ -383,6 +384,9 @@ main(void)
|
||||
/* Initialize the device switch tables. */
|
||||
devsw_init();
|
||||
|
||||
/* Initialize the disk wedge subsystem. */
|
||||
dkwedge_init();
|
||||
|
||||
/* Configure the system hardware. This will enable interrupts. */
|
||||
configure();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_disk.c,v 1.86 2007/06/24 01:43:35 dyoung Exp $ */
|
||||
/* $NetBSD: subr_disk.c,v 1.87 2007/07/21 19:51:49 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -74,7 +74,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.86 2007/06/24 01:43:35 dyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_disk.c,v 1.87 2007/07/21 19:51:49 ad Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
@ -191,8 +191,8 @@ disk_init0(struct disk *diskp)
|
||||
/*
|
||||
* Initialize the wedge-related locks and other fields.
|
||||
*/
|
||||
lockinit(&diskp->dk_rawlock, PRIBIO, "dkrawlk", 0, 0);
|
||||
lockinit(&diskp->dk_openlock, PRIBIO, "dkoplk", 0, 0);
|
||||
mutex_init(&diskp->dk_rawlock, MUTEX_DEFAULT, IPL_NONE);
|
||||
mutex_init(&diskp->dk_openlock, MUTEX_DEFAULT, IPL_NONE);
|
||||
LIST_INIT(&diskp->dk_wedges);
|
||||
diskp->dk_nwedges = 0;
|
||||
diskp->dk_labelsector = LABELSECTOR;
|
||||
@ -265,8 +265,8 @@ void
|
||||
disk_detach(struct disk *diskp)
|
||||
{
|
||||
|
||||
(void) lockmgr(&diskp->dk_openlock, LK_DRAIN, NULL);
|
||||
(void) lockmgr(&diskp->dk_rawlock, LK_DRAIN, NULL);
|
||||
mutex_destroy(&diskp->dk_openlock);
|
||||
mutex_destroy(&diskp->dk_rawlock);
|
||||
disk_detach0(diskp);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disk.h,v 1.44 2007/06/24 01:43:35 dyoung Exp $ */
|
||||
/* $NetBSD: disk.h,v 1.45 2007/07/21 19:51:49 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 2004 The NetBSD Foundation, Inc.
|
||||
@ -90,8 +90,9 @@
|
||||
#include <sys/dkio.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/mutex.h>
|
||||
#include <sys/iostat.h>
|
||||
|
||||
#include <prop/proplib.h>
|
||||
|
||||
struct buf;
|
||||
@ -426,11 +427,11 @@ struct disk {
|
||||
/*
|
||||
* Information required to be the parent of a disk wedge.
|
||||
*/
|
||||
struct lock dk_rawlock; /* lock on these fields */
|
||||
struct vnode *dk_rawvp; /* vnode for the RAW_PART bdev */
|
||||
kmutex_t dk_rawlock; /* lock on these fields */
|
||||
u_int dk_rawopens; /* # of openes of rawvp */
|
||||
struct vnode *dk_rawvp; /* vnode for the RAW_PART bdev */
|
||||
|
||||
struct lock dk_openlock; /* lock on these and openmask */
|
||||
kmutex_t dk_openlock; /* lock on these and openmask */
|
||||
u_int dk_nwedges; /* # of configured wedges */
|
||||
/* all wedges on this disk */
|
||||
LIST_HEAD(, dkwedge_softc) dk_wedges;
|
||||
@ -510,6 +511,7 @@ void disk_blocksize(struct disk *, int);
|
||||
struct disk *disk_find(const char *);
|
||||
int disk_ioctl(struct disk *, u_long, void *, int, struct lwp *);
|
||||
|
||||
void dkwedge_init(void);
|
||||
int dkwedge_add(struct dkwedge_info *);
|
||||
int dkwedge_del(struct dkwedge_info *);
|
||||
void dkwedge_delall(struct disk *);
|
||||
|
Loading…
Reference in New Issue
Block a user