Add C99 initializers to net/ipv4/netfilter
Subsystems (2)
PATCH 1/1 Add C99 initializers to net/ipv4/netfilter
Hi.
Here is a set of patches converting more structures to use C99 initializers. The patches are against the current BK. A set of similar patches for the ipv6 code will follow. These patches also include an occasional removal of a '.maxlen = 0,' line in the initializers.
Art Haas
===== net/ipv4/netfilter/arp_tables.c 1.3 vs edited =====
net/ipv4/netfilter/arp_tables.c +17 -7
@@ -1205,14 +1205,24 @@ }/* The built-in targets: standard (NULL) and error. */ -static struct arpt_target arpt_standard_target -= { {NULL ,NULL },ARPT_STANDARD_TARGET ,NULL ,NULL ,NULL }; -static struct arpt_target arpt_error_target -= { {NULL ,NULL },ARPT_ERROR_TARGET , arpt_error,NULL ,NULL }; +static struct arpt_target arpt_standard_target = { + .name =ARPT_STANDARD_TARGET , +}; -static struct nf_sockopt_ops arpt_sockopts -= { {NULL ,NULL },PF_INET ,ARPT_BASE_CTL ,ARPT_SO_SET_MAX +1 , do_arpt_set_ctl, -ARPT_BASE_CTL ,ARPT_SO_GET_MAX +1 , do_arpt_get_ctl,0 ,NULL }; +static struct arpt_target arpt_error_target = { + .name =ARPT_ERROR_TARGET , + .target = arpt_error, +}; + +static struct nf_sockopt_ops arpt_sockopts = { + .pf =PF_INET , + .set_optmin =ARPT_BASE_CTL , + .set_optmax =ARPT_SO_SET_MAX +1 , + .set = do_arpt_set_ctl, + .get_optmin =ARPT_BASE_CTL , + .get_optmax =ARPT_SO_GET_MAX +1 , + .get = do_arpt_get_ctl, +};#ifdef CONFIG_PROC_FS static inline int print_name(const struct arpt_table *t,
===== net/ipv4/netfilter/ip_conntrack_core.c 1.20 vs edited =====
net/ipv4/netfilter/ip_conntrack_core.c +6 -7
@@ -1339,11 +1339,12 @@return -ENOENT ; } -static struct nf_sockopt_ops so_getorigdst -= { {NULL ,NULL },PF_INET , -0 ,0 ,NULL ,/* Setsockopts */ -SO_ORIGINAL_DST ,SO_ORIGINAL_DST +1 , &getorigdst, -0 ,NULL }; +static struct nf_sockopt_ops so_getorigdst = { + .pf =PF_INET , + .get_optmin =SO_ORIGINAL_DST , + .get_optmax =SO_ORIGINAL_DST +1 , + .get = &getorigdst, +};#define NET_IP_CONNTRACK_MAX 2089#define NET_IP_CONNTRACK_MAX_NAME "ip_conntrack_max"
@@ -1367,7 +1368,6 @@ { .ctl_name = NET_IPV4, .procname = "ipv4", - .maxlen = 0, .mode = 0555, .child = ip_conntrack_table },
@@ -1378,7 +1378,6 @@ { .ctl_name = CTL_NET, .procname = "net", - .maxlen = 0, .mode = 0555, .child = ip_conntrack_dir_table },
===== net/ipv4/netfilter/ip_queue.c 1.10 vs edited =====
net/ipv4/netfilter/ip_queue.c +2 -8
@@ -555,9 +555,7 @@ }static struct notifier_block ipq_dev_notifier = { - ipq_rcv_dev_event, -NULL , -0 + .notifier_call = ipq_rcv_dev_event, }; static int
@@ -577,9 +575,7 @@ }static struct notifier_block ipq_nl_notifier = { - ipq_rcv_nl_event, -NULL , -0 + .notifier_call = ipq_rcv_nl_event, };static int sysctl_maxlen =IPQ_QMAX_DEFAULT ;
@@ -601,7 +597,6 @@ { .ctl_name = NET_IPV4, .procname = "ipv4", - .maxlen = 0, .mode = 0555, .child = ipq_table },
@@ -612,7 +607,6 @@ { .ctl_name = CTL_NET, .procname = "net", - .maxlen = 0, .mode = 0555, .child = ipq_dir_table },
===== net/ipv4/netfilter/ip_tables.c 1.11 vs edited =====
net/ipv4/netfilter/ip_tables.c +34 -13
55 lines not on this page · raw message
===== net/ipv4/netfilter/ipfwadm_core.c 1.11 vs edited =====
net/ipv4/netfilter/ipfwadm_core.c +1 -3
@@ -1315,9 +1315,7 @@ }static struct notifier_block ipfw_dev_notifier={ - ipfw_device_event, -NULL , -0 + .notifier_call = ipfw_device_event, };#endif
===== net/ipv4/netfilter/ipt_DSCP.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_DSCP.c +6 -2
@@ -88,8 +88,12 @@return 1 ; } -static struct ipt_target ipt_dscp_reg -= { {NULL ,NULL },"DSCP" , target, checkentry,NULL ,THIS_MODULE }; +static struct ipt_target ipt_dscp_reg = { + .name ="DSCP" , + .target = target, + .checkentry = checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_ECN.c 1.3 vs edited =====
net/ipv4/netfilter/ipt_ECN.c +6 -2
@@ -164,8 +164,12 @@return 1 ; } -static struct ipt_target ipt_ecn_reg -= { {NULL ,NULL },"ECN" , target, checkentry,NULL ,THIS_MODULE }; +static struct ipt_target ipt_ecn_reg = { + .name ="ECN" , + .target = target, + .checkentry = checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_LOG.c 1.5 vs edited =====
net/ipv4/netfilter/ipt_LOG.c +6 -3
@@ -350,9 +350,12 @@return 1 ; } -static struct ipt_target ipt_log_reg -= { {NULL ,NULL },"LOG" , ipt_log_target, ipt_log_checkentry,NULL , -THIS_MODULE }; +static struct ipt_target ipt_log_reg = { + .name ="LOG" , + .target = ipt_log_target, + .checkentry = ipt_log_checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_MARK.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_MARK.c +6 -2
@@ -46,8 +46,12 @@return 1 ; } -static struct ipt_target ipt_mark_reg -= { {NULL ,NULL },"MARK" , target, checkentry,NULL ,THIS_MODULE }; +static struct ipt_target ipt_mark_reg = { + .name ="MARK" , + .target = target, + .checkentry = checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_MASQUERADE.c 1.6 vs edited =====
net/ipv4/netfilter/ipt_MASQUERADE.c +8 -9
@@ -167,20 +167,19 @@ }static struct notifier_block masq_dev_notifier = { - masq_device_event, -NULL , -0 + .notifier_call = masq_device_event, };static struct notifier_block masq_inet_notifier = { - masq_inet_event, -NULL , -0 + .notifier_call = masq_inet_event, }; -static struct ipt_target masquerade -= { {NULL ,NULL },"MASQUERADE" , masquerade_target, masquerade_check,NULL , -THIS_MODULE }; +static struct ipt_target masquerade = { + .name ="MASQUERADE" , + .target = masquerade_target, + .checkentry = masquerade_check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_MIRROR.c 1.4 vs edited =====
net/ipv4/netfilter/ipt_MIRROR.c +6 -3
@@ -157,9 +157,12 @@return 1 ; } -static struct ipt_target ipt_mirror_reg -= { {NULL ,NULL },"MIRROR" , ipt_mirror_target, ipt_mirror_checkentry,NULL , -THIS_MODULE }; +static struct ipt_target ipt_mirror_reg = { + .name ="MIRROR" , + .target = ipt_mirror_target, + .checkentry = ipt_mirror_checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_REDIRECT.c 1.3 vs edited =====
net/ipv4/netfilter/ipt_REDIRECT.c +6 -3
@@ -96,9 +96,12 @@return ip_nat_setup_info (ct, &newrange, hooknum); } -static struct ipt_target redirect_reg -= { {NULL ,NULL },"REDIRECT" , redirect_target, redirect_check,NULL , -THIS_MODULE }; +static struct ipt_target redirect_reg = { + .name ="REDIRECT" , + .target = redirect_target, + .checkentry = redirect_check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_REJECT.c 1.11 vs edited =====
net/ipv4/netfilter/ipt_REJECT.c +6 -2
@@ -386,8 +386,12 @@return 1 ; } -static struct ipt_target ipt_reject_reg -= { {NULL ,NULL },"REJECT" , reject, check,NULL ,THIS_MODULE }; +static struct ipt_target ipt_reject_reg = { + .name ="REJECT" , + .target = reject, + .checkentry = check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_TCPMSS.c 1.7 vs edited =====
net/ipv4/netfilter/ipt_TCPMSS.c +6 -3
@@ -238,9 +238,12 @@return 0 ; } -static struct ipt_target ipt_tcpmss_reg -= { {NULL ,NULL },"TCPMSS" , - ipt_tcpmss_target, ipt_tcpmss_checkentry,NULL ,THIS_MODULE }; +static struct ipt_target ipt_tcpmss_reg = { + .name ="TCPMSS" , + .target = ipt_tcpmss_target, + .checkentry = ipt_tcpmss_checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_TOS.c 1.6 vs edited =====
net/ipv4/netfilter/ipt_TOS.c +6 -2
@@ -76,8 +76,12 @@return 1 ; } -static struct ipt_target ipt_tos_reg -= { {NULL ,NULL },"TOS" , target, checkentry,NULL ,THIS_MODULE }; +static struct ipt_target ipt_tos_reg = { + .name ="TOS" , + .target = target, + .checkentry = checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_ULOG.c 1.6 vs edited =====
net/ipv4/netfilter/ipt_ULOG.c +5 -3
@@ -304,9 +304,11 @@return 1 ; } -static struct ipt_target ipt_ulog_reg = - { {NULL ,NULL },"ULOG" , ipt_ulog_target, ipt_ulog_checkentry,NULL , -THIS_MODULE +static struct ipt_target ipt_ulog_reg = { + .name ="ULOG" , + .target = ipt_ulog_target, + .checkentry = ipt_ulog_checkentry, + .me =THIS_MODULE , };static int __init init (void )
===== net/ipv4/netfilter/ipt_ah.c 1.4 vs edited =====
net/ipv4/netfilter/ipt_ah.c +6 -2
@@ -87,8 +87,12 @@return 1 ; } -static struct ipt_match ah_match -= { {NULL ,NULL },"ah" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match ah_match = { + .name ="ah" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_conntrack.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_conntrack.c +6 -2
@@ -100,8 +100,12 @@return 1 ; } -static struct ipt_match conntrack_match -= { {NULL ,NULL },"conntrack" , &match, &check,NULL ,THIS_MODULE }; +static struct ipt_match conntrack_match = { + .name ="conntrack" , + .match = &match, + .checkentry = &check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_dscp.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_dscp.c +6 -2
@@ -40,8 +40,12 @@return 1 ; } -static struct ipt_match dscp_match = { {NULL ,NULL },"dscp" , &match, - &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match dscp_match = { + .name ="dscp" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_ecn.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_ecn.c +6 -2
@@ -101,8 +101,12 @@return 1 ; } -static struct ipt_match ecn_match = { {NULL ,NULL },"ecn" , &match, - &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match ecn_match = { + .name ="ecn" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_esp.c 1.4 vs edited =====
net/ipv4/netfilter/ipt_esp.c +6 -2
@@ -87,8 +87,12 @@return 1 ; } -static struct ipt_match esp_match -= { {NULL ,NULL },"esp" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match esp_match = { + .name ="esp" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_helper.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_helper.c +6 -2
@@ -89,8 +89,12 @@return 1 ; } -static struct ipt_match helper_match -= { {NULL ,NULL },"helper" , &match, &check,NULL ,THIS_MODULE }; +static struct ipt_match helper_match = { + .name ="helper" , + .match = &match, + .checkentry = &check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_length.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_length.c +6 -2
@@ -38,8 +38,12 @@return 1 ; } -static struct ipt_match length_match -= { {NULL ,NULL },"length" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match length_match = { + .name ="length" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_limit.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_limit.c +6 -3
@@ -115,9 +115,12 @@return 1 ; } -static struct ipt_match ipt_limit_reg -= { {NULL ,NULL },"limit" , ipt_limit_match, ipt_limit_checkentry,NULL , -THIS_MODULE }; +static struct ipt_match ipt_limit_reg = { + .name ="limit" , + .match = ipt_limit_match, + .checkentry = ipt_limit_checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_mac.c 1.3 vs edited =====
net/ipv4/netfilter/ipt_mac.c +6 -2
@@ -47,8 +47,12 @@return 1 ; } -static struct ipt_match mac_match -= { {NULL ,NULL },"mac" , &match, &ipt_mac_checkentry,NULL ,THIS_MODULE }; +static struct ipt_match mac_match = { + .name ="mac" , + .match = &match, + .checkentry = &ipt_mac_checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_mark.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_mark.c +6 -2
@@ -33,8 +33,12 @@return 1 ; } -static struct ipt_match mark_match -= { {NULL ,NULL },"mark" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match mark_match = { + .name ="mark" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_multiport.c 1.3 vs edited =====
net/ipv4/netfilter/ipt_multiport.c +6 -2
@@ -86,8 +86,12 @@ && multiinfo->count <=IPT_MULTI_PORTS ; } -static struct ipt_match multiport_match -= { {NULL ,NULL },"multiport" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match multiport_match = { + .name ="multiport" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_owner.c 1.4 vs edited =====
net/ipv4/netfilter/ipt_owner.c +6 -2
@@ -176,8 +176,12 @@return 1 ; } -static struct ipt_match owner_match -= { {NULL ,NULL },"owner" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match owner_match = { + .name ="owner" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_physdev.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_physdev.c +6 -2
@@ -63,8 +63,12 @@return 1 ; } -static struct ipt_match physdev_match -= { {NULL ,NULL },"physdev" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match physdev_match = { + .name ="physdev" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_pkttype.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_pkttype.c +6 -2
@@ -42,8 +42,12 @@return 1 ; } -static struct ipt_match pkttype_match -= { {NULL ,NULL },"pkttype" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match pkttype_match = { + .name ="pkttype" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_state.c 1.3 vs edited =====
net/ipv4/netfilter/ipt_state.c +6 -2
@@ -41,8 +41,12 @@return 1 ; } -static struct ipt_match state_match -= { {NULL ,NULL },"state" , &match, &check,NULL ,THIS_MODULE }; +static struct ipt_match state_match = { + .name ="state" , + .match = &match, + .checkentry = &check, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_tcpmss.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_tcpmss.c +6 -2
@@ -91,8 +91,12 @@return 1 ; } -static struct ipt_match tcpmss_match -= { {NULL ,NULL },"tcpmss" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match tcpmss_match = { + .name ="tcpmss" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_tos.c 1.2 vs edited =====
net/ipv4/netfilter/ipt_tos.c +6 -2
@@ -34,8 +34,12 @@return 1 ; } -static struct ipt_match tos_match -= { {NULL ,NULL },"tos" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match tos_match = { + .name ="tos" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_ttl.c 1.1 vs edited =====
net/ipv4/netfilter/ipt_ttl.c +6 -2
@@ -57,8 +57,12 @@return 1 ; } -static struct ipt_match ttl_match = { {NULL ,NULL },"ttl" , &match, - &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match ttl_match = { + .name ="ttl" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
===== net/ipv4/netfilter/ipt_unclean.c 1.8 vs edited =====
net/ipv4/netfilter/ipt_unclean.c +6 -2
@@ -580,8 +580,12 @@return 1 ; } -static struct ipt_match unclean_match -= { {NULL ,NULL },"unclean" , &match, &checkentry,NULL ,THIS_MODULE }; +static struct ipt_match unclean_match = { + .name ="unclean" , + .match = &match, + .checkentry = &checkentry, + .me =THIS_MODULE , +};static int __init init (void ) {
Signature · 3 lines
They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin, Historical Review of Pennsylvania, 1759
David S. Miller
Applied From: Art Haas <[email protected]>
Date: Sun, 16 Mar 2003 14:28:20 -0600
Here is a set of patches converting more structures to use C99 initializers. The patches are against the current BK. A set of similar patches for the ipv6 code will follow. These patches also include an occasional removal of a '.maxlen = 0,' line in the initializers.
Applied, thanks Art.