Hibernation: Introduce exportable suspend ioctls header (rev. 2)
[sfrench/cifs-2.6.git] / kernel / sysctl_check.c
index 8f5baac1eb08e68ed254031e592c031745c070da..c3206fa50048b8333be64be54a3a52acf8d39bcb 100644 (file)
@@ -1,6 +1,5 @@
 #include <linux/stat.h>
 #include <linux/sysctl.h>
-#include "../arch/s390/appldata/appldata.h"
 #include "../fs/xfs/linux-2.6/xfs_sysctl.h"
 #include <linux/sunrpc/debug.h>
 #include <linux/string.h>
@@ -96,7 +95,7 @@ static struct trans_ctl_table trans_kern_table[] = {
 
        { KERN_PTY,                     "pty",          trans_pty_table },
        { KERN_NGROUPS_MAX,             "ngroups_max" },
-       { KERN_SPARC_SCONS_PWROFF,      "scons_poweroff" },
+       { KERN_SPARC_SCONS_PWROFF,      "scons-poweroff" },
        { KERN_HZ_TIMER,                "hz_timer" },
        { KERN_UNKNOWN_NMI_PANIC,       "unknown_nmi_panic" },
        { KERN_BOOTLOADER_TYPE,         "bootloader_type" },
@@ -234,36 +233,6 @@ static struct trans_ctl_table trans_net_ipv4_conf_table[] = {
        {}
 };
 
-
-static struct trans_ctl_table trans_net_ipv4_vs_table[] = {
-       { NET_IPV4_VS_AMEMTHRESH,       "amemthresh" },
-       { NET_IPV4_VS_DEBUG_LEVEL,      "debug_level" },
-       { NET_IPV4_VS_AMDROPRATE,       "am_droprate" },
-       { NET_IPV4_VS_DROP_ENTRY,       "drop_entry" },
-       { NET_IPV4_VS_DROP_PACKET,      "drop_packet" },
-       { NET_IPV4_VS_SECURE_TCP,       "secure_tcp" },
-       { NET_IPV4_VS_TO_ES,            "timeout_established" },
-       { NET_IPV4_VS_TO_SS,            "timeout_synsent" },
-       { NET_IPV4_VS_TO_SR,            "timeout_synrecv" },
-       { NET_IPV4_VS_TO_FW,            "timeout_finwait" },
-       { NET_IPV4_VS_TO_TW,            "timeout_timewait" },
-       { NET_IPV4_VS_TO_CL,            "timeout_close" },
-       { NET_IPV4_VS_TO_CW,            "timeout_closewait" },
-       { NET_IPV4_VS_TO_LA,            "timeout_lastack" },
-       { NET_IPV4_VS_TO_LI,            "timeout_listen" },
-       { NET_IPV4_VS_TO_SA,            "timeout_synack" },
-       { NET_IPV4_VS_TO_UDP,           "timeout_udp" },
-       { NET_IPV4_VS_TO_ICMP,          "timeout_icmp" },
-       { NET_IPV4_VS_CACHE_BYPASS,     "cache_bypass" },
-       { NET_IPV4_VS_EXPIRE_NODEST_CONN,       "expire_nodest_conn" },
-       { NET_IPV4_VS_EXPIRE_QUIESCENT_TEMPLATE,        "expire_quiescent_template" },
-       { NET_IPV4_VS_SYNC_THRESHOLD,           "sync_threshold" },
-       { NET_IPV4_VS_NAT_ICMP_SEND,    "nat_icmp_send" },
-       { NET_IPV4_VS_LBLC_EXPIRE,              "lblc_expiration" },
-       { NET_IPV4_VS_LBLCR_EXPIRE,             "lblcr_expiration" },
-       {}
-};
-
 static struct trans_ctl_table trans_net_neigh_vars_table[] = {
        { NET_NEIGH_MCAST_SOLICIT,      "mcast_solicit" },
        { NET_NEIGH_UCAST_SOLICIT,      "ucast_solicit" },
@@ -338,7 +307,6 @@ static struct trans_ctl_table trans_net_ipv4_table[] = {
        { NET_IPV4_ROUTE,               "route",        trans_net_ipv4_route_table },
        /* NET_IPV4_FIB_HASH unused */
        { NET_IPV4_NETFILTER,           "netfilter",    trans_net_ipv4_netfilter_table },
-       { NET_IPV4_VS,                  "vs",           trans_net_ipv4_vs_table },
 
        { NET_IPV4_TCP_TIMESTAMPS,              "tcp_timestamps" },
        { NET_IPV4_TCP_WINDOW_SCALING,          "tcp_window_scaling" },
@@ -459,7 +427,7 @@ static struct trans_ctl_table trans_net_netrom_table[] = {
        {}
 };
 
-static struct trans_ctl_table trans_net_ax25_table[] = {
+static struct trans_ctl_table trans_net_ax25_param_table[] = {
        { NET_AX25_IP_DEFAULT_MODE,     "ip_default_mode" },
        { NET_AX25_DEFAULT_MODE,        "ax25_default_mode" },
        { NET_AX25_BACKOFF_TYPE,        "backoff_type" },
@@ -477,6 +445,11 @@ static struct trans_ctl_table trans_net_ax25_table[] = {
        {}
 };
 
+static struct trans_ctl_table trans_net_ax25_table[] = {
+       { 0, NULL, trans_net_ax25_param_table },
+       {}
+};
+
 static struct trans_ctl_table trans_net_bridge_table[] = {
        { NET_BRIDGE_NF_CALL_ARPTABLES,         "bridge-nf-call-arptables" },
        { NET_BRIDGE_NF_CALL_IPTABLES,          "bridge-nf-call-iptables" },
@@ -1369,7 +1342,8 @@ static void sysctl_repair_table(struct ctl_table *table)
        }
 }
 
-static struct ctl_table *sysctl_check_lookup(struct ctl_table *table)
+static struct ctl_table *sysctl_check_lookup(struct nsproxy *namespaces,
+                                               struct ctl_table *table)
 {
        struct ctl_table_header *head;
        struct ctl_table *ref, *test;
@@ -1377,8 +1351,8 @@ static struct ctl_table *sysctl_check_lookup(struct ctl_table *table)
 
        depth = sysctl_depth(table);
 
-       for (head = sysctl_head_next(NULL); head;
-            head = sysctl_head_next(head)) {
+       for (head = __sysctl_head_next(namespaces, NULL); head;
+            head = __sysctl_head_next(namespaces, head)) {
                cur_depth = depth;
                ref = head->ctl_table;
 repeat:
@@ -1423,13 +1397,14 @@ static void set_fail(const char **fail, struct ctl_table *table, const char *str
        *fail = str;
 }
 
-static int sysctl_check_dir(struct ctl_table *table)
+static int sysctl_check_dir(struct nsproxy *namespaces,
+                               struct ctl_table *table)
 {
        struct ctl_table *ref;
        int error;
 
        error = 0;
-       ref = sysctl_check_lookup(table);
+       ref = sysctl_check_lookup(namespaces, table);
        if (ref) {
                int match = 0;
                if ((!table->procname && !ref->procname) ||
@@ -1454,11 +1429,12 @@ static int sysctl_check_dir(struct ctl_table *table)
        return error;
 }
 
-static void sysctl_check_leaf(struct ctl_table *table, const char **fail)
+static void sysctl_check_leaf(struct nsproxy *namespaces,
+                               struct ctl_table *table, const char **fail)
 {
        struct ctl_table *ref;
 
-       ref = sysctl_check_lookup(table);
+       ref = sysctl_check_lookup(namespaces, table);
        if (ref && (ref != table))
                set_fail(fail, table, "Sysctl already exists");
 }
@@ -1482,7 +1458,7 @@ static void sysctl_check_bin_path(struct ctl_table *table, const char **fail)
        }
 }
 
-int sysctl_check_table(struct ctl_table *table)
+int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table)
 {
        int error = 0;
        for (; table->ctl_name || table->procname; table++) {
@@ -1512,7 +1488,7 @@ int sysctl_check_table(struct ctl_table *table)
                                set_fail(&fail, table, "Directory with extra1");
                        if (table->extra2)
                                set_fail(&fail, table, "Directory with extra2");
-                       if (sysctl_check_dir(table))
+                       if (sysctl_check_dir(namespaces, table))
                                set_fail(&fail, table, "Inconsistent directory names");
                } else {
                        if ((table->strategy == sysctl_data) ||
@@ -1561,7 +1537,7 @@ int sysctl_check_table(struct ctl_table *table)
                        if (!table->procname && table->proc_handler)
                                set_fail(&fail, table, "proc_handler without procname");
 #endif
-                       sysctl_check_leaf(table, &fail);
+                       sysctl_check_leaf(namespaces, table, &fail);
                }
                sysctl_check_bin_path(table, &fail);
                if (fail) {
@@ -1569,7 +1545,7 @@ int sysctl_check_table(struct ctl_table *table)
                        error = -EINVAL;
                }
                if (table->child)
-                       error |= sysctl_check_table(table->child);
+                       error |= sysctl_check_table(namespaces, table->child);
        }
        return error;
 }