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]>
---

This is an incremental patch on top of my previous sysctl work.

 include/linux/sysctl.h |    1 +
 kernel/sysctl.c        |   10 ++++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 286e723..24f36f1 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1024,6 +1024,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 */
        void *extra1;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ae6a424..0a5499f 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1232,6 +1232,15 @@ 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);
+       }
+}
+
 /**
  * register_sysctl_table - register a sysctl hierarchy
  * @table: the top-level table structure
@@ -1311,6 +1320,7 @@ static struct ctl_table_header *__register_sysctl_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->ctl_entry);
        spin_unlock(&sysctl_lock);
-- 
1.4.4.1.g278f

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to