Skip to contentSkip to conversation

C99 initializers

PATCH In review Stephane Ouellette 2 participants 2 messages Jul 2, 2004 1 message not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 C99 initializers

Dave,

the attached patches add C99 initializers to the following files in
the net/ipv4 directory:

arp.c
udp.c
protocol.c
tcp_ipv4.c

Regards,

Stephane Ouellette

net/ipv4/arp.c +54 -54
@@ -129,70 +129,70 @@
 static void parp_redo(struct sk_buff *skb);
 
 static struct neigh_ops arp_generic_ops = {
-	family:			AF_INET,
-	solicit:		arp_solicit,
-	error_report:		arp_error_report,
-	output:			neigh_resolve_output,
-	connected_output:	neigh_connected_output,
-	hh_output:		dev_queue_xmit,
-	queue_xmit:		dev_queue_xmit,
+	.family =		AF_INET,
+	.solicit =		arp_solicit,
+	.error_report =		arp_error_report,
+	.output =		neigh_resolve_output,
+	.connected_output =	neigh_connected_output,
+	.hh_output =		dev_queue_xmit,
+	.queue_xmit =		dev_queue_xmit,
 };
 
 static struct neigh_ops arp_hh_ops = {
-	family:			AF_INET,
-	solicit:		arp_solicit,
-	error_report:		arp_error_report,
-	output:			neigh_resolve_output,
-	connected_output:	neigh_resolve_output,
-	hh_output:		dev_queue_xmit,
-	queue_xmit:		dev_queue_xmit,
+	.family =		AF_INET,
+	.solicit =		arp_solicit,
+	.error_report =		arp_error_report,
+	.output =		neigh_resolve_output,
+	.connected_output =	neigh_resolve_output,
+	.hh_output =		dev_queue_xmit,
+	.queue_xmit =		dev_queue_xmit,
 };
 
 static struct neigh_ops arp_direct_ops = {
-	family:			AF_INET,
-	output:			dev_queue_xmit,
-	connected_output:	dev_queue_xmit,
-	hh_output:		dev_queue_xmit,
-	queue_xmit:		dev_queue_xmit,
+	.family =		AF_INET,
+	.output =		dev_queue_xmit,
+	.connected_output =	dev_queue_xmit,
+	.hh_output =		dev_queue_xmit,
+	.queue_xmit =		dev_queue_xmit,
 };
 
 struct neigh_ops arp_broken_ops = {
-	family:			AF_INET,
-	solicit:		arp_solicit,
-	error_report:		arp_error_report,
-	output:			neigh_compat_output,
-	connected_output:	neigh_compat_output,
-	hh_output:		dev_queue_xmit,
-	queue_xmit:		dev_queue_xmit,
+	.family =		AF_INET,
+	.solicit =		arp_solicit,
+	.error_report =		arp_error_report,
+	.output =		neigh_compat_output,
+	.connected_output =	neigh_compat_output,
+	.hh_output =		dev_queue_xmit,
+	.queue_xmit =		dev_queue_xmit,
 };
 
 struct neigh_table arp_tbl = {
-	family:		AF_INET,
-	entry_size:	sizeof(struct neighbour) + 4,
-	key_len:	4,
-	hash:		arp_hash,
-	constructor:	arp_constructor,
-	proxy_redo:	parp_redo,
-	id:		"arp_cache",
-	parms: {
-		tbl:			&arp_tbl,
-		base_reachable_time:	30 * HZ,
-		retrans_time:		1 * HZ,
-		gc_staletime:		60 * HZ,
-		reachable_time:		30 * HZ,
-		delay_probe_time:	5 * HZ,
-		queue_len:		3,
-		ucast_probes:		3,
-		mcast_probes:		3,
-		anycast_delay:		1 * HZ,
-		proxy_delay:		(8 * HZ) / 10,
-		proxy_qlen:		64,
-		locktime:		1 * HZ,
+	.family =	AF_INET,
+	.entry_size =	sizeof(struct neighbour) + 4,
+	.key_len =	4,
+	.hash =		arp_hash,
+	.constructor =	arp_constructor,
+	.proxy_redo =	parp_redo,
+	.id =		"arp_cache",
+	.parms = {
+		.tbl =			&arp_tbl,
+		.base_reachable_time =	30 * HZ,
+		.retrans_time =		1 * HZ,
+		.gc_staletime =		60 * HZ,
+		.reachable_time =	30 * HZ,
+		.delay_probe_time =	5 * HZ,
+		.queue_len =		3,
+		.ucast_probes =		3,
+		.mcast_probes =		3,
+		.anycast_delay =	1 * HZ,
+		.proxy_delay =		(8 * HZ) / 10,
+		.proxy_qlen =		64,
+		.locktime =		1 * HZ,
 	},
-	gc_interval:	30 * HZ,
-	gc_thresh1:	128,
-	gc_thresh2:	512,
-	gc_thresh3:	1024,
+	.gc_interval =	30 * HZ,
+	.gc_thresh1 =	128,
+	.gc_thresh2 =	512,
+	.gc_thresh3 =	1024,
 };
 
 int arp_mc_map(u32 addr, u8 *haddr, struct net_device *dev, int dir)
@@ -1344,9 +1344,9 @@
  */
 
 static struct packet_type arp_packet_type = {
-	type:	__constant_htons(ETH_P_ARP),
-	func:	arp_rcv,
-	data:	(void*) 1, /* understand shared skbs */
+	.type =	__constant_htons(ETH_P_ARP),
+	.func =	arp_rcv,
+	.data =	(void*) 1, /* understand shared skbs */
 };
 
 void __init arp_init (void)
net/ipv4/protocol.c +19 -19
@@ -53,10 +53,10 @@
 #ifdef CONFIG_IP_MULTICAST
 
 static struct inet_protocol igmp_protocol = {
-	handler:	igmp_rcv,
-	next:		IPPROTO_PREVIOUS,
-	protocol:	IPPROTO_IGMP,
-	name:		"IGMP"
+	.handler  =	igmp_rcv,
+	.next     =	IPPROTO_PREVIOUS,
+	.protocol =	IPPROTO_IGMP,
+	.name	  =	"IGMP"
 };
 
 #undef  IPPROTO_PREVIOUS
@@ -65,32 +65,32 @@
 #endif
 
 static struct inet_protocol tcp_protocol = {
-	handler:	tcp_v4_rcv,
-	err_handler:	tcp_v4_err,
-	next:		IPPROTO_PREVIOUS,
-	protocol:	IPPROTO_TCP,
-	name:		"TCP"
+	.handler     =	tcp_v4_rcv,
+	.err_handler =	tcp_v4_err,
+	.next	     =	IPPROTO_PREVIOUS,
+	.protocol    =	IPPROTO_TCP,
+	.name	     =	"TCP"
 };
 
 #undef  IPPROTO_PREVIOUS
 #define IPPROTO_PREVIOUS &tcp_protocol
 
 static struct inet_protocol udp_protocol = {
-	handler:	udp_rcv,
-	err_handler:	udp_err,
-	next:		IPPROTO_PREVIOUS,
-	protocol:	IPPROTO_UDP,
-	name:		"UDP"
+	.handler     =	udp_rcv,
+	.err_handler =	udp_err,
+	.next	     =	IPPROTO_PREVIOUS,
+	.protocol    =	IPPROTO_UDP,
+	.name	     =	"UDP"
 };
 
 #undef  IPPROTO_PREVIOUS
 #define IPPROTO_PREVIOUS &udp_protocol
 
 static struct inet_protocol icmp_protocol = {
-	handler:	icmp_rcv,
-	next:		IPPROTO_PREVIOUS,
-	protocol:	IPPROTO_ICMP,
-	name:		"ICMP"
+	.handler  =	icmp_rcv,
+	.next	  =	IPPROTO_PREVIOUS,
+	.protocol =	IPPROTO_ICMP,
+	.name	  =	"ICMP"
 };
 
 #undef  IPPROTO_PREVIOUS
@@ -112,7 +112,7 @@
 
 	hash = prot->protocol & (MAX_INET_PROTOS - 1);
 	br_write_lock_bh(BR_NETPROTO_LOCK);
-	prot ->next = inet_protos[hash];
+	prot->next = inet_protos[hash];
 	inet_protos[hash] = prot;
 	prot->copy = 0;
 
net/ipv4/tcp_ipv4.c +26 -26

65 lines not on this page · raw message

net/ipv4/udp.c +14 -14
@@ -874,7 +874,7 @@
 
 /* Initialize UDP checksum. If exited with zero value (success),
  * CHECKSUM_UNNECESSARY means, that no more checks are required.
- * Otherwise, csum completion requires chacksumming packet body,
+ * Otherwise, csum completion requires checksumming packet body,
  * including udp header and folding it to skb->csum.
  */
 static int udp_checksum_init(struct sk_buff *skb, struct udphdr *uh,
@@ -1048,17 +1048,17 @@
 }
 
 struct proto udp_prot = {
- 	name:		"UDP",
-	close:		udp_close,
-	connect:	udp_connect,
-	disconnect:	udp_disconnect,
-	ioctl:		udp_ioctl,
-	setsockopt:	ip_setsockopt,
-	getsockopt:	ip_getsockopt,
-	sendmsg:	udp_sendmsg,
-	recvmsg:	udp_recvmsg,
-	backlog_rcv:	udp_queue_rcv_skb,
-	hash:		udp_v4_hash,
-	unhash:		udp_v4_unhash,
-	get_port:	udp_v4_get_port,
+	.name	     =	"UDP",
+	.close	     =	udp_close,
+	.connect     =	udp_connect,
+	.disconnect  =	udp_disconnect,
+	.ioctl       =	udp_ioctl,
+	.setsockopt  =	ip_setsockopt,
+	.getsockopt  =	ip_getsockopt,
+	.sendmsg     =	udp_sendmsg,
+	.recvmsg     =	udp_recvmsg,
+	.backlog_rcv =	udp_queue_rcv_skb,
+	.hash	     =	udp_v4_hash,
+	.unhash	     =	udp_v4_unhash,
+	.get_port    =	udp_v4_get_port,
 };

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 5 lines · On Fri, 02 Jul 2004 13:25:27 +0900 (JST) YOSHIFUJI Hideaki / $B5HF#1QL@(B…

In article <[email protected]> (at Fri, 02 Jul 2004 00:17:13 -0400), Stephane Ouellette <[email protected]> says:

Quoted 3 lines

the attached patches add C99 initializers to the following files in
the net/ipv4 directory:

Quoted 7 lines
Quoted 4 lines
    arp.c
    udp.c
    protocol.c
    tcp_ipv4.c

I think there is consensus not to migrate 2.4.x to C99 initializers. Am I wrong?

That's true.