summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2016-03-10 13:56:15 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2016-03-10 13:56:15 +0000
commit4ba08529c620e1bc50d13a38954d3c6dc7890694 (patch)
treeca5ebda6bdcc3eb47649e94b4c30d7ee59a5c7d5
parent0c59e4d13c1db108f7bf9412058c0b37a9bf0e39 (diff)
Enforce some naming sanity. Stop using 'sc_link' to mean two different
things by renaming the field 'SLIST_HEAD(, scsi_link) sc_link' to 'sc_link_list' in struct scsibus_softc. Use 'sb' as the short name for scsibus_softc variables. Impetus from & ok bluhm@
-rw-r--r--sys/dev/ic/ahci.c4
-rw-r--r--sys/scsi/scsi_base.c20
-rw-r--r--sys/scsi/scsiconf.c148
-rw-r--r--sys/scsi/scsiconf.h4
4 files changed, 88 insertions, 88 deletions
diff --git a/sys/dev/ic/ahci.c b/sys/dev/ic/ahci.c
index 9f6c596f3ab..0188ab32010 100644
--- a/sys/dev/ic/ahci.c
+++ b/sys/dev/ic/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.23 2015/10/04 07:56:50 jmatthew Exp $ */
+/* $OpenBSD: ahci.c,v 1.24 2016/03/10 13:56:14 krw Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -3221,7 +3221,7 @@ ahci_hibernate_io(dev_t dev, daddr_t blkno, vaddr_t addr, size_t size,
/* find the scsi_link for the device, which has the port */
port = -1;
bus_sc = (struct scsibus_softc *)scsibus;
- SLIST_FOREACH(link, &bus_sc->sc_link, bus_list) {
+ SLIST_FOREACH(link, &bus_sc->sc_link_list, bus_list) {
if (link->device_softc == disk) {
/* link->adapter_softc == sc->sc_atascsi */
port = link->target;
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index cf9c6fb3dc2..17ab51fd658 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_base.c,v 1.222 2016/03/07 18:44:00 naddy Exp $ */
+/* $OpenBSD: scsi_base.c,v 1.223 2016/03/10 13:56:14 krw Exp $ */
/* $NetBSD: scsi_base.c,v 1.43 1997/04/02 02:29:36 mycroft Exp $ */
/*
@@ -66,7 +66,7 @@ struct pool scsi_plug_pool;
struct scsi_plug {
struct task task;
- struct scsibus_softc *sc;
+ struct scsibus_softc *sb;
int target;
int lun;
int how;
@@ -136,7 +136,7 @@ scsi_init(void)
}
int
-scsi_req_probe(struct scsibus_softc *sc, int target, int lun)
+scsi_req_probe(struct scsibus_softc *sb, int target, int lun)
{
struct scsi_plug *p;
@@ -145,7 +145,7 @@ scsi_req_probe(struct scsibus_softc *sc, int target, int lun)
return (ENOMEM);
task_set(&p->task, scsi_plug_probe, p);
- p->sc = sc;
+ p->sb = sb;
p->target = target;
p->lun = lun;
@@ -155,7 +155,7 @@ scsi_req_probe(struct scsibus_softc *sc, int target, int lun)
}
int
-scsi_req_detach(struct scsibus_softc *sc, int target, int lun, int how)
+scsi_req_detach(struct scsibus_softc *sb, int target, int lun, int how)
{
struct scsi_plug *p;
@@ -164,7 +164,7 @@ scsi_req_detach(struct scsibus_softc *sc, int target, int lun, int how)
return (ENOMEM);
task_set(&p->task, scsi_plug_detach, p);
- p->sc = sc;
+ p->sb = sb;
p->target = target;
p->lun = lun;
p->how = how;
@@ -178,25 +178,25 @@ void
scsi_plug_probe(void *xp)
{
struct scsi_plug *p = xp;
- struct scsibus_softc *sc = p->sc;
+ struct scsibus_softc *sb = p->sb;
int target = p->target, lun = p->lun;
pool_put(&scsi_plug_pool, p);
- scsi_probe(sc, target, lun);
+ scsi_probe(sb, target, lun);
}
void
scsi_plug_detach(void *xp)
{
struct scsi_plug *p = xp;
- struct scsibus_softc *sc = p->sc;
+ struct scsibus_softc *sb = p->sb;
int target = p->target, lun = p->lun;
int how = p->how;
pool_put(&scsi_plug_pool, p);
- scsi_detach(sc, target, lun, how);
+ scsi_detach(sb, target, lun, how);
}
int
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 72499d61c30..5d9fc7d0e23 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.c,v 1.193 2015/08/23 01:55:39 tedu Exp $ */
+/* $OpenBSD: scsiconf.c,v 1.194 2016/03/10 13:56:14 krw Exp $ */
/* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */
/*
@@ -177,7 +177,7 @@ scsibusattach(struct device *parent, struct device *self, void *aux)
/* Initialize shared data. */
scsi_init();
- SLIST_INIT(&sb->sc_link);
+ SLIST_INIT(&sb->sc_link_list);
#if NBIO > 0
if (bio_register(&sb->sc_dev, scsibus_bioctl) != 0)
@@ -190,33 +190,33 @@ scsibusattach(struct device *parent, struct device *self, void *aux)
int
scsibusactivate(struct device *dev, int act)
{
- struct scsibus_softc *sc = (struct scsibus_softc *)dev;
+ struct scsibus_softc *sb = (struct scsibus_softc *)dev;
- return scsi_activate(sc, -1, -1, act);
+ return scsi_activate(sb, -1, -1, act);
}
int
-scsi_activate(struct scsibus_softc *sc, int target, int lun, int act)
+scsi_activate(struct scsibus_softc *sb, int target, int lun, int act)
{
if (target == -1 && lun == -1)
- return scsi_activate_bus(sc, act);
+ return scsi_activate_bus(sb, act);
if (target == -1)
return 0;
if (lun == -1)
- return scsi_activate_target(sc, target, act);
+ return scsi_activate_target(sb, target, act);
- return scsi_activate_lun(sc, target, lun, act);
+ return scsi_activate_lun(sb, target, lun, act);
}
int
-scsi_activate_bus(struct scsibus_softc *sc, int act)
+scsi_activate_bus(struct scsibus_softc *sb, int act)
{
int target, rv = 0, r;
- for (target = 0; target < sc->sc_buswidth; target++) {
- r = scsi_activate_target(sc, target, act);
+ for (target = 0; target < sb->sc_buswidth; target++) {
+ r = scsi_activate_target(sb, target, act);
if (r)
rv = r;
}
@@ -224,12 +224,12 @@ scsi_activate_bus(struct scsibus_softc *sc, int act)
}
int
-scsi_activate_target(struct scsibus_softc *sc, int target, int act)
+scsi_activate_target(struct scsibus_softc *sb, int target, int act)
{
int lun, rv = 0, r;
- for (lun = 0; lun < sc->adapter_link->luns; lun++) {
- r = scsi_activate_lun(sc, target, lun, act);
+ for (lun = 0; lun < sb->adapter_link->luns; lun++) {
+ r = scsi_activate_lun(sb, target, lun, act);
if (r)
rv = r;
}
@@ -237,13 +237,13 @@ scsi_activate_target(struct scsibus_softc *sc, int target, int act)
}
int
-scsi_activate_lun(struct scsibus_softc *sc, int target, int lun, int act)
+scsi_activate_lun(struct scsibus_softc *sb, int target, int lun, int act)
{
struct scsi_link *link;
struct device *dev;
int rv = 0;
- link = scsi_get_link(sc, target, lun);
+ link = scsi_get_link(sb, target, lun);
if (link == NULL)
return (0);
@@ -274,7 +274,7 @@ scsibusdetach(struct device *dev, int type)
if (error != 0)
return (error);
- KASSERT(SLIST_EMPTY(&sb->sc_link));
+ KASSERT(SLIST_EMPTY(&sb->sc_link_list));
return (0);
}
@@ -298,17 +298,17 @@ scsibussubmatch(struct device *parent, void *match, void *aux)
int
scsibus_bioctl(struct device *dev, u_long cmd, caddr_t addr)
{
- struct scsibus_softc *sc = (struct scsibus_softc *)dev;
+ struct scsibus_softc *sb = (struct scsibus_softc *)dev;
struct sbioc_device *sdev;
switch (cmd) {
case SBIOCPROBE:
sdev = (struct sbioc_device *)addr;
- return (scsi_probe(sc, sdev->sd_target, sdev->sd_lun));
+ return (scsi_probe(sb, sdev->sd_target, sdev->sd_lun));
case SBIOCDETACH:
sdev = (struct sbioc_device *)addr;
- return (scsi_detach(sc, sdev->sd_target, sdev->sd_lun, 0));
+ return (scsi_detach(sb, sdev->sd_target, sdev->sd_lun, 0));
default:
return (ENOTTY);
@@ -317,29 +317,29 @@ scsibus_bioctl(struct device *dev, u_long cmd, caddr_t addr)
#endif
int
-scsi_probe_bus(struct scsibus_softc *sc)
+scsi_probe_bus(struct scsibus_softc *sb)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
int i;
for (i = 0; i < alink->adapter_buswidth; i++)
- scsi_probe_target(sc, i);
+ scsi_probe_target(sb, i);
return (0);
}
int
-scsi_probe_target(struct scsibus_softc *sc, int target)
+scsi_probe_target(struct scsibus_softc *sb, int target)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
struct scsi_link *link;
struct scsi_report_luns_data *report;
int i, nluns, lun;
- if (scsi_probe_lun(sc, target, 0) == EINVAL)
+ if (scsi_probe_lun(sb, target, 0) == EINVAL)
return (EINVAL);
- link = scsi_get_link(sc, target, 0);
+ link = scsi_get_link(sb, target, 0);
if (link == NULL)
return (ENXIO);
@@ -372,9 +372,9 @@ scsi_probe_target(struct scsibus_softc *sc, int target)
continue;
/* Probe the provided LUN. Don't check LUN 0. */
- scsi_remove_link(sc, link);
- scsi_probe_lun(sc, target, lun);
- scsi_add_link(sc, link);
+ scsi_remove_link(sb, link);
+ scsi_probe_lun(sb, target, lun);
+ scsi_add_link(sb, link);
}
dma_free(report, sizeof(*report));
@@ -383,7 +383,7 @@ scsi_probe_target(struct scsibus_softc *sc, int target)
dumbscan:
for (i = 1; i < alink->luns; i++) {
- if (scsi_probe_lun(sc, target, i) == EINVAL)
+ if (scsi_probe_lun(sb, target, i) == EINVAL)
break;
}
@@ -391,42 +391,42 @@ dumbscan:
}
int
-scsi_probe(struct scsibus_softc *sc, int target, int lun)
+scsi_probe(struct scsibus_softc *sb, int target, int lun)
{
if (target == -1 && lun == -1)
- return (scsi_probe_bus(sc));
+ return (scsi_probe_bus(sb));
/* specific lun and wildcard target is bad */
if (target == -1)
return (EINVAL);
if (lun == -1)
- return (scsi_probe_target(sc, target));
+ return (scsi_probe_target(sb, target));
- return (scsi_probe_lun(sc, target, lun));
+ return (scsi_probe_lun(sb, target, lun));
}
int
-scsi_probe_lun(struct scsibus_softc *sc, int target, int lun)
+scsi_probe_lun(struct scsibus_softc *sb, int target, int lun)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
if (target < 0 || target >= alink->adapter_buswidth ||
target == alink->adapter_target ||
lun < 0 || lun >= alink->luns)
return (ENXIO);
- return (scsi_probedev(sc, target, lun));
+ return (scsi_probedev(sb, target, lun));
}
int
-scsi_detach_bus(struct scsibus_softc *sc, int flags)
+scsi_detach_bus(struct scsibus_softc *sb, int flags)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
int i, err, rv = 0;
for (i = 0; i < alink->adapter_buswidth; i++) {
- err = scsi_detach_target(sc, i, flags);
+ err = scsi_detach_target(sb, i, flags);
if (err != 0 && err != ENXIO)
rv = err;
}
@@ -435,25 +435,25 @@ scsi_detach_bus(struct scsibus_softc *sc, int flags)
}
int
-scsi_detach(struct scsibus_softc *sc, int target, int lun, int flags)
+scsi_detach(struct scsibus_softc *sb, int target, int lun, int flags)
{
if (target == -1 && lun == -1)
- return (scsi_detach_bus(sc, flags));
+ return (scsi_detach_bus(sb, flags));
/* specific lun and wildcard target is bad */
if (target == -1)
return (EINVAL);
if (lun == -1)
- return (scsi_detach_target(sc, target, flags));
+ return (scsi_detach_target(sb, target, flags));
- return (scsi_detach_lun(sc, target, lun, flags));
+ return (scsi_detach_lun(sb, target, lun, flags));
}
int
-scsi_detach_target(struct scsibus_softc *sc, int target, int flags)
+scsi_detach_target(struct scsibus_softc *sb, int target, int flags)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
int i, err, rv = 0;
if (target < 0 || target >= alink->adapter_buswidth ||
@@ -461,10 +461,10 @@ scsi_detach_target(struct scsibus_softc *sc, int target, int flags)
return (ENXIO);
for (i = 0; i < alink->luns; i++) { /* nicer backwards? */
- if (scsi_get_link(sc, target, i) == NULL)
+ if (scsi_get_link(sb, target, i) == NULL)
continue;
- err = scsi_detach_lun(sc, target, i, flags);
+ err = scsi_detach_lun(sb, target, i, flags);
if (err != 0 && err != ENXIO)
rv = err;
}
@@ -473,9 +473,9 @@ scsi_detach_target(struct scsibus_softc *sc, int target, int flags)
}
int
-scsi_detach_lun(struct scsibus_softc *sc, int target, int lun, int flags)
+scsi_detach_lun(struct scsibus_softc *sb, int target, int lun, int flags)
{
- struct scsi_link *alink = sc->adapter_link;
+ struct scsi_link *alink = sb->adapter_link;
struct scsi_link *link;
int rv;
@@ -484,7 +484,7 @@ scsi_detach_lun(struct scsibus_softc *sc, int target, int lun, int flags)
lun < 0 || lun >= alink->luns)
return (ENXIO);
- link = scsi_get_link(sc, target, lun);
+ link = scsi_get_link(sb, target, lun);
if (link == NULL)
return (ENXIO);
@@ -515,18 +515,18 @@ scsi_detach_lun(struct scsibus_softc *sc, int target, int lun, int flags)
/* 5. free up its state in the midlayer */
if (link->id != NULL)
devid_free(link->id);
- scsi_remove_link(sc, link);
+ scsi_remove_link(sb, link);
free(link, M_DEVBUF, sizeof(*link));
return (0);
}
struct scsi_link *
-scsi_get_link(struct scsibus_softc *sc, int target, int lun)
+scsi_get_link(struct scsibus_softc *sb, int target, int lun)
{
struct scsi_link *link;
- SLIST_FOREACH(link, &sc->sc_link, bus_list)
+ SLIST_FOREACH(link, &sb->sc_link_list, bus_list)
if (link->target == target && link->lun == lun)
return (link);
@@ -534,15 +534,15 @@ scsi_get_link(struct scsibus_softc *sc, int target, int lun)
}
void
-scsi_add_link(struct scsibus_softc *sc, struct scsi_link *link)
+scsi_add_link(struct scsibus_softc *sb, struct scsi_link *link)
{
- SLIST_INSERT_HEAD(&sc->sc_link, link, bus_list);
+ SLIST_INSERT_HEAD(&sb->sc_link_list, link, bus_list);
}
void
-scsi_remove_link(struct scsibus_softc *sc, struct scsi_link *link)
+scsi_remove_link(struct scsibus_softc *sb, struct scsi_link *link)
{
- SLIST_REMOVE(&sc->sc_link, link, scsi_link, bus_list);
+ SLIST_REMOVE(&sb->sc_link_list, link, scsi_link, bus_list);
}
void
@@ -846,7 +846,7 @@ scsibusprint(void *aux, const char *pnp)
* Return 0 if further LUNs are possible, EINVAL if not.
*/
int
-scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
+scsi_probedev(struct scsibus_softc *sb, int target, int lun)
{
const struct scsi_quirk_inquiry_pattern *finger;
struct scsi_inquiry_data *inqbuf, *usbinqbuf;
@@ -856,14 +856,14 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
int priority, rslt = 0;
/* Skip this slot if it is already attached and try the next LUN. */
- if (scsi_get_link(scsi, target, lun) != NULL)
+ if (scsi_get_link(sb, target, lun) != NULL)
return (0);
sc_link = malloc(sizeof(*sc_link), M_DEVBUF, M_NOWAIT);
if (sc_link == NULL)
return (EINVAL);
- *sc_link = *scsi->adapter_link;
+ *sc_link = *sb->adapter_link;
sc_link->target = target;
sc_link->lun = lun;
sc_link->interpret_sense = scsi_interpret_sense;
@@ -873,8 +873,8 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
SC_DEBUG(sc_link, SDEV_DB2, ("scsi_link created.\n"));
/* ask the adapter if this will be a valid device */
- if (scsi->adapter_link->adapter->dev_probe != NULL &&
- scsi->adapter_link->adapter->dev_probe(sc_link) != 0) {
+ if (sb->adapter_link->adapter->dev_probe != NULL &&
+ sb->adapter_link->adapter->dev_probe(sc_link) != 0) {
if (lun == 0)
rslt = EINVAL;
goto free;
@@ -909,8 +909,8 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
* Ask the device what it is
*/
#ifdef SCSIDEBUG
- if (((scsi->sc_dev.dv_unit < 32) &&
- ((1U << scsi->sc_dev.dv_unit) & scsidebug_buses)) &&
+ if (((sb->sc_dev.dv_unit < 32) &&
+ ((1U << sb->sc_dev.dv_unit) & scsidebug_buses)) &&
((target < 32) && ((1U << target) & scsidebug_targets)) &&
((lun < 32) && ((1U << lun) & scsidebug_luns)))
sc_link->flags |= scsidebug_level;
@@ -964,7 +964,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
scsi_devid(sc_link);
- link0 = scsi_get_link(scsi, target, 0);
+ link0 = scsi_get_link(sb, target, 0);
if (lun == 0 || link0 == NULL)
;
else if (sc_link->flags & SDEV_UMASS)
@@ -1019,9 +1019,9 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
sa.sa_sc_link = sc_link;
sa.sa_inqbuf = &sc_link->inqdata;
- if ((cf = config_search(scsibussubmatch, (struct device *)scsi,
+ if ((cf = config_search(scsibussubmatch, (struct device *)sb,
&sa)) == 0) {
- scsibusprint(&sa, scsi->sc_dev.dv_xname);
+ scsibusprint(&sa, sb->sc_dev.dv_xname);
printf(" not configured\n");
goto free_devid;
}
@@ -1033,7 +1033,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
* point to prevent such helpfulness before it causes confusion.
*/
if (lun == 0 && (sc_link->flags & SDEV_UMASS) &&
- scsi_get_link(scsi, target, 1) == NULL && sc_link->luns > 1 &&
+ scsi_get_link(sb, target, 1) == NULL && sc_link->luns > 1 &&
(usbinqbuf = dma_alloc(sizeof(*usbinqbuf), M_NOWAIT)) != NULL) {
sc_link->lun = 1;
@@ -1043,7 +1043,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
dma_free(usbinqbuf, sizeof(*usbinqbuf));
}
- scsi_add_link(scsi, sc_link);
+ scsi_add_link(sb, sc_link);
/*
* Generate a TEST_UNIT_READY command. This gives drivers waiting for
@@ -1058,7 +1058,7 @@ scsi_probedev(struct scsibus_softc *scsi, int target, int lun)
scsi_autoconf | SCSI_IGNORE_ILLEGAL_REQUEST |
SCSI_IGNORE_NOT_READY | SCSI_IGNORE_MEDIA_CHANGE);
- config_attach((struct device *)scsi, cf, &sa, scsibusprint);
+ config_attach((struct device *)sb, cf, &sa, scsibusprint);
return (0);
@@ -1069,8 +1069,8 @@ bad:
if (ISSET(sc_link->flags, SDEV_OWN_IOPL))
free(sc_link->pool, M_DEVBUF, sizeof(*sc_link->pool));
- if (scsi->adapter_link->adapter->dev_free != NULL)
- scsi->adapter_link->adapter->dev_free(sc_link);
+ if (sb->adapter_link->adapter->dev_free != NULL)
+ sb->adapter_link->adapter->dev_free(sc_link);
free:
free(sc_link, M_DEVBUF, sizeof(*sc_link));
return (rslt);
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 37f083e34ad..9ec913a55da 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsiconf.h,v 1.163 2015/06/07 19:13:27 krw Exp $ */
+/* $OpenBSD: scsiconf.h,v 1.164 2016/03/10 13:56:14 krw Exp $ */
/* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */
/*
@@ -369,7 +369,7 @@ struct scsibus_attach_args {
struct scsibus_softc {
struct device sc_dev;
struct scsi_link *adapter_link; /* prototype supplied by adapter */
- SLIST_HEAD(, scsi_link) sc_link;
+ SLIST_HEAD(, scsi_link) sc_link_list;
u_int16_t sc_buswidth;
};