Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * sysctl_net_llc.c: sysctl interface to LLC net subsystem.
4 *
5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br>
6 */
7
8#include <linux/mm.h>
9#include <linux/init.h>
10#include <linux/sysctl.h>
11#include <net/net_namespace.h>
12#include <net/llc.h>
13
14static struct ctl_table llc2_timeout_table[] = {
15 {
16 .procname = "ack",
17 .data = &sysctl_llc2_ack_timeout,
18 .maxlen = sizeof(sysctl_llc2_ack_timeout),
19 .mode = 0644,
20 .proc_handler = proc_dointvec_jiffies,
21 },
22 {
23 .procname = "busy",
24 .data = &sysctl_llc2_busy_timeout,
25 .maxlen = sizeof(sysctl_llc2_busy_timeout),
26 .mode = 0644,
27 .proc_handler = proc_dointvec_jiffies,
28 },
29 {
30 .procname = "p",
31 .data = &sysctl_llc2_p_timeout,
32 .maxlen = sizeof(sysctl_llc2_p_timeout),
33 .mode = 0644,
34 .proc_handler = proc_dointvec_jiffies,
35 },
36 {
37 .procname = "rej",
38 .data = &sysctl_llc2_rej_timeout,
39 .maxlen = sizeof(sysctl_llc2_rej_timeout),
40 .mode = 0644,
41 .proc_handler = proc_dointvec_jiffies,
42 },
43};
44
45static struct ctl_table_header *llc2_timeout_header;
46static struct ctl_table_header *llc_station_header;
47
48int __init llc_sysctl_init(void)
49{
50 struct ctl_table empty[1] = {};
51 llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
52 llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);
53
54 if (!llc2_timeout_header || !llc_station_header) {
55 llc_sysctl_exit();
56 return -ENOMEM;
57 }
58 return 0;
59}
60
61void llc_sysctl_exit(void)
62{
63 if (llc2_timeout_header) {
64 unregister_net_sysctl_table(llc2_timeout_header);
65 llc2_timeout_header = NULL;
66 }
67 if (llc_station_header) {
68 unregister_net_sysctl_table(llc_station_header);
69 llc_station_header = NULL;
70 }
71}