| 1277 | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); |
| 1278 | |
| 1279 | static int |
| 1280 | name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) |
| 1281 | { |
| 1282 | struct sysctl_oid *oidp; |
| 1283 | struct sysctl_oid_list *lsp = &sysctl__children; |
| 1284 | char *p; |
| 1285 | |
| 1286 | SYSCTL_ASSERT_LOCKED(); |
| 1287 | |
| 1288 | for (*len = 0; *len < CTL_MAXNAME;) { |
| 1289 | p = strsep(&name, "."); |
| 1290 | |
| 1291 | oidp = SLIST_FIRST(lsp); |
| 1292 | for (;; oidp = SLIST_NEXT(oidp, oid_link)) { |
| 1293 | if (oidp == NULL) |
| 1294 | return (ENOENT); |
| 1295 | if (strcmp(p, oidp->oid_name) == 0) |
| 1296 | break; |
| 1297 | } |
| 1298 | *oid++ = oidp->oid_number; |
| 1299 | (*len)++; |
| 1300 | |
| 1301 | if (name == NULL || *name == '\0') { |
| 1302 | if (oidpp) |
| 1303 | *oidpp = oidp; |
| 1304 | return (0); |
| 1305 | } |
| 1306 | |
| 1307 | if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) |
| 1308 | break; |
| 1309 | |
| 1310 | if (oidp->oid_handler) |
| 1311 | break; |
| 1312 | |
| 1313 | lsp = SYSCTL_CHILDREN(oidp); |
| 1314 | } |
| 1315 | return (ENOENT); |
| 1316 | } |
| 1317 | |
| 1318 | static int |
| 1319 | sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) |
no test coverage detected