sysctl: Remember the ctl_table we passed to register_sysctl_paths
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 30 Nov 2007 12:52:10 +0000 (23:52 +1100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 22:55:17 +0000 (14:55 -0800)
By doing this we allow users of register_sysctl_paths that build
and dynamically allocate their ctl_table to be simpler.  This allows
them to just remember the ctl_table_header returned from
register_sysctl_paths from which they can now find the
ctl_table array they need to free.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Daniel Lezcano <dlezcano@fr.ibm.com>
Cc: Cedric Le Goater <clg@fr.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/sysctl.h
kernel/sysctl.c

index 3b6e2c9fbb2e6c714d0115145ff55fe85a6f16c2..77de3bfd87448f9e3b78fd290e2ffcb47af7514e 100644 (file)
@@ -1057,6 +1057,7 @@ struct ctl_table_header
        struct list_head ctl_entry;
        int used;
        struct completion *unregistering;
+       struct ctl_table *ctl_table_arg;
 };
 
 /* struct ctl_path describes where in the hierarchy a table is added */
index f580542333eb46aa818df6edd826709a0b2f2d60..89b7d95ecf51f1dc7a796996aa3d32fc4bcf525d 100644 (file)
@@ -1669,6 +1669,7 @@ struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path,
                new += 2;
        }
        *prevp = table;
+       header->ctl_table_arg = table;
 
        INIT_LIST_HEAD(&header->ctl_entry);
        header->used = 0;