Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d912b0cc1a617d7c590d57b7ea971d50c7f02503
Commit:     d912b0cc1a617d7c590d57b7ea971d50c7f02503
Parent:     77b14db502cb85a031fe8fde6c85d52f3e0acb63
Author:     Eric W. Biederman <[EMAIL PROTECTED]>
AuthorDate: Wed Feb 14 00:34:13 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Feb 14 08:10:00 2007 -0800

    [PATCH] sysctl: add a parent entry to ctl_table and set the parent entry
    
    Add a parent entry into the ctl_table so you can walk the list of parents 
and
    find the entire path to a ctl_table entry.
    
    Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]>
    Cc: Stephen Smalley <[EMAIL PROTECTED]>
    Cc: James Morris <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 include/linux/sysctl.h |    1 +
 kernel/sysctl.c        |   18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 8915049..1371d7b 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1022,6 +1022,7 @@ struct ctl_table
        int maxlen;
        mode_t mode;
        ctl_table *child;
+       ctl_table *parent;              /* Automatically set */
        proc_handler *proc_handler;     /* Callback for text formatting */
        ctl_handler *strategy;          /* Callback function for all r/w */
        struct proc_dir_entry *de;      /* /proc control block */
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index b3ee791..3ca1d5f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1240,6 +1240,23 @@ int do_sysctl_strategy (ctl_table *table,
 }
 #endif /* CONFIG_SYSCTL_SYSCALL */
 
+static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table 
*table)
+{
+       for (; table->ctl_name || table->procname; table++) {
+               table->parent = parent;
+               if (table->child)
+                       sysctl_set_parent(table, table->child);
+       }
+}
+
+static __init int sysctl_init(void)
+{
+       sysctl_set_parent(NULL, root_table);
+       return 0;
+}
+
+core_initcall(sysctl_init);
+
 /**
  * register_sysctl_table - register a sysctl hierarchy
  * @table: the top-level table structure
@@ -1318,6 +1335,7 @@ struct ctl_table_header *register_sysctl_table(ctl_table 
* table)
        INIT_LIST_HEAD(&tmp->ctl_entry);
        tmp->used = 0;
        tmp->unregistering = NULL;
+       sysctl_set_parent(NULL, table);
        spin_lock(&sysctl_lock);
        list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
        spin_unlock(&sysctl_lock);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to