* Search all the data sources for matches to our query. We look for * dynamic hints first as overrides for static or fallback hints. */
| 303 | * dynamic hints first as overrides for static or fallback hints. |
| 304 | */ |
| 305 | static int |
| 306 | resource_find(int *line, int *startln, |
| 307 | const char *name, int *unit, const char *resname, const char *value, |
| 308 | const char **ret_name, int *ret_namelen, int *ret_unit, |
| 309 | const char **ret_resname, int *ret_resnamelen, const char **ret_value) |
| 310 | { |
| 311 | int i; |
| 312 | int un; |
| 313 | char *hintp; |
| 314 | |
| 315 | *line = 0; |
| 316 | hintp = NULL; |
| 317 | |
| 318 | /* Search for exact unit matches first */ |
| 319 | i = res_find(&hintp, line, startln, name, unit, resname, value, |
| 320 | ret_name, ret_namelen, ret_unit, ret_resname, ret_resnamelen, |
| 321 | ret_value); |
| 322 | if (i == 0) |
| 323 | return 0; |
| 324 | if (unit == NULL) |
| 325 | return ENOENT; |
| 326 | /* If we are still here, search for wildcard matches */ |
| 327 | un = -1; |
| 328 | i = res_find(&hintp, line, startln, name, &un, resname, value, |
| 329 | ret_name, ret_namelen, ret_unit, ret_resname, ret_resnamelen, |
| 330 | ret_value); |
| 331 | if (i == 0) |
| 332 | return 0; |
| 333 | return ENOENT; |
| 334 | } |
| 335 | |
| 336 | int |
| 337 | resource_int_value(const char *name, int unit, const char *resname, int *result) |
no test coverage detected