vfs: nameidata_to_filp(): inline __dentry_open()
[platform/adaptation/renesas_rcar/renesas_kernel.git] / net / xfrm / xfrm_sysctl.c
1 #include <linux/sysctl.h>
2 #include <linux/slab.h>
3 #include <net/net_namespace.h>
4 #include <net/xfrm.h>
5
6 static void __net_init __xfrm_sysctl_init(struct net *net)
7 {
8         net->xfrm.sysctl_aevent_etime = XFRM_AE_ETIME;
9         net->xfrm.sysctl_aevent_rseqth = XFRM_AE_SEQT_SIZE;
10         net->xfrm.sysctl_larval_drop = 1;
11         net->xfrm.sysctl_acq_expires = 30;
12 }
13
14 #ifdef CONFIG_SYSCTL
15 static struct ctl_table xfrm_table[] = {
16         {
17                 .procname       = "xfrm_aevent_etime",
18                 .maxlen         = sizeof(u32),
19                 .mode           = 0644,
20                 .proc_handler   = proc_dointvec
21         },
22         {
23                 .procname       = "xfrm_aevent_rseqth",
24                 .maxlen         = sizeof(u32),
25                 .mode           = 0644,
26                 .proc_handler   = proc_dointvec
27         },
28         {
29                 .procname       = "xfrm_larval_drop",
30                 .maxlen         = sizeof(int),
31                 .mode           = 0644,
32                 .proc_handler   = proc_dointvec
33         },
34         {
35                 .procname       = "xfrm_acq_expires",
36                 .maxlen         = sizeof(int),
37                 .mode           = 0644,
38                 .proc_handler   = proc_dointvec
39         },
40         {}
41 };
42
43 int __net_init xfrm_sysctl_init(struct net *net)
44 {
45         struct ctl_table *table;
46
47         __xfrm_sysctl_init(net);
48
49         table = kmemdup(xfrm_table, sizeof(xfrm_table), GFP_KERNEL);
50         if (!table)
51                 goto out_kmemdup;
52         table[0].data = &net->xfrm.sysctl_aevent_etime;
53         table[1].data = &net->xfrm.sysctl_aevent_rseqth;
54         table[2].data = &net->xfrm.sysctl_larval_drop;
55         table[3].data = &net->xfrm.sysctl_acq_expires;
56
57         net->xfrm.sysctl_hdr = register_net_sysctl(net, "net/core", table);
58         if (!net->xfrm.sysctl_hdr)
59                 goto out_register;
60         return 0;
61
62 out_register:
63         kfree(table);
64 out_kmemdup:
65         return -ENOMEM;
66 }
67
68 void __net_exit xfrm_sysctl_fini(struct net *net)
69 {
70         struct ctl_table *table;
71
72         table = net->xfrm.sysctl_hdr->ctl_table_arg;
73         unregister_net_sysctl_table(net->xfrm.sysctl_hdr);
74         kfree(table);
75 }
76 #else
77 int __net_init xfrm_sysctl_init(struct net *net)
78 {
79         __xfrm_sysctl_init(net);
80         return 0;
81 }
82 #endif