mirror of
https://github.com/torvalds/linux.git
synced 2024-12-01 08:31:37 +00:00
ce218712b0
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/)
* Remove sentinel element from ctl_table structs.
* Remove the zeroing out of an array element (to make it look like a
sentinel) in neigh_sysctl_register and lowpan_frags_ns_sysctl_register
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.
* Replace the for loop stop condition in sysctl_core_net_init that tests
for procname == NULL with one that depends on array size
* Removed the "-1" in mpls_net_init that adjusted for having an extra
empty element when looping over ctl_table arrays
* 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>
112 lines
2.6 KiB
C
112 lines
2.6 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* net/dccp/sysctl.c
|
|
*
|
|
* An implementation of the DCCP protocol
|
|
* Arnaldo Carvalho de Melo <acme@mandriva.com>
|
|
*/
|
|
|
|
#include <linux/mm.h>
|
|
#include <linux/sysctl.h>
|
|
#include "dccp.h"
|
|
#include "feat.h"
|
|
|
|
#ifndef CONFIG_SYSCTL
|
|
#error This file should not be compiled without CONFIG_SYSCTL defined
|
|
#endif
|
|
|
|
/* Boundary values */
|
|
static int u8_max = 0xFF;
|
|
static unsigned long seqw_min = DCCPF_SEQ_WMIN,
|
|
seqw_max = 0xFFFFFFFF; /* maximum on 32 bit */
|
|
|
|
static struct ctl_table dccp_default_table[] = {
|
|
{
|
|
.procname = "seq_window",
|
|
.data = &sysctl_dccp_sequence_window,
|
|
.maxlen = sizeof(sysctl_dccp_sequence_window),
|
|
.mode = 0644,
|
|
.proc_handler = proc_doulongvec_minmax,
|
|
.extra1 = &seqw_min, /* RFC 4340, 7.5.2 */
|
|
.extra2 = &seqw_max,
|
|
},
|
|
{
|
|
.procname = "rx_ccid",
|
|
.data = &sysctl_dccp_rx_ccid,
|
|
.maxlen = sizeof(sysctl_dccp_rx_ccid),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ZERO,
|
|
.extra2 = &u8_max, /* RFC 4340, 10. */
|
|
},
|
|
{
|
|
.procname = "tx_ccid",
|
|
.data = &sysctl_dccp_tx_ccid,
|
|
.maxlen = sizeof(sysctl_dccp_tx_ccid),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ZERO,
|
|
.extra2 = &u8_max, /* RFC 4340, 10. */
|
|
},
|
|
{
|
|
.procname = "request_retries",
|
|
.data = &sysctl_dccp_request_retries,
|
|
.maxlen = sizeof(sysctl_dccp_request_retries),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ONE,
|
|
.extra2 = &u8_max,
|
|
},
|
|
{
|
|
.procname = "retries1",
|
|
.data = &sysctl_dccp_retries1,
|
|
.maxlen = sizeof(sysctl_dccp_retries1),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ZERO,
|
|
.extra2 = &u8_max,
|
|
},
|
|
{
|
|
.procname = "retries2",
|
|
.data = &sysctl_dccp_retries2,
|
|
.maxlen = sizeof(sysctl_dccp_retries2),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ZERO,
|
|
.extra2 = &u8_max,
|
|
},
|
|
{
|
|
.procname = "tx_qlen",
|
|
.data = &sysctl_dccp_tx_qlen,
|
|
.maxlen = sizeof(sysctl_dccp_tx_qlen),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_minmax,
|
|
.extra1 = SYSCTL_ZERO,
|
|
},
|
|
{
|
|
.procname = "sync_ratelimit",
|
|
.data = &sysctl_dccp_sync_ratelimit,
|
|
.maxlen = sizeof(sysctl_dccp_sync_ratelimit),
|
|
.mode = 0644,
|
|
.proc_handler = proc_dointvec_ms_jiffies,
|
|
},
|
|
};
|
|
|
|
static struct ctl_table_header *dccp_table_header;
|
|
|
|
int __init dccp_sysctl_init(void)
|
|
{
|
|
dccp_table_header = register_net_sysctl(&init_net, "net/dccp/default",
|
|
dccp_default_table);
|
|
|
|
return dccp_table_header != NULL ? 0 : -ENOMEM;
|
|
}
|
|
|
|
void dccp_sysctl_exit(void)
|
|
{
|
|
if (dccp_table_header != NULL) {
|
|
unregister_net_sysctl_table(dccp_table_header);
|
|
dccp_table_header = NULL;
|
|
}
|
|
}
|