Author: mdf
Date: Mon Nov 29 18:17:53 2010
New Revision: 216058
URL: http://svn.freebsd.org/changeset/base/216058

Log:
  Use the SYSCTL_CHILDREN macro in kern_sysctl.c to help de-obfuscate the
  code.
  
  MFC after:    3 days

Modified:
  head/sys/kern/kern_sysctl.c

Modified: head/sys/kern/kern_sysctl.c
==============================================================================
--- head/sys/kern/kern_sysctl.c Mon Nov 29 15:08:18 2010        (r216057)
+++ head/sys/kern/kern_sysctl.c Mon Nov 29 18:17:53 2010        (r216058)
@@ -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_
                        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_
                                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_
                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,
                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
                                                *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)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to