summaryrefslogtreecommitdiffstats
path: root/sys/cam
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-08-24 02:47:01 +0000
committerpeter <peter@FreeBSD.org>2002-08-24 02:47:01 +0000
commitc95babc518928d04b8200f94242b3c2bcdee74d2 (patch)
tree0157e681c3da53e278a3f1ea19dbf37e52fbc602 /sys/cam
parent3b412a9b8428b5dbfbacea1b625ac288893f6bef (diff)
downloadFreeBSD-src-c95babc518928d04b8200f94242b3c2bcdee74d2.zip
FreeBSD-src-c95babc518928d04b8200f94242b3c2bcdee74d2.tar.gz
Fix unit wiring. Also, change the variable "hit" to "wired" so that it
is more obvious. Obtained from: gibbs/ken
Diffstat (limited to 'sys/cam')
-rw-r--r--sys/cam/cam_periph.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 7ffc1c5..48d26e7 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -363,34 +363,33 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid,
target_id_t target, lun_id_t lun)
{
u_int unit;
- int hit, i, val, dunit;
+ int wired, i, val, dunit;
const char *dname, *strval;
char pathbuf[32], *periph_name;
- unit = 0;
- hit = 0;
-
periph_name = p_drv->driver_name;
snprintf(pathbuf, sizeof(pathbuf), "scbus%d", pathid);
+ unit = 0;
i = 0;
dname = periph_name;
- while ((resource_find_dev(&i, dname, &dunit, NULL, NULL)) == 0) {
+ for (wired = 0; resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0;
+ wired = 0) {
if (resource_string_value(dname, dunit, "at", &strval) == 0) {
if (strcmp(strval, pathbuf) != 0)
continue;
- hit++;
+ wired++;
}
if (resource_int_value(dname, dunit, "target", &val) == 0) {
if (val != target)
continue;
- hit++;
+ wired++;
}
if (resource_int_value(dname, dunit, "lun", &val) == 0) {
if (val != lun)
continue;
- hit++;
+ wired++;
}
- if (hit != 0) {
+ if (wired != 0) {
unit = dunit;
break;
}
@@ -402,8 +401,7 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid,
* if we have wildcard matches, we don't return the same
* unit number twice.
*/
- unit = camperiphnextunit(p_drv, unit, /*wired*/hit, pathid,
- target, lun);
+ unit = camperiphnextunit(p_drv, unit, wired, pathid, target, lun);
return (unit);
}
OpenPOWER on IntegriCloud