Slight cleanup - this is logically equivalent code but means one less

use of the evil resource_locate() function.
This commit is contained in:
Peter Wemm 2000-10-15 10:17:55 +00:00
parent 398bc678aa
commit 642f0c46bf

View File

@ -4164,19 +4164,19 @@ xptpathid(const char *sim_name, int sim_unit, int sim_bus)
{
path_id_t pathid;
int i, dunit, val;
char buf[32], *strval;
char buf[32];
pathid = CAM_XPT_PATH_ID;
snprintf(buf, sizeof(buf), "%s%d", sim_name, sim_unit);
i = -1;
while ((i = resource_locate(i, "scbus")) != -1) {
while ((i = resource_query_string(i, "at", buf)) != -1) {
if (strcmp(resource_query_name(i), "scbus")) {
/* Avoid a bit of foot shooting. */
continue;
}
dunit = resource_query_unit(i);
if (dunit < 0) /* unwired?! */
continue;
if (resource_string_value("scbus", dunit, "at", &strval) != 0)
continue;
if (strcmp(buf, strval) != 0)
continue;
if (resource_int_value("scbus", dunit, "bus", &val) == 0) {
if (sim_bus == val) {
pathid = dunit;