| 1323 | } |
| 1324 | |
| 1325 | int |
| 1326 | dumper_remove(const char *devname, const struct diocskerneldump_arg *kda) |
| 1327 | { |
| 1328 | struct dumperinfo *di, *sdi; |
| 1329 | bool found; |
| 1330 | int error; |
| 1331 | |
| 1332 | error = priv_check(curthread, PRIV_SETDUMPER); |
| 1333 | if (error != 0) |
| 1334 | return (error); |
| 1335 | |
| 1336 | /* |
| 1337 | * Try to find a matching configuration, and kill it. |
| 1338 | * |
| 1339 | * NULL 'kda' indicates remove any configuration matching 'devname', |
| 1340 | * which may remove multiple configurations in atypical configurations. |
| 1341 | */ |
| 1342 | found = false; |
| 1343 | mtx_lock(&dumpconf_list_lk); |
| 1344 | TAILQ_FOREACH_SAFE(di, &dumper_configs, di_next, sdi) { |
| 1345 | if (dumper_config_match(di, devname, kda)) { |
| 1346 | found = true; |
| 1347 | TAILQ_REMOVE(&dumper_configs, di, di_next); |
| 1348 | free_single_dumper(di); |
| 1349 | } |
| 1350 | } |
| 1351 | mtx_unlock(&dumpconf_list_lk); |
| 1352 | |
| 1353 | /* Only produce ENOENT if a more targeted match didn't match. */ |
| 1354 | if (!found && kda->kda_index == KDA_REMOVE) |
| 1355 | return (ENOENT); |
| 1356 | return (0); |
| 1357 | } |
| 1358 | |
| 1359 | static int |
| 1360 | dump_check_bounds(struct dumperinfo *di, off_t offset, size_t length) |
no test coverage detected