Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
0004  *
0005  * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
0006  */
0007 
0008 #include <linux/mm.h>
0009 #include <linux/init.h>
0010 #include <linux/sysctl.h>
0011 #include <net/net_namespace.h>
0012 #include <net/llc.h>
0013 
0014 #ifndef CONFIG_SYSCTL
0015 #error This file should not be compiled without CONFIG_SYSCTL defined
0016 #endif
0017 
0018 static struct ctl_table llc2_timeout_table[] = {
0019     {
0020         .procname   = "ack",
0021         .data       = &sysctl_llc2_ack_timeout,
0022         .maxlen     = sizeof(sysctl_llc2_ack_timeout),
0023         .mode       = 0644,
0024         .proc_handler   = proc_dointvec_jiffies,
0025     },
0026     {
0027         .procname   = "busy",
0028         .data       = &sysctl_llc2_busy_timeout,
0029         .maxlen     = sizeof(sysctl_llc2_busy_timeout),
0030         .mode       = 0644,
0031         .proc_handler   = proc_dointvec_jiffies,
0032     },
0033     {
0034         .procname   = "p",
0035         .data       = &sysctl_llc2_p_timeout,
0036         .maxlen     = sizeof(sysctl_llc2_p_timeout),
0037         .mode       = 0644,
0038         .proc_handler   = proc_dointvec_jiffies,
0039     },
0040     {
0041         .procname   = "rej",
0042         .data       = &sysctl_llc2_rej_timeout,
0043         .maxlen     = sizeof(sysctl_llc2_rej_timeout),
0044         .mode       = 0644,
0045         .proc_handler   = proc_dointvec_jiffies,
0046     },
0047     { },
0048 };
0049 
0050 static struct ctl_table llc_station_table[] = {
0051     { },
0052 };
0053 
0054 static struct ctl_table_header *llc2_timeout_header;
0055 static struct ctl_table_header *llc_station_header;
0056 
0057 int __init llc_sysctl_init(void)
0058 {
0059     llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
0060     llc_station_header = register_net_sysctl(&init_net, "net/llc/station", llc_station_table);
0061 
0062     if (!llc2_timeout_header || !llc_station_header) {
0063         llc_sysctl_exit();
0064         return -ENOMEM;
0065     }
0066     return 0;
0067 }
0068 
0069 void llc_sysctl_exit(void)
0070 {
0071     if (llc2_timeout_header) {
0072         unregister_net_sysctl_table(llc2_timeout_header);
0073         llc2_timeout_header = NULL;
0074     }
0075     if (llc_station_header) {
0076         unregister_net_sysctl_table(llc_station_header);
0077         llc_station_header = NULL;
0078     }
0079 }