Replace device_lookup() with device_lookup_private() on getting softc

for future device_t/softc spilt.
This commit is contained in:
tsutsui 2008-06-08 12:43:51 +00:00
parent 5ab3329550
commit 1f459d82b5
20 changed files with 134 additions and 111 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dpti.c,v 1.38 2008/05/11 14:25:48 ad Exp $ */
/* $NetBSD: dpti.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.38 2008/05/11 14:25:48 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: dpti.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -217,7 +217,7 @@ dptiioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
struct ioctl_pt *pt;
int i, size, rv, linux;
sc = device_lookup(&dpti_cd, minor(dev));
sc = device_lookup_private(&dpti_cd, minor(dev));
iop = (struct iop_softc *)device_parent(&sc->sc_dv);
rv = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: iop.c,v 1.72 2008/06/08 11:58:50 ad Exp $ */
/* $NetBSD: iop.c,v 1.73 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002, 2007 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.72 2008/06/08 11:58:50 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: iop.c,v 1.73 2008/06/08 12:43:52 tsutsui Exp $");
#include "iop.h"
@ -487,7 +487,7 @@ iop_config_interrupts(struct device *self)
*/
if (iop_systab == NULL) {
for (i = 0, niop = 0; i < iop_cd.cd_ndevs; i++) {
if ((iop = device_lookup(&iop_cd, i)) == NULL)
if ((iop = device_lookup_private(&iop_cd, i)) == NULL)
continue;
if ((iop->sc_flags & IOP_HAVESTATUS) == 0)
continue;
@ -512,7 +512,7 @@ iop_config_interrupts(struct device *self)
iop_systab->version = I2O_VERSION_11;
for (i = 0, ste = iop_systab->entry; i < iop_cd.cd_ndevs; i++) {
if ((iop = device_lookup(&iop_cd, i)) == NULL)
if ((iop = device_lookup_private(&iop_cd, i)) == NULL)
continue;
if ((iop->sc_flags & IOP_HAVESTATUS) == 0)
continue;
@ -877,7 +877,7 @@ iop_shutdown(void *junk)
printf("shutting down iop devices...");
for (i = 0; i < iop_cd.cd_ndevs; i++) {
if ((sc = device_lookup(&iop_cd, i)) == NULL)
if ((sc = device_lookup_private(&iop_cd, i)) == NULL)
continue;
if ((sc->sc_flags & IOP_ONLINE) == 0)
continue;
@ -2463,7 +2463,7 @@ iopopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct iop_softc *sc;
if ((sc = device_lookup(&iop_cd, minor(dev))) == NULL)
if ((sc = device_lookup_private(&iop_cd, minor(dev))) == NULL)
return (ENXIO);
if ((sc->sc_flags & IOP_ONLINE) == 0)
return (ENXIO);
@ -2480,7 +2480,7 @@ iopclose(dev_t dev, int flag, int mode,
{
struct iop_softc *sc;
sc = device_lookup(&iop_cd, minor(dev));
sc = device_lookup_private(&iop_cd, minor(dev));
sc->sc_flags &= ~IOP_OPEN;
return (0);
@ -2493,7 +2493,7 @@ iopioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
struct iovec *iov;
int rv, i;
sc = device_lookup(&iop_cd, minor(dev));
sc = device_lookup_private(&iop_cd, minor(dev));
rv = 0;
switch (cmd) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: aac.c,v 1.39 2008/04/28 20:23:48 martin Exp $ */
/* $NetBSD: aac.c,v 1.40 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.39 2008/04/28 20:23:48 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: aac.c,v 1.40 2008/06/08 12:43:51 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -862,7 +862,7 @@ aac_shutdown(void *cookie)
u_int32_t i;
for (i = 0; i < aac_cd.cd_ndevs; i++) {
if ((sc = device_lookup(&aac_cd, i)) == NULL)
if ((sc = device_lookup_private(&aac_cd, i)) == NULL)
continue;
if ((sc->sc_flags & AAC_ONLINE) == 0)
continue;

View File

@ -1,4 +1,4 @@
/* $NetBSD: cac.c,v 1.46 2008/04/28 20:23:49 martin Exp $ */
/* $NetBSD: cac.c,v 1.47 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.46 2008/04/28 20:23:49 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.47 2008/06/08 12:43:51 tsutsui Exp $");
#include "bio.h"
@ -231,7 +231,7 @@ cac_shutdown(void *cookie)
int i;
for (i = 0; i < cac_cd.cd_ndevs; i++) {
if ((sc = device_lookup(&cac_cd, i)) == NULL)
if ((sc = device_lookup_private(&cac_cd, i)) == NULL)
continue;
memset(tbuf, 0, sizeof(tbuf));
tbuf[0] = 1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: dpt.c,v 1.61 2008/05/11 14:25:48 ad Exp $ */
/* $NetBSD: dpt.c,v 1.62 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.61 2008/05/11 14:25:48 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.62 2008/06/08 12:43:51 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -614,7 +614,7 @@ dpt_shutdown(void *cookie)
printf("shutting down dpt devices...");
for (i = 0; i < dpt_cd.cd_ndevs; i++) {
if ((sc = device_lookup(&dpt_cd, i)) == NULL)
if ((sc = device_lookup_private(&dpt_cd, i)) == NULL)
continue;
dpt_cmd(sc, NULL, CP_IMMEDIATE, CPI_POWEROFF_WARN);
}
@ -1121,7 +1121,7 @@ dptioctl(dev_t dev, u_long cmd, void *data, int flag, struct lwp *l)
struct dpt_softc *sc;
int rv;
sc = device_lookup(&dpt_cd, minor(dev));
sc = device_lookup_private(&dpt_cd, minor(dev));
switch (cmd & 0xffff) {
case DPT_SIGNATURE:

View File

@ -1,4 +1,4 @@
/* $NetBSD: icp_ioctl.c,v 1.18 2008/04/28 20:23:50 martin Exp $ */
/* $NetBSD: icp_ioctl.c,v 1.19 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -69,7 +69,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: icp_ioctl.c,v 1.18 2008/04/28 20:23:50 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: icp_ioctl.c,v 1.19 2008/06/08 12:43:51 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -130,7 +130,7 @@ icpioctl(dev_t dev, u_long cmd, void *data, int flag,
if (error)
break;
icp = device_lookup(&icp_cd, ucmd->io_node);
icp = device_lookup_private(&icp_cd, ucmd->io_node);
if (icp == NULL) {
error = ENXIO;
break;
@ -150,7 +150,7 @@ icpioctl(dev_t dev, u_long cmd, void *data, int flag,
struct icp_softc *icp;
gdt_ctrt_t *ctrt = (void *) data;
icp = device_lookup(&icp_cd, ctrt->io_node);
icp = device_lookup_private(&icp_cd, ctrt->io_node);
if (icp == NULL) {
error = ENXIO;
break;
@ -207,7 +207,7 @@ icpioctl(dev_t dev, u_long cmd, void *data, int flag,
gdt_evt_str *e = &evt->dvr;
int s;
icp = device_lookup(&icp_cd, minor(dev));
icp = device_lookup_private(&icp_cd, minor(dev));
switch (evt->erase) {
case 0xff:
@ -265,7 +265,7 @@ icpioctl(dev_t dev, u_long cmd, void *data, int flag,
struct icp_softc *icp;
gdt_rescan_t *rsc = (void *) data;
icp = device_lookup(&icp_cd, rsc->io_node);
icp = device_lookup_private(&icp_cd, rsc->io_node);
if (icp == NULL) {
error = ENXIO;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: midway.c,v 1.79 2008/04/08 12:07:26 cegger Exp $ */
/* $NetBSD: midway.c,v 1.80 2008/06/08 12:43:51 tsutsui Exp $ */
/* (sync'd to midway.c 1.68) */
/*
@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.79 2008/04/08 12:07:26 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.80 2008/06/08 12:43:51 tsutsui Exp $");
#include "opt_natm.h"
@ -3424,7 +3424,7 @@ int unit, level;
for (lcv = 0 ; lcv < en_cd.cd_ndevs ; lcv++) {
char sbuf[256];
sc = device_lookup(&en_cd, lcv);
sc = device_lookup_private(&en_cd, lcv);
if (sc == NULL) continue;
if (unit != -1 && unit != lcv)
continue;
@ -3590,7 +3590,7 @@ int unit, addr, len;
struct en_softc *sc;
u_int32_t reg;
sc = device_lookup(&en_cd, unit);
sc = device_lookup_private(&en_cd, unit);
if (sc == NULL) {
printf("invalid unit number: %d\n", unit);
return(0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mlx.c,v 1.55 2008/04/28 20:23:50 martin Exp $ */
/* $NetBSD: mlx.c,v 1.56 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.55 2008/04/28 20:23:50 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: mlx.c,v 1.56 2008/06/08 12:43:51 tsutsui Exp $");
#include "ld.h"
@ -651,7 +651,7 @@ mlx_shutdown(void *cookie)
int i;
for (i = 0; i < mlx_cd.cd_ndevs; i++)
if ((mlx = device_lookup(&mlx_cd, i)) != NULL)
if ((mlx = device_lookup_private(&mlx_cd, i)) != NULL)
mlx_flush(mlx, 0);
}
@ -667,7 +667,7 @@ mlx_adjqparam(struct mlx_softc *mlx, int mpu, int slop)
int i;
for (i = 0; i < ld_cd.cd_ndevs; i++) {
if ((ld = device_lookup(&ld_cd, i)) == NULL)
if ((ld = device_lookup_private(&ld_cd, i)) == NULL)
continue;
if (device_parent(&ld->sc_dv) != &mlx->mlx_dv)
continue;
@ -684,7 +684,7 @@ mlxopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct mlx_softc *mlx;
if ((mlx = device_lookup(&mlx_cd, minor(dev))) == NULL)
if ((mlx = device_lookup_private(&mlx_cd, minor(dev))) == NULL)
return (ENXIO);
if ((mlx->mlx_flags & MLXF_INITOK) == 0)
return (ENXIO);
@ -704,7 +704,7 @@ mlxclose(dev_t dev, int flag, int mode,
{
struct mlx_softc *mlx;
mlx = device_lookup(&mlx_cd, minor(dev));
mlx = device_lookup_private(&mlx_cd, minor(dev));
mlx->mlx_flags &= ~MLXF_OPEN;
return (0);
}
@ -723,7 +723,7 @@ mlxioctl(dev_t dev, u_long cmd, void *data, int flag,
struct mlx_sysdrive *ms;
int i, rv, *arg, result;
mlx = device_lookup(&mlx_cd, minor(dev));
mlx = device_lookup_private(&mlx_cd, minor(dev));
rb = (struct mlx_rebuild_request *)data;
rs = (struct mlx_rebuild_status *)data;
@ -942,7 +942,7 @@ mlx_periodic_thread(void *cookie)
for (;;) {
for (i = 0; i < mlx_cd.cd_ndevs; i++)
if ((mlx = device_lookup(&mlx_cd, i)) != NULL)
if ((mlx = device_lookup_private(&mlx_cd, i)) != NULL)
if (mlx->mlx_ci.ci_iftype > 1)
mlx_periodic(mlx);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rrunner.c,v 1.66 2008/04/28 20:23:51 martin Exp $ */
/* $NetBSD: rrunner.c,v 1.67 2008/06/08 12:43:51 tsutsui Exp $ */
/*
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.66 2008/04/28 20:23:51 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: rrunner.c,v 1.67 2008/06/08 12:43:51 tsutsui Exp $");
#include "opt_inet.h"
@ -702,7 +702,7 @@ esh_fpopen(dev_t dev, int oflags, int devtype,
int rseg;
int s;
sc = device_lookup(&esh_cd, ESHUNIT(dev));
sc = device_lookup_private(&esh_cd, ESHUNIT(dev));
if (sc == NULL || ulp == HIPPI_ULP_802)
return (ENXIO);
@ -916,7 +916,7 @@ esh_fpclose(dev_t dev, int fflag, int devtype,
int error = 0;
int s;
sc = device_lookup(&esh_cd, ESHUNIT(dev));
sc = device_lookup_private(&esh_cd, ESHUNIT(dev));
if (sc == NULL || ulp == HIPPI_ULP_802)
return (ENXIO);
@ -993,7 +993,7 @@ esh_fpread(dev_t dev, struct uio *uio, int ioflag)
printf("esh_fpread: dev %x\n", dev);
#endif
sc = device_lookup(&esh_cd, ESHUNIT(dev));
sc = device_lookup_private(&esh_cd, ESHUNIT(dev));
if (sc == NULL || ulp == HIPPI_ULP_802)
return (ENXIO);
@ -1152,7 +1152,7 @@ esh_fpwrite(dev_t dev, struct uio *uio, int ioflag)
printf("esh_fpwrite: dev %x\n", dev);
#endif
sc = device_lookup(&esh_cd, ESHUNIT(dev));
sc = device_lookup_private(&esh_cd, ESHUNIT(dev));
if (sc == NULL || ulp == HIPPI_ULP_802)
return (ENXIO);
@ -1301,7 +1301,7 @@ esh_fpstrategy(bp)
bp->b_bcount, bp->b_flags, bp->b_dev, unit, ulp);
#endif
sc = device_lookup(&esh_cd, ESHUNIT(bp->b_dev));
sc = device_lookup_private(&esh_cd, ESHUNIT(bp->b_dev));
s = splnet();
if (sc == NULL || ulp == HIPPI_ULP_802) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcd.c,v 1.104 2008/04/08 20:08:50 cegger Exp $ */
/* $NetBSD: mcd.c,v 1.105 2008/06/08 12:43:52 tsutsui Exp $ */
/*
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved.
@ -56,7 +56,7 @@
/*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.104 2008/04/08 20:08:50 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.105 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -294,7 +294,7 @@ mcdopen(dev_t dev, int flag, int fmt, struct lwp *l)
int error, part;
struct mcd_softc *sc;
sc = device_lookup(&mcd_cd, MCDUNIT(dev));
sc = device_lookup_private(&mcd_cd, MCDUNIT(dev));
if (sc == NULL)
return ENXIO;
@ -389,7 +389,7 @@ bad3:
int
mcdclose(dev_t dev, int flag, int fmt, struct lwp *l)
{
struct mcd_softc *sc = device_lookup(&mcd_cd, MCDUNIT(dev));
struct mcd_softc *sc = device_lookup_private(&mcd_cd, MCDUNIT(dev));
int part = MCDPART(dev);
MCD_TRACE("close: partition=%d\n", part);
@ -423,11 +423,14 @@ void
mcdstrategy(bp)
struct buf *bp;
{
struct mcd_softc *sc = device_lookup(&mcd_cd, MCDUNIT(bp->b_dev));
struct disklabel *lp = sc->sc_dk.dk_label;
struct mcd_softc *sc;
struct disklabel *lp;
daddr_t blkno;
int s;
sc = device_lookup_private(&mcd_cd, MCDUNIT(bp->b_dev));
lp = sc->sc_dk.dk_label;
/* Test validity. */
MCD_TRACE("strategy: buf=0x%p blkno=%d bcount=%d\n", bp,
(int) bp->b_blkno, bp->b_bcount);
@ -549,7 +552,7 @@ mcdwrite(dev_t dev, struct uio *uio, int flags)
int
mcdioctl(dev_t dev, u_long cmd, void *addr, int flag, struct lwp *l)
{
struct mcd_softc *sc = device_lookup(&mcd_cd, MCDUNIT(dev));
struct mcd_softc *sc = device_lookup_private(&mcd_cd, MCDUNIT(dev));
int error;
int part;
#ifdef __HAVE_OLD_DISKLABEL

View File

@ -1,4 +1,4 @@
/* $NetBSD: satlink.c,v 1.38 2008/04/28 20:23:52 martin Exp $ */
/* $NetBSD: satlink.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: satlink.c,v 1.38 2008/04/28 20:23:52 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: satlink.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -250,7 +250,8 @@ satlinkopen(dev_t dev, int flags, int fmt,
struct satlink_softc *sc;
int error;
sc = device_lookup(&satlink_cd, minor(dev));
sc = device_lookup_private(&satlink_cd, minor(dev));
if (sc == NULL)
return (ENXIO);
@ -281,9 +282,11 @@ int
satlinkclose(dev_t dev, int flags, int fmt,
struct lwp *l)
{
struct satlink_softc *sc = device_lookup(&satlink_cd, minor(dev));
struct satlink_softc *sc;
int s;
sc = device_lookup_private(&satlink_cd, minor(dev));
s = splsoftclock();
sc->sc_flags &= ~SATF_ISOPEN;
splx(s);
@ -300,10 +303,12 @@ satlinkread(dev, uio, flags)
struct uio *uio;
int flags;
{
struct satlink_softc *sc = device_lookup(&satlink_cd, minor(dev));
struct satlink_softc *sc;
int error, s, count, sptr;
int wrapcnt, oresid;
sc = device_lookup_private(&satlink_cd, minor(dev));
s = splsoftclock();
/* Wait for data to be available. */
@ -371,7 +376,9 @@ int
satlinkioctl(dev_t dev, u_long cmd, void *data, int flags,
struct lwp *l)
{
struct satlink_softc *sc = device_lookup(&satlink_cd, minor(dev));
struct satlink_softc *sc;
sc = device_lookup_private(&satlink_cd, minor(dev));
switch (cmd) {
case SATIORESET:
@ -398,9 +405,11 @@ satlinkpoll(dev, events, l)
int events;
struct lwp *l;
{
struct satlink_softc *sc = device_lookup(&satlink_cd, minor(dev));
struct satlink_softc *sc;
int s, revents;
sc = device_lookup_private(&satlink_cd, minor(dev));
revents = events & (POLLOUT | POLLWRNORM);
/* Attempt to save some work. */
@ -454,10 +463,12 @@ static const struct filterops satlink_seltrue_filtops =
int
satlinkkqfilter(dev_t dev, struct knote *kn)
{
struct satlink_softc *sc = device_lookup(&satlink_cd, minor(dev));
struct satlink_softc *sc;
struct klist *klist;
int s;
sc = device_lookup_private(&satlink_cd, minor(dev));
switch (kn->kn_filter) {
case EVFILT_READ:
klist = &sc->sc_selq.sel_klist;

View File

@ -1,4 +1,4 @@
/* $NetBSD: seagate.c,v 1.64 2008/04/08 20:08:50 cegger Exp $ */
/* $NetBSD: seagate.c,v 1.65 2008/06/08 12:43:52 tsutsui Exp $ */
/*
* ST01/02, Future Domain TMC-885, TMC-950 SCSI driver
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.64 2008/04/08 20:08:50 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: seagate.c,v 1.65 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -718,7 +718,7 @@ sea_main()
loop:
done = 1;
for (unit = 0; unit < sea_cd.cd_ndevs; unit++) {
sea = device_lookup(&sea_cd, unit);
sea = device_lookup_private(&sea_cd, unit);
if (!sea)
continue;
s = splbio();

View File

@ -1,4 +1,4 @@
/* $NetBSD: wt.c,v 1.79 2008/04/08 20:08:50 cegger Exp $ */
/* $NetBSD: wt.c,v 1.80 2008/06/08 12:43:52 tsutsui Exp $ */
/*
* Streamer tape driver.
@ -51,7 +51,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.79 2008/04/08 20:08:50 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.80 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -355,7 +355,7 @@ wtopen(dev_t dev, int flag, int mode, struct lwp *l)
struct wt_softc *sc;
int error;
sc = device_lookup(&wt_cd, unit);
sc = device_lookup_private(&wt_cd, unit);
if (sc == NULL)
return (ENXIO);
@ -436,7 +436,9 @@ static int
wtclose(dev_t dev, int flags, int mode,
struct lwp *l)
{
struct wt_softc *sc = device_lookup(&wt_cd, minor(dev) & T_UNIT);
struct wt_softc *sc;
sc = device_lookup_private(&wt_cd, minor(dev) & T_UNIT);
/* If rewind is pending, do nothing */
if (sc->flags & TPREW)
@ -486,9 +488,11 @@ static int
wtioctl(dev_t dev, unsigned long cmd, void *addr, int flag,
struct lwp *l)
{
struct wt_softc *sc = device_lookup(&wt_cd, minor(dev) & T_UNIT);
struct wt_softc *sc;
int error, count, op;
sc = device_lookup_private(&wt_cd, minor(dev) & T_UNIT);
switch (cmd) {
default:
return EINVAL;
@ -584,9 +588,11 @@ wtioctl(dev_t dev, unsigned long cmd, void *addr, int flag,
static void
wtstrategy(struct buf *bp)
{
struct wt_softc *sc = device_lookup(&wt_cd, minor(bp->b_dev) & T_UNIT);
struct wt_softc *sc;
int s;
sc = device_lookup_private(&wt_cd, minor(bp->b_dev) & T_UNIT);
bp->b_resid = bp->b_bcount;
/* at file marks and end of tape, we just return '0 bytes available' */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ed_mca.c,v 1.41 2008/05/04 13:11:14 martin Exp $ */
/* $NetBSD: ed_mca.c,v 1.42 2008/06/08 12:43:52 tsutsui Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.41 2008/05/04 13:11:14 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.42 2008/06/08 12:43:52 tsutsui Exp $");
#include "rnd.h"
@ -200,10 +200,13 @@ void
edmcastrategy(bp)
struct buf *bp;
{
struct ed_softc *ed = device_lookup(&ed_cd, DISKUNIT(bp->b_dev));
struct disklabel *lp = ed->sc_dk.dk_label;
struct ed_softc *ed;
struct disklabel *lp;
daddr_t blkno;
ed = device_lookup_private(&ed_cd, DISKUNIT(bp->b_dev));
lp = ed->sc_dk.dk_label;
ATADEBUG_PRINT(("edmcastrategy (%s)\n", device_xname(&ed->sc_dev)),
DEBUG_XFERS);
@ -284,7 +287,7 @@ edmcaopen(dev_t dev, int flag, int fmt, struct lwp *l)
int part, error;
ATADEBUG_PRINT(("edopen\n"), DEBUG_FUNCS);
wd = device_lookup(&ed_cd, DISKUNIT(dev));
wd = device_lookup_private(&ed_cd, DISKUNIT(dev));
if (wd == NULL || (wd->sc_flags & EDF_INIT) == 0)
return (ENXIO);
@ -355,7 +358,7 @@ edmcaopen(dev_t dev, int flag, int fmt, struct lwp *l)
int
edmcaclose(dev_t dev, int flag, int fmt, struct lwp *l)
{
struct ed_softc *wd = device_lookup(&ed_cd, DISKUNIT(dev));
struct ed_softc *wd = device_lookup_private(&ed_cd, DISKUNIT(dev));
int part = DISKPART(dev);
ATADEBUG_PRINT(("edmcaclose\n"), DEBUG_FUNCS);
@ -469,7 +472,7 @@ edmcaioctl(dev, xfer, addr, flag, l)
int flag;
struct lwp *l;
{
struct ed_softc *ed = device_lookup(&ed_cd, DISKUNIT(dev));
struct ed_softc *ed = device_lookup_private(&ed_cd, DISKUNIT(dev));
int error;
ATADEBUG_PRINT(("edioctl\n"), DEBUG_FUNCS);
@ -620,7 +623,7 @@ edmcasize(dev)
ATADEBUG_PRINT(("edsize\n"), DEBUG_FUNCS);
wd = device_lookup(&ed_cd, DISKUNIT(dev));
wd = device_lookup_private(&ed_cd, DISKUNIT(dev));
if (wd == NULL)
return (-1);
@ -665,7 +668,7 @@ edmcadump(dev, blkno, va, size)
return EFAULT;
eddoingadump = 1;
ed = device_lookup(&ed_cd, DISKUNIT(dev));
ed = device_lookup_private(&ed_cd, DISKUNIT(dev));
if (ed == NULL)
return (ENXIO);

View File

@ -1,4 +1,4 @@
/* $NetBSD: agp.c,v 1.57 2008/04/19 09:26:56 njoly Exp $ */
/* $NetBSD: agp.c,v 1.58 2008/06/08 12:43:51 tsutsui Exp $ */
/*-
* Copyright (c) 2000 Doug Rabson
@ -65,7 +65,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.57 2008/04/19 09:26:56 njoly Exp $");
__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.58 2008/06/08 12:43:51 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -837,7 +837,7 @@ static int
agpopen(dev_t dev, int oflags, int devtype,
struct lwp *l)
{
struct agp_softc *sc = device_lookup(&agp_cd, AGPUNIT(dev));
struct agp_softc *sc = device_lookup_private(&agp_cd, AGPUNIT(dev));
if (sc == NULL)
return ENXIO;
@ -857,7 +857,7 @@ static int
agpclose(dev_t dev, int fflag, int devtype,
struct lwp *l)
{
struct agp_softc *sc = device_lookup(&agp_cd, AGPUNIT(dev));
struct agp_softc *sc = device_lookup_private(&agp_cd, AGPUNIT(dev));
struct agp_memory *mem;
/*
@ -891,7 +891,7 @@ agpclose(dev_t dev, int fflag, int devtype,
static int
agpioctl(dev_t dev, u_long cmd, void *data, int fflag, struct lwp *l)
{
struct agp_softc *sc = device_lookup(&agp_cd, AGPUNIT(dev));
struct agp_softc *sc = device_lookup_private(&agp_cd, AGPUNIT(dev));
if (sc == NULL)
return ENODEV;
@ -932,7 +932,7 @@ agpioctl(dev_t dev, u_long cmd, void *data, int fflag, struct lwp *l)
static paddr_t
agpmmap(dev_t dev, off_t offset, int prot)
{
struct agp_softc *sc = device_lookup(&agp_cd, AGPUNIT(dev));
struct agp_softc *sc = device_lookup_private(&agp_cd, AGPUNIT(dev));
if (offset > AGP_GET_APERTURE(sc))
return -1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: amr.c,v 1.48 2008/04/28 20:23:54 martin Exp $ */
/* $NetBSD: amr.c,v 1.49 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.48 2008/04/28 20:23:54 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: amr.c,v 1.49 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -737,7 +737,7 @@ amr_shutdown(void *cookie)
int i, rv, s;
for (i = 0; i < amr_cd.cd_ndevs; i++) {
if ((amr = device_lookup(&amr_cd, i)) == NULL)
if ((amr = device_lookup_private(&amr_cd, i)) == NULL)
continue;
if ((rv = amr_ccb_alloc(amr, &ac)) == 0) {
@ -1306,7 +1306,7 @@ amropen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct amr_softc *amr;
if ((amr = device_lookup(&amr_cd, minor(dev))) == NULL)
if ((amr = device_lookup_private(&amr_cd, minor(dev))) == NULL)
return (ENXIO);
if ((amr->amr_flags & AMRF_OPEN) != 0)
return (EBUSY);
@ -1320,7 +1320,7 @@ amrclose(dev_t dev, int flag, int mode, struct lwp *l)
{
struct amr_softc *amr;
amr = device_lookup(&amr_cd, minor(dev));
amr = device_lookup_private(&amr_cd, minor(dev));
amr->amr_flags &= ~AMRF_OPEN;
return (0);
}
@ -1338,7 +1338,7 @@ amrioctl(dev_t dev, u_long cmd, void *data, int flag,
int error;
void *dp = NULL, *au_buffer;
amr = device_lookup(&amr_cd, minor(dev));
amr = device_lookup_private(&amr_cd, minor(dev));
/* This should be compatible with the FreeBSD interface */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cz.c,v 1.48 2008/04/10 19:13:36 cegger Exp $ */
/* $NetBSD: cz.c,v 1.49 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2000 Zembu Labs, Inc.
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.48 2008/04/10 19:13:36 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: cz.c,v 1.49 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -862,7 +862,7 @@ cztty_getttysoftc(dev_t dev)
for (i = 0, j = 0; i < cz_cd.cd_ndevs; i++) {
k = j;
cz = device_lookup(&cz_cd, i);
cz = device_lookup_private(&cz_cd, i);
if (cz == NULL)
continue;
if (cz->cz_ports == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mly.c,v 1.38 2008/04/28 20:23:55 martin Exp $ */
/* $NetBSD: mly.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.38 2008/04/28 20:23:55 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: mly.c,v 1.39 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -584,7 +584,7 @@ mly_shutdown(void *cookie)
int i;
for (i = 0; i < mly_cd.cd_ndevs; i++) {
if ((mly = device_lookup(&mly_cd, i)) == NULL)
if ((mly = device_lookup_private(&mly_cd, i)) == NULL)
continue;
if (mly_flush(mly))
@ -2247,7 +2247,7 @@ mlyopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct mly_softc *mly;
if ((mly = device_lookup(&mly_cd, minor(dev))) == NULL)
if ((mly = device_lookup_private(&mly_cd, minor(dev))) == NULL)
return (ENXIO);
if ((mly->mly_state & MLY_STATE_INITOK) == 0)
return (ENXIO);
@ -2267,7 +2267,7 @@ mlyclose(dev_t dev, int flag, int mode,
{
struct mly_softc *mly;
mly = device_lookup(&mly_cd, minor(dev));
mly = device_lookup_private(&mly_cd, minor(dev));
mly->mly_state &= ~MLY_STATE_OPEN;
return (0);
}
@ -2282,7 +2282,7 @@ mlyioctl(dev_t dev, u_long cmd, void *data, int flag,
struct mly_softc *mly;
int rv;
mly = device_lookup(&mly_cd, minor(dev));
mly = device_lookup_private(&mly_cd, minor(dev));
switch (cmd) {
case MLYIO_COMMAND:

View File

@ -1,4 +1,4 @@
/* $NetBSD: twa.c,v 1.23 2008/05/10 14:36:02 joerg Exp $ */
/* $NetBSD: twa.c,v 1.24 2008/06/08 12:43:52 tsutsui Exp $ */
/* $wasabi: twa.c,v 1.27 2006/07/28 18:17:21 wrstuden Exp $ */
/*-
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.23 2008/05/10 14:36:02 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: twa.c,v 1.24 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1631,7 +1631,7 @@ twa_shutdown(void *arg)
int i, rv, unit;
for (i = 0; i < twa_cd.cd_ndevs; i++) {
if ((sc = device_lookup(&twa_cd, i)) == NULL)
if ((sc = device_lookup_private(&twa_cd, i)) == NULL)
continue;
for (unit = 0; unit < sc->sc_nunits; unit++)
@ -1911,7 +1911,7 @@ twaopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct twa_softc *twa;
if ((twa = device_lookup(&twa_cd, minor(dev))) == NULL)
if ((twa = device_lookup_private(&twa_cd, minor(dev))) == NULL)
return (ENXIO);
if ((twa->twa_sc_flags & TWA_STATE_OPEN) != 0)
return (EBUSY);
@ -1930,7 +1930,7 @@ twaclose(dev_t dev, int flag, int mode,
{
struct twa_softc *twa;
twa = device_lookup(&twa_cd, minor(dev));
twa = device_lookup_private(&twa_cd, minor(dev));
twa->twa_sc_flags &= ~TWA_STATE_OPEN;
return (0);
}
@ -1960,7 +1960,7 @@ twaioctl(dev_t dev, u_long cmd, void *data, int flag,
int32_t start_index;
int s, error = 0;
sc = device_lookup(&twa_cd, minor(dev));
sc = device_lookup_private(&twa_cd, minor(dev));
switch (cmd) {
case TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH:

View File

@ -1,4 +1,4 @@
/* $NetBSD: twe.c,v 1.86 2008/04/28 20:23:55 martin Exp $ */
/* $NetBSD: twe.c,v 1.87 2008/06/08 12:43:52 tsutsui Exp $ */
/*-
* Copyright (c) 2000, 2001, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.86 2008/04/28 20:23:55 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: twe.c,v 1.87 2008/06/08 12:43:52 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1694,7 +1694,7 @@ tweopen(dev_t dev, int flag, int mode, struct lwp *l)
{
struct twe_softc *twe;
if ((twe = device_lookup(&twe_cd, minor(dev))) == NULL)
if ((twe = device_lookup_private(&twe_cd, minor(dev))) == NULL)
return (ENXIO);
if ((twe->sc_flags & TWEF_OPEN) != 0)
return (EBUSY);
@ -1712,7 +1712,7 @@ tweclose(dev_t dev, int flag, int mode,
{
struct twe_softc *twe;
twe = device_lookup(&twe_cd, minor(dev));
twe = device_lookup_private(&twe_cd, minor(dev));
twe->sc_flags &= ~TWEF_OPEN;
return (0);
}
@ -1742,7 +1742,7 @@ tweioctl(dev_t dev, u_long cmd, void *data, int flag,
int s, error = 0;
u_int8_t cmdid;
twe = device_lookup(&twe_cd, minor(dev));
twe = device_lookup_private(&twe_cd, minor(dev));
tu = (struct twe_usercommand *)data;
tp = (struct twe_paramcommand *)data;
td = (struct twe_drivecommand *)data;