Skip to content

Commit

Permalink
net: Convert uses of typedef ctl_table to struct ctl_table
Browse files Browse the repository at this point in the history
Reduce the uses of this unnecessary typedef.

Done via perl script:

$ git grep --name-only -w ctl_table net | \
  xargs perl -p -i -e '\
	sub trim { my ($local) = @_; $local =~ s/(^\s+|\s+$)//g; return $local; } \
        s/\b(?<!struct\s)ctl_table\b(\s*\*\s*|\s+\w+)/"struct ctl_table " . trim($1)/ge'

Reflow the modified lines that now exceed 80 columns.

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
JoePerches authored and davem330 committed Jun 13, 2013
1 parent 194f4a6 commit fe2c633
Show file tree
Hide file tree
Showing 32 changed files with 86 additions and 85 deletions.
2 changes: 1 addition & 1 deletion net/ax25/sysctl_net_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int min_proto[1], max_proto[] = { AX25_PROTO_MAX };
static int min_ds_timeout[1], max_ds_timeout[] = {65535000};
#endif

static const ctl_table ax25_param_table[] = {
static const struct ctl_table ax25_param_table[] = {
{
.procname = "ip_default_mode",
.maxlen = sizeof(int),
Expand Down
4 changes: 2 additions & 2 deletions net/bridge/br_netfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,7 @@ static struct nf_hook_ops br_nf_ops[] __read_mostly = {

#ifdef CONFIG_SYSCTL
static
int brnf_sysctl_call_tables(ctl_table * ctl, int write,
int brnf_sysctl_call_tables(struct ctl_table *ctl, int write,
void __user * buffer, size_t * lenp, loff_t * ppos)
{
int ret;
Expand All @@ -1004,7 +1004,7 @@ int brnf_sysctl_call_tables(ctl_table * ctl, int write,
return ret;
}

static ctl_table brnf_table[] = {
static struct ctl_table brnf_table[] = {
{
.procname = "bridge-nf-call-arptables",
.data = &brnf_call_arptables,
Expand Down
6 changes: 3 additions & 3 deletions net/core/neighbour.c
Original file line number Diff line number Diff line change
Expand Up @@ -2765,11 +2765,11 @@ EXPORT_SYMBOL(neigh_app_ns);
static int zero;
static int unres_qlen_max = INT_MAX / SKB_TRUESIZE(ETH_FRAME_LEN);

static int proc_unres_qlen(ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
static int proc_unres_qlen(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int size, ret;
ctl_table tmp = *ctl;
struct ctl_table tmp = *ctl;

tmp.extra1 = &zero;
tmp.extra2 = &unres_qlen_max;
Expand Down
8 changes: 4 additions & 4 deletions net/core/sysctl_net_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
static int one = 1;

#ifdef CONFIG_RPS
static int rps_sock_flow_sysctl(ctl_table *table, int write,
static int rps_sock_flow_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
unsigned int orig_size, size;
int ret, i;
ctl_table tmp = {
struct ctl_table tmp = {
.data = &size,
.maxlen = sizeof(size),
.mode = table->mode
Expand Down Expand Up @@ -91,7 +91,7 @@ static int rps_sock_flow_sysctl(ctl_table *table, int write,
#ifdef CONFIG_NET_FLOW_LIMIT
static DEFINE_MUTEX(flow_limit_update_mutex);

static int flow_limit_cpu_sysctl(ctl_table *table, int write,
static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
Expand Down Expand Up @@ -156,7 +156,7 @@ static int flow_limit_cpu_sysctl(ctl_table *table, int write,
return ret;
}

static int flow_limit_table_len_sysctl(ctl_table *table, int write,
static int flow_limit_table_len_sysctl(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
Expand Down
6 changes: 3 additions & 3 deletions net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ static int max_t3[] = { 8191 }; /* Must fit in 16 bits when multiplied by BCT3MU
static int min_priority[1];
static int max_priority[] = { 127 }; /* From DECnet spec */

static int dn_forwarding_proc(ctl_table *, int,
static int dn_forwarding_proc(struct ctl_table *, int,
void __user *, size_t *, loff_t *);
static struct dn_dev_sysctl_table {
struct ctl_table_header *sysctl_header;
ctl_table dn_dev_vars[5];
struct ctl_table dn_dev_vars[5];
} dn_dev_sysctl = {
NULL,
{
Expand Down Expand Up @@ -242,7 +242,7 @@ static void dn_dev_sysctl_unregister(struct dn_dev_parms *parms)
}
}

static int dn_forwarding_proc(ctl_table *table, int write,
static int dn_forwarding_proc(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down
6 changes: 3 additions & 3 deletions net/decnet/sysctl_net_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static int parse_addr(__le16 *addr, char *str)
return 0;
}

static int dn_node_address_handler(ctl_table *table, int write,
static int dn_node_address_handler(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down Expand Up @@ -183,7 +183,7 @@ static int dn_node_address_handler(ctl_table *table, int write,
return 0;
}

static int dn_def_dev_handler(ctl_table *table, int write,
static int dn_def_dev_handler(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down Expand Up @@ -246,7 +246,7 @@ static int dn_def_dev_handler(ctl_table *table, int write,
return 0;
}

static ctl_table dn_table[] = {
static struct ctl_table dn_table[] = {
{
.procname = "node_address",
.maxlen = 7,
Expand Down
6 changes: 3 additions & 3 deletions net/ipv4/devinet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,7 @@ static void inet_forward_change(struct net *net)
}
}

static int devinet_conf_proc(ctl_table *ctl, int write,
static int devinet_conf_proc(struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down Expand Up @@ -1985,7 +1985,7 @@ static int devinet_conf_proc(ctl_table *ctl, int write,
return ret;
}

static int devinet_sysctl_forward(ctl_table *ctl, int write,
static int devinet_sysctl_forward(struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down Expand Up @@ -2028,7 +2028,7 @@ static int devinet_sysctl_forward(ctl_table *ctl, int write,
return ret;
}

static int ipv4_doint_and_flush(ctl_table *ctl, int write,
static int ipv4_doint_and_flush(struct ctl_table *ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand Down
2 changes: 1 addition & 1 deletion net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static struct nf_hook_ops ipv4_conntrack_ops[] __read_mostly = {
static int log_invalid_proto_min = 0;
static int log_invalid_proto_max = 255;

static ctl_table ip_ct_sysctl_table[] = {
static struct ctl_table ip_ct_sysctl_table[] = {
{
.procname = "ip_conntrack_max",
.maxlen = sizeof(int),
Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2448,7 +2448,7 @@ static int ip_rt_gc_interval __read_mostly = 60 * HZ;
static int ip_rt_gc_min_interval __read_mostly = HZ / 2;
static int ip_rt_gc_elasticity __read_mostly = 8;

static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
static int ipv4_sysctl_rtcache_flush(struct ctl_table *__ctl, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
Expand All @@ -2463,7 +2463,7 @@ static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
return -EINVAL;
}

static ctl_table ipv4_route_table[] = {
static struct ctl_table ipv4_route_table[] = {
{
.procname = "gc_thresh",
.data = &ipv4_dst_ops.gc_thresh,
Expand Down
31 changes: 16 additions & 15 deletions net/ipv4/sysctl_net_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ static void set_local_port_range(int range[2])
}

/* Validate changes from /proc interface. */
static int ipv4_local_port_range(ctl_table *table, int write,
static int ipv4_local_port_range(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
int ret;
int range[2];
ctl_table tmp = {
struct ctl_table tmp = {
.data = &range,
.maxlen = sizeof(range),
.mode = table->mode,
Expand Down Expand Up @@ -100,15 +100,15 @@ static void set_ping_group_range(struct ctl_table *table, kgid_t low, kgid_t hig
}

/* Validate changes from /proc interface. */
static int ipv4_ping_group_range(ctl_table *table, int write,
static int ipv4_ping_group_range(struct ctl_table *table, int write,
void __user *buffer,
size_t *lenp, loff_t *ppos)
{
struct user_namespace *user_ns = current_user_ns();
int ret;
gid_t urange[2];
kgid_t low, high;
ctl_table tmp = {
struct ctl_table tmp = {
.data = &urange,
.maxlen = sizeof(urange),
.mode = table->mode,
Expand All @@ -135,11 +135,11 @@ static int ipv4_ping_group_range(ctl_table *table, int write,
return ret;
}

static int proc_tcp_congestion_control(ctl_table *ctl, int write,
static int proc_tcp_congestion_control(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
char val[TCP_CA_NAME_MAX];
ctl_table tbl = {
struct ctl_table tbl = {
.data = val,
.maxlen = TCP_CA_NAME_MAX,
};
Expand All @@ -153,12 +153,12 @@ static int proc_tcp_congestion_control(ctl_table *ctl, int write,
return ret;
}

static int proc_tcp_available_congestion_control(ctl_table *ctl,
static int proc_tcp_available_congestion_control(struct ctl_table *ctl,
int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX, };
int ret;

tbl.data = kmalloc(tbl.maxlen, GFP_USER);
Expand All @@ -170,12 +170,12 @@ static int proc_tcp_available_congestion_control(ctl_table *ctl,
return ret;
}

static int proc_allowed_congestion_control(ctl_table *ctl,
static int proc_allowed_congestion_control(struct ctl_table *ctl,
int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
struct ctl_table tbl = { .maxlen = TCP_CA_BUF_MAX };
int ret;

tbl.data = kmalloc(tbl.maxlen, GFP_USER);
Expand All @@ -190,7 +190,7 @@ static int proc_allowed_congestion_control(ctl_table *ctl,
return ret;
}

static int ipv4_tcp_mem(ctl_table *ctl, int write,
static int ipv4_tcp_mem(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
Expand All @@ -201,7 +201,7 @@ static int ipv4_tcp_mem(ctl_table *ctl, int write,
struct mem_cgroup *memcg;
#endif

ctl_table tmp = {
struct ctl_table tmp = {
.data = &vec,
.maxlen = sizeof(vec),
.mode = ctl->mode,
Expand Down Expand Up @@ -233,10 +233,11 @@ static int ipv4_tcp_mem(ctl_table *ctl, int write,
return 0;
}

static int proc_tcp_fastopen_key(ctl_table *ctl, int write, void __user *buffer,
size_t *lenp, loff_t *ppos)
static int proc_tcp_fastopen_key(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
{
ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) };
struct ctl_table tbl = { .maxlen = (TCP_FASTOPEN_KEY_LENGTH * 2 + 10) };
struct tcp_fastopen_context *ctxt;
int ret;
u32 user_key[4]; /* 16 bytes, matching TCP_FASTOPEN_KEY_LENGTH */
Expand Down
10 changes: 5 additions & 5 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4620,13 +4620,13 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
#ifdef CONFIG_SYSCTL

static
int addrconf_sysctl_forward(ctl_table *ctl, int write,
int addrconf_sysctl_forward(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
ctl_table lctl;
struct ctl_table lctl;
int ret;

/*
Expand Down Expand Up @@ -4705,13 +4705,13 @@ static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf)
}

static
int addrconf_sysctl_disable(ctl_table *ctl, int write,
int addrconf_sysctl_disable(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
int *valp = ctl->data;
int val = *valp;
loff_t pos = *ppos;
ctl_table lctl;
struct ctl_table lctl;
int ret;

/*
Expand All @@ -4733,7 +4733,7 @@ int addrconf_sysctl_disable(ctl_table *ctl, int write,
static struct addrconf_sysctl_table
{
struct ctl_table_header *sysctl_header;
ctl_table addrconf_vars[DEVCONF_MAX+1];
struct ctl_table addrconf_vars[DEVCONF_MAX+1];
} addrconf_sysctl __read_mostly = {
.sysctl_header = NULL,
.addrconf_vars = {
Expand Down
2 changes: 1 addition & 1 deletion net/ipv6/icmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ int icmpv6_err_convert(u8 type, u8 code, int *err)
EXPORT_SYMBOL(icmpv6_err_convert);

#ifdef CONFIG_SYSCTL
ctl_table ipv6_icmp_table_template[] = {
struct ctl_table ipv6_icmp_table_template[] = {
{
.procname = "ratelimit",
.data = &init_net.ipv6.sysctl.icmpv6_time,
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/route.c
Original file line number Diff line number Diff line change
Expand Up @@ -2790,7 +2790,7 @@ static const struct file_operations rt6_stats_seq_fops = {
#ifdef CONFIG_SYSCTL

static
int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
int ipv6_sysctl_rtcache_flush(struct ctl_table *ctl, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct net *net;
Expand All @@ -2805,7 +2805,7 @@ int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write,
return 0;
}

ctl_table ipv6_route_table_template[] = {
struct ctl_table ipv6_route_table_template[] = {
{
.procname = "flush",
.data = &init_net.ipv6.sysctl.flush_delay,
Expand Down
4 changes: 2 additions & 2 deletions net/ipv6/sysctl_net_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <net/addrconf.h>
#include <net/inet_frag.h>

static ctl_table ipv6_table_template[] = {
static struct ctl_table ipv6_table_template[] = {
{
.procname = "bindv6only",
.data = &init_net.ipv6.sysctl.bindv6only,
Expand All @@ -27,7 +27,7 @@ static ctl_table ipv6_table_template[] = {
{ }
};

static ctl_table ipv6_rotable[] = {
static struct ctl_table ipv6_rotable[] = {
{
.procname = "mld_max_msf",
.data = &sysctl_mld_max_msf,
Expand Down
Loading

0 comments on commit fe2c633

Please sign in to comment.