Skip to contentSkip to conversation

Add C99 initializers to a few ipv6/netfilter files

PATCH In review Art Haas 2 participants 2 messages Mar 7, 2003 – Mar 8, 2003

Subsystems (2)
lore
Share & tools
lore

Art Haas

author
#0 lore raw

PATCH 1/1 Add C99 initializers to a few ipv6/netfilter files

Hi.

Here is a set of two patches that add C99 initializers to files in the subject directory. A similar patch for ipv4 files will follow.

There are some giant structures in the netfilter code that would benefit from named initializers. I'll try to tackle them later.

Art Haas

===== net/ipv6/netfilter/ip6table_filter.c 1.4 vs edited =====

net/ipv6/netfilter/ip6table_filter.c +26 -8
@@ -81,9 +81,13 @@
     }
 };
 
-static struct ip6t_table packet_filter
-= { { NULL, NULL }, "filter", &initial_table.repl,
-    FILTER_VALID_HOOKS, RW_LOCK_UNLOCKED, NULL, THIS_MODULE };
+static struct ip6t_table packet_filter = {
+	.name		= "filter",
+	.table		= &initial_table.repl,
+	.valid_hooks	= FILTER_VALID_HOOKS,
+	.lock		= RW_LOCK_UNLOCKED,
+	.me		= THIS_MODULE,
+};
 
 /* The work comes in here from netfilter.c. */
 static unsigned int
@@ -116,11 +120,25 @@
 	return ip6t_do_table(pskb, hook, in, out, &packet_filter, NULL);
 }
 
-static struct nf_hook_ops ip6t_ops[]
-= { { { NULL, NULL }, ip6t_hook, PF_INET6, NF_IP6_LOCAL_IN, NF_IP6_PRI_FILTER },
-    { { NULL, NULL }, ip6t_hook, PF_INET6, NF_IP6_FORWARD, NF_IP6_PRI_FILTER },
-    { { NULL, NULL }, ip6t_local_out_hook, PF_INET6, NF_IP6_LOCAL_OUT,
-		NF_IP6_PRI_FILTER }
+static struct nf_hook_ops ip6t_ops[] = {
+	{
+		.hook		= ip6t_hook,
+		.pf		= PF_INET6,
+		.hooknum	= NF_IP6_LOCAL_IN,
+		.priority	= NF_IP6_PRI_FILTER,
+	},
+	{
+		.hook		= ip6t_hook,
+		.pf		= PF_INET6,
+		.hooknum	= NF_IP6_FORWARD,
+		.priority	= NF_IP6_PRI_FILTER,
+	},
+	{
+		.hook		= ip6t_local_out_hook,
+		.pf		= PF_INET6,
+		.hooknum	= NF_IP6_LOCAL_OUT,
+		.priority	= NF_IP6_PRI_FILTER,
+	},
 };
 
 /* Default to forward because I got too much mail already. */

===== net/ipv6/netfilter/ip6table_mangle.c 1.5 vs edited =====

net/ipv6/netfilter/ip6table_mangle.c +38 -9

59 lines not on this page · raw message

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
#1 lore raw
Quoted 8 lines · Art Haas

Hi.

Here is a set of two patches that add C99 initializers to files in the subject directory. A similar patch for ipv4 files will follow.

There are some giant structures in the netfilter code that would benefit from named initializers. I'll try to tackle them later.

Hi Art,

I've actually converted the ipv4/netfilter and ipv6/netfilter directories over to c99 style initialisers, including the giant structs that you were talking about. I've sent the patches off to Harald a week or so ago, so he should be able to roll them in at some point when his workload gets a little lower.

The patches are pretty large, but if you want a copy, drop me a line.

Cheers

Mark

Quoted 1 line