Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_periph.c
Show First 20 Lines • Show All 549 Lines • ▼ Show 20 Lines | camperiphnextunit(struct periph_driver *p_drv, u_int newunit, bool wired, | ||||
periph_name = p_drv->driver_name; | periph_name = p_drv->driver_name; | ||||
for (;;newunit++) { | for (;;newunit++) { | ||||
for (periph = TAILQ_FIRST(&p_drv->units); | for (periph = TAILQ_FIRST(&p_drv->units); | ||||
periph != NULL && periph->unit_number != newunit; | periph != NULL && periph->unit_number != newunit; | ||||
periph = TAILQ_NEXT(periph, unit_links)) | periph = TAILQ_NEXT(periph, unit_links)) | ||||
; | ; | ||||
if (periph != NULL && periph->unit_number == newunit) { | if (periph != NULL && periph->unit_number == newunit) { | ||||
if (wired) { | if (wired) { | ||||
imp: and here's where we mistakenly think we have a duplicate | |||||
xpt_print(periph->path, "Duplicate Wired " | xpt_print(periph->path, "Duplicate Wired " | ||||
"Device entry!\n"); | "Device entry!\n"); | ||||
xpt_print(periph->path, "Second device (%s " | xpt_print(periph->path, "Second device (%s " | ||||
"device at scbus%d target %d lun %d) will " | "device at scbus%d target %d lun %d) will " | ||||
"not be wired\n", periph_name, pathid, | "not be wired\n", periph_name, pathid, | ||||
target, lun); | target, lun); | ||||
wired = false; | wired = false; | ||||
} | } | ||||
Show All 38 Lines | camperiphunit(struct periph_driver *p_drv, path_id_t pathid, | ||||
int i, val, dunit; | int i, val, dunit; | ||||
const char *dname, *strval; | const char *dname, *strval; | ||||
char pathbuf[32], *periph_name; | char pathbuf[32], *periph_name; | ||||
periph_name = p_drv->driver_name; | periph_name = p_drv->driver_name; | ||||
snprintf(pathbuf, sizeof(pathbuf), "scbus%d", pathid); | snprintf(pathbuf, sizeof(pathbuf), "scbus%d", pathid); | ||||
unit = 0; | unit = 0; | ||||
i = 0; | i = 0; | ||||
dname = periph_name; | dname = periph_name; | ||||
while (resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0) { | |||||
wired = false; | for (wired = false; resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0; | ||||
wired = false) { | |||||
Not Done Inline ActionsYou could perhaps keep using continue if you wanted by making this a for-loop instead: for (wired = false; resource_find_dev(...) == 0; wired = false) { jhb: You could perhaps keep using continue if you wanted by making this a for-loop instead:
```… | |||||
if (resource_string_value(dname, dunit, "at", &strval) == 0) { | if (resource_string_value(dname, dunit, "at", &strval) == 0) { | ||||
if (strcmp(strval, pathbuf) != 0) | if (strcmp(strval, pathbuf) != 0) | ||||
continue; | continue; | ||||
wired = true; | wired = true; | ||||
} | } | ||||
if (resource_int_value(dname, dunit, "target", &val) == 0) { | if (resource_int_value(dname, dunit, "target", &val) == 0) { | ||||
if (val != target) | if (val != target) | ||||
continue; | continue; | ||||
Show All 16 Lines | camperiphunit(struct periph_driver *p_drv, path_id_t pathid, | ||||
} | } | ||||
/* | /* | ||||
* Either start from 0 looking for the next unit or from | * Either start from 0 looking for the next unit or from | ||||
* the unit number given in the resource config. This way, | * the unit number given in the resource config. This way, | ||||
* if we have wildcard matches, we don't return the same | * if we have wildcard matches, we don't return the same | ||||
* unit number twice. | * unit number twice. | ||||
*/ | */ | ||||
unit = camperiphnextunit(p_drv, unit, wired, pathid, target, lun); | unit = camperiphnextunit(p_drv, unit, wired, pathid, target, lun); | ||||
Done Inline ActionsThis is the use of the 'wired' that is incorrect as a result of this bug... imp: This is the use of the 'wired' that is incorrect as a result of this bug... | |||||
return (unit); | return (unit); | ||||
} | } | ||||
void | void | ||||
cam_periph_invalidate(struct cam_periph *periph) | cam_periph_invalidate(struct cam_periph *periph) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 1,541 Lines • Show Last 20 Lines |
and here's where we mistakenly think we have a duplicate