summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_sysctl.c
diff options
context:
space:
mode:
authormdf <mdf@FreeBSD.org>2010-11-29 18:17:53 +0000
committermdf <mdf@FreeBSD.org>2010-11-29 18:17:53 +0000
commitfdb72b2e1f3f5262fb4bb115e57b929361a47827 (patch)
tree65d4c8a55a1487fa6917de58230ed0bba625d67b /sys/kern/kern_sysctl.c
parent1d463bf0b8cba294bb4693765c1634be66ca4a88 (diff)
downloadFreeBSD-src-fdb72b2e1f3f5262fb4bb115e57b929361a47827.zip
FreeBSD-src-fdb72b2e1f3f5262fb4bb115e57b929361a47827.tar.gz
Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
code. MFC after: 3 days
Diffstat (limited to 'sys/kern/kern_sysctl.c')
-rw-r--r--sys/kern/kern_sysctl.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 49ccc50..352bd92 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -676,7 +676,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS)
if (oid->oid_handler)
break;
- lsp2 = (struct sysctl_oid_list *)oid->oid_arg1;
+ lsp2 = SYSCTL_CHILDREN(oid);
break;
}
lsp = lsp2;
@@ -707,7 +707,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen,
if (oidp->oid_handler)
/* We really should call the handler here...*/
return (0);
- lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+ lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, 0, 0, next+1,
len, level+1, oidpp))
return (0);
@@ -722,7 +722,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen,
return (0);
if (oidp->oid_handler)
return (0);
- lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+ lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1,
next+1, len, level+1, oidpp))
return (0);
@@ -734,7 +734,7 @@ sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen,
if (oidp->oid_handler)
continue;
- lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+ lsp = SYSCTL_CHILDREN(oidp);
if (!sysctl_sysctl_next_ls(lsp, name+1, namelen-1, next+1,
len, level+1, oidpp))
return (0);
@@ -812,7 +812,7 @@ name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp)
if (oidp->oid_handler)
break;
- lsp = (struct sysctl_oid_list *)oidp->oid_arg1;
+ lsp = SYSCTL_CHILDREN(oidp);
oidp = SLIST_FIRST(lsp);
name = p+1;
for (p = name; *p && *p != '.'; p++)
@@ -1322,8 +1322,7 @@ sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
*nindx = indx;
return (0);
}
- oid = SLIST_FIRST(
- (struct sysctl_oid_list *)oid->oid_arg1);
+ oid = SLIST_FIRST(SYSCTL_CHILDREN(oid));
} else if (indx == namelen) {
*noid = oid;
if (nindx != NULL)
OpenPOWER on IntegriCloud