mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
73dbd8cf79
This commit comes at the tail end of a greater effort to remove the
empty elements at the end of the ctl_table arrays (sentinels) which
will reduce the overall build time size of the kernel and run time
memory bloat by ~64 bytes per sentinel (further information Link :
https://lore.kernel.org/all/ZO5Yx5JFogGi%2FcBo@bombadil.infradead.org/)
To avoid lots of small commits, this commit brings together network
changes from (as they appear in MAINTAINERS) LLC, MPTCP, NETROM NETWORK
LAYER, PHONET PROTOCOL, ROSE NETWORK LAYER, RXRPC SOCKETS, SCTP
PROTOCOL, SHARED MEMORY COMMUNICATIONS (SMC), TIPC NETWORK LAYER and
NETWORKING [IPSEC]
* Remove sentinel element from ctl_table structs.
* Replace empty array registration with the register_net_sysctl_sz call
in llc_sysctl_init
* Replace the for loop stop condition that tests for procname == NULL
with one that depends on array size in sctp_sysctl_net_register
* Remove instances where an array element is zeroed out to make it look
like a sentinel in xfrm_sysctl_init. This is not longer needed and is
safe after commit c899710fe7
("networking: Update to
register_net_sysctl_sz") added the array size to the ctl_table
registration
* Use a table_size variable to keep the value of ARRAY_SIZE
Signed-off-by: Joel Granados <j.granados@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* sysctl_net_llc.c: sysctl interface to LLC net subsystem.
|
|
*
|
|
* Arnaldo Carvalho de Melo <acme@conectiva.com.br>
|
|
*/
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/init.h>
|
|
#include <linux/sysctl.h>
|
|
#include <net/net_namespace.h>
|
|
#include <net/llc.h>
|
|
|
|
#ifndef CONFIG_SYSCTL
|
|
#error This file should not be compiled without CONFIG_SYSCTL defined
|
|
#endif
|
|
|
|
static struct ctl_table llc2_timeout_table[] = {
|
|
{
|
|
.procname = "ack",
|
|
.data = &sysctl_llc2_ack_timeout,
|
|
.maxlen = sizeof(sysctl_llc2_ack_timeout),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_jiffies,
|
|
},
|
|
{
|
|
.procname = "busy",
|
|
.data = &sysctl_llc2_busy_timeout,
|
|
.maxlen = sizeof(sysctl_llc2_busy_timeout),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_jiffies,
|
|
},
|
|
{
|
|
.procname = "p",
|
|
.data = &sysctl_llc2_p_timeout,
|
|
.maxlen = sizeof(sysctl_llc2_p_timeout),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_jiffies,
|
|
},
|
|
{
|
|
.procname = "rej",
|
|
.data = &sysctl_llc2_rej_timeout,
|
|
.maxlen = sizeof(sysctl_llc2_rej_timeout),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_jiffies,
|
|
},
|
|
};
|
|
|
|
static struct ctl_table_header *llc2_timeout_header;
|
|
static struct ctl_table_header *llc_station_header;
|
|
|
|
int __init llc_sysctl_init(void)
|
|
{
|
|
struct ctl_table empty[1] = {};
|
|
llc2_timeout_header = register_net_sysctl(&init_net, "net/llc/llc2/timeout", llc2_timeout_table);
|
|
llc_station_header = register_net_sysctl_sz(&init_net, "net/llc/station", empty, 0);
|
|
|
|
if (!llc2_timeout_header || !llc_station_header) {
|
|
llc_sysctl_exit();
|
|
return -ENOMEM;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
void llc_sysctl_exit(void)
|
|
{
|
|
if (llc2_timeout_header) {
|
|
unregister_net_sysctl_table(llc2_timeout_header);
|
|
llc2_timeout_header = NULL;
|
|
}
|
|
if (llc_station_header) {
|
|
unregister_net_sysctl_table(llc_station_header);
|
|
llc_station_header = NULL;
|
|
}
|
|
}
|