* err = resource_find_match(&anchor, &name, &unit, resname, value) * Iteratively fetch a list of devices wired "at" something * res and value are restrictions. eg: "at", "scbus0". * For practical purposes, res = required, value = optional. * *name and *unit are set. * set *anchor to zero before starting. */
| 429 | * set *anchor to zero before starting. |
| 430 | */ |
| 431 | int |
| 432 | resource_find_match(int *anchor, const char **name, int *unit, |
| 433 | const char *resname, const char *value) |
| 434 | { |
| 435 | const char *found_name; |
| 436 | int found_namelen; |
| 437 | int found_unit; |
| 438 | int ret; |
| 439 | int newln; |
| 440 | |
| 441 | newln = *anchor; |
| 442 | ret = resource_find(anchor, &newln, NULL, NULL, resname, value, |
| 443 | &found_name, &found_namelen, &found_unit, NULL, NULL, NULL); |
| 444 | if (ret == 0) { |
| 445 | *name = resource_string_copy(found_name, found_namelen); |
| 446 | *unit = found_unit; |
| 447 | } |
| 448 | *anchor = newln; |
| 449 | return ret; |
| 450 | } |
| 451 | |
| 452 | /* |
| 453 | * err = resource_find_dev(&anchor, name, &unit, res, value); |
no test coverage detected