* Clear a value associated with a device by removing it from * the kernel environment. This only removes a hint for an * exact unit. */
| 494 | * exact unit. |
| 495 | */ |
| 496 | int |
| 497 | resource_unset_value(const char *name, int unit, const char *resname) |
| 498 | { |
| 499 | char varname[128]; |
| 500 | const char *retname, *retvalue; |
| 501 | int error, line; |
| 502 | size_t len; |
| 503 | |
| 504 | line = 0; |
| 505 | error = resource_find(&line, NULL, name, &unit, resname, NULL, |
| 506 | &retname, NULL, NULL, NULL, NULL, &retvalue); |
| 507 | if (error) |
| 508 | return (error); |
| 509 | |
| 510 | retname -= strlen("hint."); |
| 511 | len = retvalue - retname - 1; |
| 512 | if (len > sizeof(varname) - 1) |
| 513 | return (ENAMETOOLONG); |
| 514 | memcpy(varname, retname, len); |
| 515 | varname[len] = '\0'; |
| 516 | return (kern_unsetenv(varname)); |
| 517 | } |
no test coverage detected