b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
       [not found] ` <1270341625-28764-1-git-send-email-luisbg@ubuntu.com>
@ 2010-04-04  1:12   ` Sven Eckelmann
  2010-04-04  1:24     ` [B.A.T.M.A.N.] [PATCHv2-maint] " Sven Eckelmann
                       ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04  1:12 UTC (permalink / raw)
  To: Luis de Bethencourt, devel; +Cc: gregkh, linux-kernel, b.a.t.m.a.n

[-- Attachment #1: Type: Text/Plain, Size: 415 bytes --]

Luis de Bethencourt wrote:
> This patch fixes the 32 unnecessary whitespaces before a quoted
> newline that the batman-adv files had.

Thanks.

Your patch conflicts with patches waiting to be applied by Greg KH. I will 
redo your changes for the current and development version and submit them to 
the b.a.t.m.a.n. mailing list for further discussion. Is that ok for you?

Best regards,
	Sven Eckelmann

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2-maint] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:12   ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Sven Eckelmann
@ 2010-04-04  1:24     ` Sven Eckelmann
  2010-04-04 17:09       ` Marek Lindner
  2010-04-04  1:44     ` [B.A.T.M.A.N.] [PATCHv2-trunk] " Sven Eckelmann
  2010-04-04  1:45     ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Luis de Bethencourt
  2 siblings, 1 reply; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04  1:24 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

From: Luis de Bethencourt <luisbg@ubuntu.com>

This patch fixes the 31 unnecessary whitespaces before a quoted
newline that the batman-adv files had.

Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
[sven.eckelmann@gmx.de: Redone to apply against current version]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 device.c            |    2 +-
 main.c              |    2 +-
 originator.c        |    4 ++--
 proc.c              |   18 +++++++++---------
 routing.c           |   18 +++++++++---------
 send.c              |    4 ++--
 translation-table.c |   14 +++++++-------
 7 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/device.c b/device.c
index 67245ff..73d2e17 100644
--- a/device.c
+++ b/device.c
@@ -66,7 +66,7 @@ int bat_device_setup(void)
 	batman_class = class_create(THIS_MODULE, "batman-adv");
 
 	if (IS_ERR(batman_class)) {
-		printk(KERN_ERR "batman-adv:Could not register class 'batman-adv' \n");
+		printk(KERN_ERR "batman-adv:Could not register class 'batman-adv'\n");
 		return 0;
 	}
 
diff --git a/main.c b/main.c
index 2c2f243..41f7dd2 100644
--- a/main.c
+++ b/main.c
@@ -120,7 +120,7 @@ int init_module(void)
 	register_netdevice_notifier(&hard_if_notifier);
 	dev_add_pack(&batman_adv_packet_type);
 
-	printk(KERN_INFO "batman-adv:B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded \n",
+	printk(KERN_INFO "batman-adv:B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded\n",
 		  SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION);
 
 	return 0;
diff --git a/originator.c b/originator.c
index 1f368ac..a5f9679 100644
--- a/originator.c
+++ b/originator.c
@@ -128,7 +128,7 @@ struct orig_node *get_orig_node(uint8_t *addr)
 	if (orig_node != NULL)
 		return orig_node;
 
-	bat_dbg(DBG_BATMAN, "Creating new originator: %pM \n", addr);
+	bat_dbg(DBG_BATMAN, "Creating new originator: %pM\n", addr);
 
 	orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC);
 	if (!orig_node)
@@ -160,7 +160,7 @@ struct orig_node *get_orig_node(uint8_t *addr)
 
 		if (swaphash == NULL)
 			printk(KERN_ERR
-			       "batman-adv:Couldn't resize orig hash table \n");
+			       "batman-adv:Couldn't resize orig hash table\n");
 		else
 			orig_hash = swaphash;
 	}
diff --git a/proc.c b/proc.c
index 4ec3050..f0a2900 100644
--- a/proc.c
+++ b/proc.c
@@ -42,7 +42,7 @@ static int proc_interfaces_read(struct seq_file *seq, void *offset)
 
 	rcu_read_lock();
 	list_for_each_entry_rcu(batman_if, &if_list, list) {
-		seq_printf(seq, "[%8s] %s %s \n",
+		seq_printf(seq, "[%8s] %s %s\n",
 			   (batman_if->if_active == IF_ACTIVE ?
 			    "active" : "inactive"),
 			   batman_if->dev,
@@ -189,18 +189,18 @@ static int proc_originators_read(struct seq_file *seq, void *offset)
 	rcu_read_lock();
 	if (list_empty(&if_list)) {
 		rcu_read_unlock();
-		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
+		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it\n");
 		goto end;
 	}
 
 	if (((struct batman_if *)if_list.next)->if_active != IF_ACTIVE) {
 		rcu_read_unlock();
-		seq_printf(seq, "BATMAN disabled - primary interface not active \n");
+		seq_printf(seq, "BATMAN disabled - primary interface not active\n");
 		goto end;
 	}
 
 	seq_printf(seq,
-		   "  %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s] \n",
+		   "  %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s]\n",
 		   "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF",
 		   "Potential nexthops", SOURCE_VERSION, REVISION_VERSION_STR,
 		   ((struct batman_if *)if_list.next)->dev,
@@ -241,7 +241,7 @@ static int proc_originators_read(struct seq_file *seq, void *offset)
 	spin_unlock_irqrestore(&orig_hash_lock, flags);
 
 	if (batman_count == 0)
-		seq_printf(seq, "No batman nodes in range ... \n");
+		seq_printf(seq, "No batman nodes in range ...\n");
 
 end:
 	return 0;
@@ -263,7 +263,7 @@ static int proc_transt_local_read(struct seq_file *seq, void *offset)
 	rcu_read_lock();
 	if (list_empty(&if_list)) {
 		rcu_read_unlock();
-		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
+		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it\n");
 		goto end;
 	}
 
@@ -295,7 +295,7 @@ static int proc_transt_global_read(struct seq_file *seq, void *offset)
 	rcu_read_lock();
 	if (list_empty(&if_list)) {
 		rcu_read_unlock();
-		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it \n");
+		seq_printf(seq, "BATMAN disabled - please specify interfaces to enable it\n");
 		goto end;
 	}
 	rcu_read_unlock();
@@ -351,9 +351,9 @@ static int proc_vis_srv_read(struct seq_file *seq, void *offset)
 {
 	int vis_server = atomic_read(&vis_mode);
 
-	seq_printf(seq, "[%c] client mode (server disabled) \n",
+	seq_printf(seq, "[%c] client mode (server disabled)\n",
 			(vis_server == VIS_TYPE_CLIENT_UPDATE) ? 'x' : ' ');
-	seq_printf(seq, "[%c] server mode (server enabled) \n",
+	seq_printf(seq, "[%c] server mode (server enabled)\n",
 			(vis_server == VIS_TYPE_SERVER_SYNC) ? 'x' : ' ');
 
 	return 0;
diff --git a/routing.c b/routing.c
index b64bad4..cccb10a 100644
--- a/routing.c
+++ b/routing.c
@@ -213,7 +213,7 @@ static int isBidirectionalNeigh(struct orig_node *orig_node,
 			      orig_neigh_node->tq_asym_penalty) /
 			     (TQ_MAX_VALUE *	 TQ_MAX_VALUE));
 
-	bat_dbg(DBG_BATMAN, "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i \n",
+	bat_dbg(DBG_BATMAN, "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n",
 		orig_node->orig, orig_neigh_node->orig, total_count,
 		neigh_node->real_packet_count, orig_neigh_node->tq_own,
 		orig_neigh_node->tq_asym_penalty, batman_packet->tq);
@@ -235,7 +235,7 @@ static void update_orig(struct orig_node *orig_node, struct ethhdr *ethhdr,
 	struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
 	int tmp_hna_buff_len;
 
-	bat_dbg(DBG_BATMAN, "update_originator(): Searching and updating originator entry of received packet \n");
+	bat_dbg(DBG_BATMAN, "update_originator(): Searching and updating originator entry of received packet\n");
 
 	list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) {
 		if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) &&
@@ -342,7 +342,7 @@ static char count_real_packets(struct ethhdr *ethhdr,
 	}
 
 	if (!is_duplicate) {
-		bat_dbg(DBG_BATMAN, "updating last_seqno: old %d, new %d \n",
+		bat_dbg(DBG_BATMAN, "updating last_seqno: old %d, new %d\n",
 			orig_node->last_real_seqno, batman_packet->seqno);
 		orig_node->last_real_seqno = batman_packet->seqno;
 	}
@@ -386,7 +386,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	is_single_hop_neigh = (compare_orig(ethhdr->h_source,
 					    batman_packet->orig) ? 1 : 0);
 
-	bat_dbg(DBG_BATMAN, "Received BATMAN packet via NB: %pM, IF: %s [%s] (from OG: %pM, via prev OG: %pM, seqno %d, tq %d, TTL %d, V %d, IDF %d) \n",
+	bat_dbg(DBG_BATMAN, "Received BATMAN packet via NB: %pM, IF: %s [%s] (from OG: %pM, via prev OG: %pM, seqno %d, tq %d, TTL %d, V %d, IDF %d)\n",
 		ethhdr->h_source, if_incoming->dev, if_incoming->addr_str,
 		batman_packet->orig, batman_packet->prev_sender,
 		batman_packet->seqno, batman_packet->tq, batman_packet->ttl,
@@ -427,7 +427,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	}
 
 	if (is_broadcast) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all packets with broadcast source addr (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all packets with broadcast source addr (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
@@ -455,19 +455,19 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 				bit_packet_count(word);
 		}
 
-		bat_dbg(DBG_BATMAN, "Drop packet: originator packet from myself (via neighbor) \n");
+		bat_dbg(DBG_BATMAN, "Drop packet: originator packet from myself (via neighbor)\n");
 		return;
 	}
 
 	if (batman_packet->tq == 0) {
 		count_real_packets(ethhdr, batman_packet, if_incoming);
 
-		bat_dbg(DBG_BATMAN, "Drop packet: originator packet with tq equal 0 \n");
+		bat_dbg(DBG_BATMAN, "Drop packet: originator packet with tq equal 0\n");
 		return;
 	}
 
 	if (is_my_oldorig) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast echos (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast echos (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
@@ -485,7 +485,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	    !(compare_orig(batman_packet->orig, batman_packet->prev_sender)) &&
 	    (compare_orig(orig_node->router->addr,
 			  orig_node->router->orig_node->router->addr))) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
diff --git a/send.c b/send.c
index c485324..1cca87c 100644
--- a/send.c
+++ b/send.c
@@ -291,7 +291,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 	unsigned long send_time;
 
 	if (batman_packet->ttl <= 1) {
-		bat_dbg(DBG_BATMAN, "ttl exceeded \n");
+		bat_dbg(DBG_BATMAN, "ttl exceeded\n");
 		return;
 	}
 
@@ -319,7 +319,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 	/* apply hop penalty */
 	batman_packet->tq = hop_penalty(batman_packet->tq);
 
-	bat_dbg(DBG_BATMAN, "Forwarding packet: tq_orig: %i, tq_avg: %i, tq_forw: %i, ttl_orig: %i, ttl_forw: %i \n",
+	bat_dbg(DBG_BATMAN, "Forwarding packet: tq_orig: %i, tq_avg: %i, tq_forw: %i, ttl_orig: %i, ttl_forw: %i\n",
 		in_tq, tq_avg, batman_packet->tq, in_ttl - 1,
 		batman_packet->ttl);
 
diff --git a/translation-table.c b/translation-table.c
index 9d1a10e..8a1a305 100644
--- a/translation-table.c
+++ b/translation-table.c
@@ -78,11 +78,11 @@ void hna_local_add(uint8_t *addr)
 	   MAC-flooding. */
 	if ((num_hna + 1 > (ETH_DATA_LEN - BAT_PACKET_LEN) / ETH_ALEN) ||
 	    (num_hna + 1 > 255)) {
-		bat_dbg(DBG_ROUTES, "Can't add new local hna entry (%pM): number of local hna entries exceeds packet size \n", addr);
+		bat_dbg(DBG_ROUTES, "Can't add new local hna entry (%pM): number of local hna entries exceeds packet size\n", addr);
 		return;
 	}
 
-	bat_dbg(DBG_ROUTES, "Creating new local hna entry: %pM \n",
+	bat_dbg(DBG_ROUTES, "Creating new local hna entry: %pM\n",
 		addr);
 
 	hna_local_entry = kmalloc(sizeof(struct hna_local_entry), GFP_ATOMIC);
@@ -109,7 +109,7 @@ void hna_local_add(uint8_t *addr)
 				       hna_local_hash->size * 2);
 
 		if (swaphash == NULL)
-			printk(KERN_ERR "batman-adv:Couldn't resize local hna hash table \n");
+			printk(KERN_ERR "batman-adv:Couldn't resize local hna hash table\n");
 		else
 			hna_local_hash = swaphash;
 	}
@@ -198,7 +198,7 @@ static void _hna_local_del(void *data)
 static void hna_local_del(struct hna_local_entry *hna_local_entry,
 			  char *message)
 {
-	bat_dbg(DBG_ROUTES, "Deleting local hna entry (%pM): %s \n",
+	bat_dbg(DBG_ROUTES, "Deleting local hna entry (%pM): %s\n",
 		hna_local_entry->addr, message);
 
 	hash_remove(hna_local_hash, hna_local_entry->addr);
@@ -341,7 +341,7 @@ void hna_global_add_orig(struct orig_node *orig_node,
 				       hna_global_hash->size * 2);
 
 		if (swaphash == NULL)
-			printk(KERN_ERR "batman-adv:Couldn't resize global hna hash table \n");
+			printk(KERN_ERR "batman-adv:Couldn't resize global hna hash table\n");
 		else
 			hna_global_hash = swaphash;
 	}
@@ -366,7 +366,7 @@ int hna_global_fill_buffer_text(unsigned char *buff, int buff_len)
 
 		bytes_written += snprintf(buff + bytes_written,
 					  (2 * ETH_STR_LEN) + 10,
-					  " * %02x:%02x:%02x:%02x:%02x:%02x via %02x:%02x:%02x:%02x:%02x:%02x \n",
+					  " * %02x:%02x:%02x:%02x:%02x:%02x via %02x:%02x:%02x:%02x:%02x:%02x\n",
 					  hna_global_entry->addr[0],
 					  hna_global_entry->addr[1],
 					  hna_global_entry->addr[2],
@@ -389,7 +389,7 @@ int hna_global_fill_buffer_text(unsigned char *buff, int buff_len)
 void _hna_global_del_orig(struct hna_global_entry *hna_global_entry,
 			  char *message)
 {
-	bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s \n",
+	bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s\n",
 		hna_global_entry->addr, hna_global_entry->orig_node->orig,
 		message);
 
-- 
1.7.0.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [B.A.T.M.A.N.] [PATCHv2-trunk] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:12   ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Sven Eckelmann
  2010-04-04  1:24     ` [B.A.T.M.A.N.] [PATCHv2-maint] " Sven Eckelmann
@ 2010-04-04  1:44     ` Sven Eckelmann
  2010-04-04  2:48       ` Marek Lindner
  2010-04-04 16:33       ` [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline Sven Eckelmann
  2010-04-04  1:45     ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Luis de Bethencourt
  2 siblings, 2 replies; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04  1:44 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

From: Luis de Bethencourt <luisbg@ubuntu.com>

This patch fixes the 31 unnecessary whitespaces before a quoted
newline that the batman-adv files had.

Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
[sven.eckelmann@gmx.de: Redone to apply against current version]
Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
Changes are done with "reorganized kernel interface patches (version 3)"
applied.

 batman-adv-kernelland/bat_sysfs.c         |   10 +++++-----
 batman-adv-kernelland/device.c            |    2 +-
 batman-adv-kernelland/gateway_client.c    |    6 +++---
 batman-adv-kernelland/main.c              |    2 +-
 batman-adv-kernelland/originator.c        |    8 ++++----
 batman-adv-kernelland/routing.c           |   18 +++++++++---------
 batman-adv-kernelland/send.c              |    4 ++--
 batman-adv-kernelland/translation-table.c |   12 ++++++------
 8 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/batman-adv-kernelland/bat_sysfs.c b/batman-adv-kernelland/bat_sysfs.c
index 4dffa00..ad7e4c9 100644
--- a/batman-adv-kernelland/bat_sysfs.c
+++ b/batman-adv-kernelland/bat_sysfs.c
@@ -77,7 +77,7 @@ static ssize_t show_aggr_ogm(struct kobject *kobj, struct attribute *attr,
 	struct bat_priv *bat_priv = netdev_priv(to_net_dev(dev));
 	int aggr_status = atomic_read(&bat_priv->aggregation_enabled);
 
-	return sprintf(buff, "status: %s\ncommands: enable, disable, 0, 1 \n",
+	return sprintf(buff, "status: %s\ncommands: enable, disable, 0, 1\n",
 		       aggr_status == 0 ? "disabled" : "enabled");
 }
 
@@ -125,7 +125,7 @@ static ssize_t show_bond(struct kobject *kobj, struct attribute *attr,
 	struct bat_priv *bat_priv = netdev_priv(to_net_dev(dev));
 	int bond_status = atomic_read(&bat_priv->bonding_enabled);
 
-	return sprintf(buff, "status: %s\ncommands: enable, disable, 0, 1 \n",
+	return sprintf(buff, "status: %s\ncommands: enable, disable, 0, 1\n",
 		       bond_status == 0 ? "disabled" : "enabled");
 }
 
@@ -174,7 +174,7 @@ static ssize_t show_vis_mode(struct kobject *kobj, struct attribute *attr,
 	struct bat_priv *bat_priv = netdev_priv(to_net_dev(dev));
 	int vis_mode = atomic_read(&bat_priv->vis_mode);
 
-	return sprintf(buff, "status: %s\ncommands: client, server, %d, %d \n",
+	return sprintf(buff, "status: %s\ncommands: client, server, %d, %d\n",
 		       vis_mode == VIS_TYPE_CLIENT_UPDATE ?
 							"client" : "server",
 		       VIS_TYPE_SERVER_SYNC, VIS_TYPE_CLIENT_UPDATE);
@@ -251,7 +251,7 @@ static ssize_t show_gw_mode(struct kobject *kobj, struct attribute *attr,
 	}
 
 	bytes_written += sprintf(buff + bytes_written,
-				 "commands: %s, %s <opt arg>, %s <opt arg> \n",
+				 "commands: %s, %s <opt arg>, %s <opt arg>\n",
 				 GW_MODE_OFF_NAME, GW_MODE_CLIENT_NAME,
 				 GW_MODE_SERVER_NAME);
 	return bytes_written;
@@ -480,7 +480,7 @@ static ssize_t show_mesh_iface(struct kobject *kobj, struct attribute *attr,
 	if (!batman_if)
 		return 0;
 
-	return sprintf(buff, "status: %s\ncommands: none, bat0 \n",
+	return sprintf(buff, "status: %s\ncommands: none, bat0\n",
 		       batman_if->if_status == IF_NOT_IN_USE ?
 							"none" : "bat0");
 }
diff --git a/batman-adv-kernelland/device.c b/batman-adv-kernelland/device.c
index 44d15c4..c8ec4f9 100644
--- a/batman-adv-kernelland/device.c
+++ b/batman-adv-kernelland/device.c
@@ -66,7 +66,7 @@ int bat_device_setup(void)
 	batman_class = class_create(THIS_MODULE, "batman-adv");
 
 	if (IS_ERR(batman_class)) {
-		printk(KERN_ERR "batman-adv:Could not register class 'batman-adv' \n");
+		printk(KERN_ERR "batman-adv:Could not register class 'batman-adv'\n");
 		return 0;
 	}
 
diff --git a/batman-adv-kernelland/gateway_client.c b/batman-adv-kernelland/gateway_client.c
index c4ae443..1f662d8 100644
--- a/batman-adv-kernelland/gateway_client.c
+++ b/batman-adv-kernelland/gateway_client.c
@@ -197,7 +197,7 @@ void gw_check_election(struct bat_priv *bat_priv, struct orig_node *orig_node)
 		return;
 
 	bat_dbg(DBG_BATMAN,
-		"Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i) \n",
+		"Restarting gateway selection: better gateway found (tq curr: %i, tq new: %i)\n",
 		gw_tq_avg, orig_tq_avg);
 
 deselect:
@@ -367,7 +367,7 @@ int gw_client_fill_buffer_text(struct net_device *net_dev, char *buff,
 	}
 
 	hdr_len = sprintf(buff,
-			  "      %-12s (%s/%i) %17s [%10s]: gw_class ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)] \n",
+			  "      %-12s (%s/%i) %17s [%10s]: gw_class ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n",
 			  "Gateway", "#", TQ_MAX_VALUE, "Nexthop",
 			  "outgoingIF", SOURCE_VERSION, REVISION_VERSION_STR,
 			  bat_priv->primary_if->dev,
@@ -403,7 +403,7 @@ int gw_client_fill_buffer_text(struct net_device *net_dev, char *buff,
 
 	if ((gw_count == 0) && (off == 0))
 		bytes_written += sprintf(buff + bytes_written,
-					 "No gateways in range ... \n");
+					 "No gateways in range ...\n");
 
 	return bytes_written;
 }
diff --git a/batman-adv-kernelland/main.c b/batman-adv-kernelland/main.c
index b98fd83..635f6f6 100644
--- a/batman-adv-kernelland/main.c
+++ b/batman-adv-kernelland/main.c
@@ -115,7 +115,7 @@ int init_module(void)
 	register_netdevice_notifier(&hard_if_notifier);
 	dev_add_pack(&batman_adv_packet_type);
 
-	printk(KERN_INFO "batman-adv:B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded \n",
+	printk(KERN_INFO "batman-adv:B.A.T.M.A.N. advanced %s%s (compatibility version %i) loaded\n",
 		  SOURCE_VERSION, REVISION_VERSION_STR, COMPAT_VERSION);
 
 	return 0;
diff --git a/batman-adv-kernelland/originator.c b/batman-adv-kernelland/originator.c
index d04bac4..1a59dd3 100644
--- a/batman-adv-kernelland/originator.c
+++ b/batman-adv-kernelland/originator.c
@@ -131,7 +131,7 @@ struct orig_node *get_orig_node(uint8_t *addr)
 	if (orig_node != NULL)
 		return orig_node;
 
-	bat_dbg(DBG_BATMAN, "Creating new originator: %pM \n", addr);
+	bat_dbg(DBG_BATMAN, "Creating new originator: %pM\n", addr);
 
 	orig_node = kzalloc(sizeof(struct orig_node), GFP_ATOMIC);
 	if (!orig_node)
@@ -162,7 +162,7 @@ struct orig_node *get_orig_node(uint8_t *addr)
 
 		if (swaphash == NULL)
 			printk(KERN_ERR
-			       "batman-adv:Couldn't resize orig hash table \n");
+			       "batman-adv:Couldn't resize orig hash table\n");
 		else
 			orig_hash = swaphash;
 	}
@@ -307,7 +307,7 @@ ssize_t orig_fill_buffer_text(struct net_device *net_dev, char *buff,
 
 	rcu_read_lock();
 	hdr_len = sprintf(buff,
-		   "  %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)] \n",
+		   "  %-14s (%s/%i) %17s [%10s]: %20s ... [B.A.T.M.A.N. adv %s%s, MainIF/MAC: %s/%s (%s)]\n",
 		   "Originator", "#", TQ_MAX_VALUE, "Nexthop", "outgoingIF",
 		   "Potential nexthops", SOURCE_VERSION, REVISION_VERSION_STR,
 		   bat_priv->primary_if->dev, bat_priv->primary_if->addr_str,
@@ -364,7 +364,7 @@ ssize_t orig_fill_buffer_text(struct net_device *net_dev, char *buff,
 
 	if ((batman_count == 0) && (off == 0))
 		bytes_written += sprintf(buff + bytes_written,
-					"No batman nodes in range ... \n");
+					"No batman nodes in range ...\n");
 
 	return bytes_written;
 }
diff --git a/batman-adv-kernelland/routing.c b/batman-adv-kernelland/routing.c
index 7020b01..9a60b7c 100644
--- a/batman-adv-kernelland/routing.c
+++ b/batman-adv-kernelland/routing.c
@@ -209,7 +209,7 @@ static int isBidirectionalNeigh(struct orig_node *orig_node,
 			      orig_neigh_node->tq_asym_penalty) /
 			     (TQ_MAX_VALUE * TQ_MAX_VALUE));
 
-	bat_dbg(DBG_BATMAN, "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i \n",
+	bat_dbg(DBG_BATMAN, "bidirectional: orig = %-15pM neigh = %-15pM => own_bcast = %2i, real recv = %2i, local tq: %3i, asym_penalty: %3i, total tq: %3i\n",
 		orig_node->orig, orig_neigh_node->orig, total_count,
 		neigh_node->real_packet_count, orig_neigh_node->tq_own,
 		orig_neigh_node->tq_asym_penalty, batman_packet->tq);
@@ -233,7 +233,7 @@ static void update_orig(struct orig_node *orig_node, struct ethhdr *ethhdr,
 	struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
 	int tmp_hna_buff_len;
 
-	bat_dbg(DBG_BATMAN, "update_originator(): Searching and updating originator entry of received packet \n");
+	bat_dbg(DBG_BATMAN, "update_originator(): Searching and updating originator entry of received packet\n");
 
 	list_for_each_entry(tmp_neigh_node, &orig_node->neigh_list, list) {
 		if (compare_orig(tmp_neigh_node->addr, ethhdr->h_source) &&
@@ -350,7 +350,7 @@ static char count_real_packets(struct ethhdr *ethhdr,
 	}
 
 	if (!is_duplicate) {
-		bat_dbg(DBG_BATMAN, "updating last_seqno: old %d, new %d \n",
+		bat_dbg(DBG_BATMAN, "updating last_seqno: old %d, new %d\n",
 			orig_node->last_real_seqno, batman_packet->seqno);
 		orig_node->last_real_seqno = batman_packet->seqno;
 	}
@@ -509,7 +509,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	is_single_hop_neigh = (compare_orig(ethhdr->h_source,
 					    batman_packet->orig) ? 1 : 0);
 
-	bat_dbg(DBG_BATMAN, "Received BATMAN packet via NB: %pM, IF: %s [%s] (from OG: %pM, via prev OG: %pM, seqno %d, tq %d, TTL %d, V %d, IDF %d) \n",
+	bat_dbg(DBG_BATMAN, "Received BATMAN packet via NB: %pM, IF: %s [%s] (from OG: %pM, via prev OG: %pM, seqno %d, tq %d, TTL %d, V %d, IDF %d)\n",
 		ethhdr->h_source, if_incoming->dev, if_incoming->addr_str,
 		batman_packet->orig, batman_packet->prev_sender,
 		batman_packet->seqno, batman_packet->tq, batman_packet->ttl,
@@ -550,7 +550,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	}
 
 	if (is_broadcast) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all packets with broadcast source addr (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all packets with broadcast source addr (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
@@ -578,19 +578,19 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 				bit_packet_count(word);
 		}
 
-		bat_dbg(DBG_BATMAN, "Drop packet: originator packet from myself (via neighbor) \n");
+		bat_dbg(DBG_BATMAN, "Drop packet: originator packet from myself (via neighbor)\n");
 		return;
 	}
 
 	if (batman_packet->tq == 0) {
 		count_real_packets(ethhdr, batman_packet, if_incoming);
 
-		bat_dbg(DBG_BATMAN, "Drop packet: originator packet with tq equal 0 \n");
+		bat_dbg(DBG_BATMAN, "Drop packet: originator packet with tq equal 0\n");
 		return;
 	}
 
 	if (is_my_oldorig) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast echos (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast echos (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
@@ -608,7 +608,7 @@ void receive_bat_packet(struct ethhdr *ethhdr,
 	    !(compare_orig(batman_packet->orig, batman_packet->prev_sender)) &&
 	    (compare_orig(orig_node->router->addr,
 			  orig_node->router->orig_node->router->addr))) {
-		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM) \n", ethhdr->h_source);
+		bat_dbg(DBG_BATMAN, "Drop packet: ignoring all rebroadcast packets that may make me loop (sender: %pM)\n", ethhdr->h_source);
 		return;
 	}
 
diff --git a/batman-adv-kernelland/send.c b/batman-adv-kernelland/send.c
index 684bf1d..0fb713c 100644
--- a/batman-adv-kernelland/send.c
+++ b/batman-adv-kernelland/send.c
@@ -311,7 +311,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 	unsigned long send_time;
 
 	if (batman_packet->ttl <= 1) {
-		bat_dbg(DBG_BATMAN, "ttl exceeded \n");
+		bat_dbg(DBG_BATMAN, "ttl exceeded\n");
 		return;
 	}
 
@@ -339,7 +339,7 @@ void schedule_forward_packet(struct orig_node *orig_node,
 	/* apply hop penalty */
 	batman_packet->tq = hop_penalty(batman_packet->tq);
 
-	bat_dbg(DBG_BATMAN, "Forwarding packet: tq_orig: %i, tq_avg: %i, tq_forw: %i, ttl_orig: %i, ttl_forw: %i \n",
+	bat_dbg(DBG_BATMAN, "Forwarding packet: tq_orig: %i, tq_avg: %i, tq_forw: %i, ttl_orig: %i, ttl_forw: %i\n",
 		in_tq, tq_avg, batman_packet->tq, in_ttl - 1,
 		batman_packet->ttl);
 
diff --git a/batman-adv-kernelland/translation-table.c b/batman-adv-kernelland/translation-table.c
index d63f0b8..3ce39a6 100644
--- a/batman-adv-kernelland/translation-table.c
+++ b/batman-adv-kernelland/translation-table.c
@@ -78,11 +78,11 @@ void hna_local_add(uint8_t *addr)
 	   MAC-flooding. */
 	if ((num_hna + 1 > (ETH_DATA_LEN - BAT_PACKET_LEN) / ETH_ALEN) ||
 	    (num_hna + 1 > 255)) {
-		bat_dbg(DBG_ROUTES, "Can't add new local hna entry (%pM): number of local hna entries exceeds packet size \n", addr);
+		bat_dbg(DBG_ROUTES, "Can't add new local hna entry (%pM): number of local hna entries exceeds packet size\n", addr);
 		return;
 	}
 
-	bat_dbg(DBG_ROUTES, "Creating new local hna entry: %pM \n",
+	bat_dbg(DBG_ROUTES, "Creating new local hna entry: %pM\n",
 		addr);
 
 	hna_local_entry = kmalloc(sizeof(struct hna_local_entry), GFP_ATOMIC);
@@ -109,7 +109,7 @@ void hna_local_add(uint8_t *addr)
 				       hna_local_hash->size * 2);
 
 		if (swaphash == NULL)
-			printk(KERN_ERR "batman-adv:Couldn't resize local hna hash table \n");
+			printk(KERN_ERR "batman-adv:Couldn't resize local hna hash table\n");
 		else
 			hna_local_hash = swaphash;
 	}
@@ -220,7 +220,7 @@ static void _hna_local_del(void *data)
 static void hna_local_del(struct hna_local_entry *hna_local_entry,
 			  char *message)
 {
-	bat_dbg(DBG_ROUTES, "Deleting local hna entry (%pM): %s \n",
+	bat_dbg(DBG_ROUTES, "Deleting local hna entry (%pM): %s\n",
 		hna_local_entry->addr, message);
 
 	hash_remove(hna_local_hash, hna_local_entry->addr);
@@ -363,7 +363,7 @@ void hna_global_add_orig(struct orig_node *orig_node,
 				       hna_global_hash->size * 2);
 
 		if (swaphash == NULL)
-			printk(KERN_ERR "batman-adv:Couldn't resize global hna hash table \n");
+			printk(KERN_ERR "batman-adv:Couldn't resize global hna hash table\n");
 		else
 			hna_global_hash = swaphash;
 	}
@@ -433,7 +433,7 @@ int hna_global_fill_buffer_text(struct net_device *net_dev, char *buff,
 void _hna_global_del_orig(struct hna_global_entry *hna_global_entry,
 			  char *message)
 {
-	bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s \n",
+	bat_dbg(DBG_ROUTES, "Deleting global hna entry %pM (via %pM): %s\n",
 		hna_global_entry->addr, hna_global_entry->orig_node->orig,
 		message);
 
-- 
1.7.0.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:12   ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Sven Eckelmann
  2010-04-04  1:24     ` [B.A.T.M.A.N.] [PATCHv2-maint] " Sven Eckelmann
  2010-04-04  1:44     ` [B.A.T.M.A.N.] [PATCHv2-trunk] " Sven Eckelmann
@ 2010-04-04  1:45     ` Luis de Bethencourt
  2010-04-04 10:46       ` Sven Eckelmann
  2010-04-04 13:56       ` Andrew Lunn
  2 siblings, 2 replies; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04  1:45 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: devel, gregkh, linux-kernel, b.a.t.m.a.n

On Sun, Apr 4, 2010 at 2:12 AM, Sven Eckelmann <sven.eckelmann@gmx.de> wrote:
> Luis de Bethencourt wrote:
>> This patch fixes the 32 unnecessary whitespaces before a quoted
>> newline that the batman-adv files had.
>
> Thanks.
>
> Your patch conflicts with patches waiting to be applied by Greg KH. I will
> redo your changes for the current and development version and submit them to
> the b.a.t.m.a.n. mailing list for further discussion. Is that ok for you?
>
> Best regards,
>        Sven Eckelmann
>

Sven,

Sorry about the conflict, thanks for redoing the changes. Where can I
find the current and development branches? I want to avoid doing this
mistake again in the future. Specially since I'm planning on doing
some janitorial work on Staging for a while if it's OK with you guys.
I see it as nice experience and practice while learning and getting
ready for more valuable contributions :)

Cheers,
Luis de Bethencourt

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2-trunk] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:44     ` [B.A.T.M.A.N.] [PATCHv2-trunk] " Sven Eckelmann
@ 2010-04-04  2:48       ` Marek Lindner
  2010-04-04 16:33       ` [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline Sven Eckelmann
  1 sibling, 0 replies; 19+ messages in thread
From: Marek Lindner @ 2010-04-04  2:48 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

On Sunday 04 April 2010 09:44:20 Sven Eckelmann wrote:
> From: Luis de Bethencourt <luisbg@ubuntu.com>
> 
> This patch fixes the 31 unnecessary whitespaces before a quoted
> newline that the batman-adv files had.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
> [sven.eckelmann@gmx.de: Redone to apply against current version]
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
> ---
> Changes are done with "reorganized kernel interface patches (version 3)"
> applied.
>
> --- a/batman-adv-kernelland/bat_sysfs.c
> +++ b/batman-adv-kernelland/bat_sysfs.c
> @@ -77,7 +77,7 @@ static ssize_t show_aggr_ogm(struct kobject *kobj, struct
>  attribute *attr, struct bat_priv *bat_priv = netdev_priv(to_net_dev(dev));
>         int aggr_status = atomic_read(&bat_priv->aggregation_enabled);
>  
> -       return sprintf(buff, "status: %s\ncommands: enable, disable, 0, 1
>  \n", +       return sprintf(buff, "status: %s\ncommands: enable, disable,
>  0, 1\n", aggr_status == 0 ? "disabled" : "enabled"); }

The whitespaces in bat_sysfs.c after the "commands" string are intentional. 
Userspace applications can simply split the string after each whitespace. Of 
course, it can be done differently but it only "costs" us a whitespace. I was 
not aware this would be an issue. Can we keep it or should we change e.g. 
batctl ?

Cheers,
Marek

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:45     ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Luis de Bethencourt
@ 2010-04-04 10:46       ` Sven Eckelmann
  2010-04-04 11:10         ` Luis de Bethencourt
  2010-04-04 13:56       ` Andrew Lunn
  1 sibling, 1 reply; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04 10:46 UTC (permalink / raw)
  To: Luis de Bethencourt; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: Text/Plain, Size: 1934 bytes --]

On Sunday 04 April 2010 03:45:52 Luis de Bethencourt wrote:
> Sorry about the conflict, thanks for redoing the changes. Where can I
> find the current and development branches?

The development is currently done in different branches and SCMs outside the 
kernel. Andrew Lunn prepares a maint branch for submission to GregKH and sends 
it to him for staging.

Most of the development of future features are done in
 http://downloads.open-mesh.org/svn/batman/ under trunk/batman-adv-kernelland/
This is usually not what you deal with as only the maint branch is submitted 
for inclusion into linux staging. Nevertheless all changes in svn for batman-
adv-kernelland are automatically imported into
http://git.open-mesh.net/?p=batman-adv (branch master).

The maint work is now done inside the maint branch of that git repository. It 
doesn't contain the whole linux tree and holds all files to build an external 
module (used for example in OpenWRT and Debian). When Andrew thinks that it is 
ready to be send to GregKH, he will do a subtree merge into linus (holds the 
linux tree) and then rebase the changes in a private branch. This is needed to 
have the correct directories inside the patches and that files removed/added 
for the kernel are still being deleted/available.

So doing your changes against the git maint branch is the correct way in most 
situations.

> I want to avoid doing this
> mistake again in the future. Specially since I'm planning on doing
> some janitorial work on Staging for a while if it's OK with you guys.
> I see it as nice experience and practice while learning and getting
> ready for more valuable contributions :)

Yes, contributors are welcome.

There is also a userspace part which must also work with your changes. One 
problem was spotted by Marek. So it is maybe a good idea to send changes over 
the b.a.t.m.a.n. mailing list.

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 10:46       ` Sven Eckelmann
@ 2010-04-04 11:10         ` Luis de Bethencourt
  2010-04-04 11:30           ` Sven Eckelmann
  0 siblings, 1 reply; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 11:10 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n

On Sun, Apr 4, 2010 at 11:46 AM, Sven Eckelmann <sven.eckelmann@gmx.de> wrote:
> On Sunday 04 April 2010 03:45:52 Luis de Bethencourt wrote:
>> Sorry about the conflict, thanks for redoing the changes. Where can I
>> find the current and development branches?
>
> The development is currently done in different branches and SCMs outside the
> kernel. Andrew Lunn prepares a maint branch for submission to GregKH and sends
> it to him for staging.
>
> Most of the development of future features are done in
>  http://downloads.open-mesh.org/svn/batman/ under trunk/batman-adv-kernelland/
> This is usually not what you deal with as only the maint branch is submitted
> for inclusion into linux staging. Nevertheless all changes in svn for batman-
> adv-kernelland are automatically imported into
> http://git.open-mesh.net/?p=batman-adv (branch master).
>
> The maint work is now done inside the maint branch of that git repository. It
> doesn't contain the whole linux tree and holds all files to build an external
> module (used for example in OpenWRT and Debian). When Andrew thinks that it is
> ready to be send to GregKH, he will do a subtree merge into linus (holds the
> linux tree) and then rebase the changes in a private branch. This is needed to
> have the correct directories inside the patches and that files removed/added
> for the kernel are still being deleted/available.
>
> So doing your changes against the git maint branch is the correct way in most
> situations.
>
>> I want to avoid doing this
>> mistake again in the future. Specially since I'm planning on doing
>> some janitorial work on Staging for a while if it's OK with you guys.
>> I see it as nice experience and practice while learning and getting
>> ready for more valuable contributions :)
>
> Yes, contributors are welcome.
>
> There is also a userspace part which must also work with your changes. One
> problem was spotted by Marek. So it is maybe a good idea to send changes over
> the b.a.t.m.a.n. mailing list.
>
> Best regards,
>        Sven
>

Thanks a lot for the help Sven.

My patch didn't include changes to bat_sysfs.c, where are this changes
coming from? Sorry if I'm missing something obvious.

Luis

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 11:10         ` Luis de Bethencourt
@ 2010-04-04 11:30           ` Sven Eckelmann
  2010-04-04 12:39             ` Luis de Bethencourt
  0 siblings, 1 reply; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04 11:30 UTC (permalink / raw)
  To: Luis de Bethencourt; +Cc: b.a.t.m.a.n

[-- Attachment #1: Type: Text/Plain, Size: 586 bytes --]

On Sunday 04 April 2010 13:10:12 you wrote:

> Thanks a lot for the help Sven.
> 
> My patch didn't include changes to bat_sysfs.c, where are this changes
> coming from? Sorry if I'm missing something obvious.

Correct, that was part of the redoing of your changes. bat_sysfs.c is only 
part of the current development version and not in your patch (you still had 
the /proc stuff).

But maybe you could explain to Marek why it is important/correct/good/... to 
have no whitespaces before \n or if the part for /proc or /sys files can be 
ignored.

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 11:30           ` Sven Eckelmann
@ 2010-04-04 12:39             ` Luis de Bethencourt
  2010-04-04 14:42               ` Marek Lindner
  0 siblings, 1 reply; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 12:39 UTC (permalink / raw)
  To: Sven Eckelmann, Marek Lindner; +Cc: b.a.t.m.a.n

On Sun, Apr 4, 2010 at 12:30 PM, Sven Eckelmann <sven.eckelmann@gmx.de> wrote:
> On Sunday 04 April 2010 13:10:12 you wrote:
>
>> Thanks a lot for the help Sven.
>>
>> My patch didn't include changes to bat_sysfs.c, where are this changes
>> coming from? Sorry if I'm missing something obvious.
>
> Correct, that was part of the redoing of your changes. bat_sysfs.c is only
> part of the current development version and not in your patch (you still had
> the /proc stuff).
>
> But maybe you could explain to Marek why it is important/correct/good/... to
> have no whitespaces before \n or if the part for /proc or /sys files can be
> ignored.
>
> Best regards,
>        Sven
>

I saw the bat_sysfs.c in the redoing of the changes. It is OK with me.

IMHO a whitespace before a \n is unneccesary, since it is a blank
character at the end of the line. Like adding a 0 at the left of a
number.
The obvious minor issue to try and avoid is space since having a big
number of these can bloat slightly the size of code/kernel. But the
whitespace can create other bigger issues, an example is when the
whitespace coincidentally falls one character out of the length of the
terminal, this will screw up the line break formatting in an ugly way.

I think these are the reasons why the coding style guidelines of the
Linux Kernel ask to avoid these whitespaces. Which also means removing
this helps the consistency of the kernel's code.

> Marek wrote:
> The whitespaces in bat_sysfs.c after the "commands" string are intentional.
> Userspace applications can simply split the string after each whitespace. Of
> course, it can be done differently but it only "costs" us a whitespace. I was
> not aware this would be an issue. Can we keep it or should we change e.g.
> batctl ?

Honestly, I don't understand the intention of the whitespaces you are
talking about. Userspace applications have to split the string after
each whitespace because there is a \n there, my fix just suggested to
split the line before the whitespace since I see no need for it.

So am I missunderstanding and there is a need for that whitespace?
Same question asked differently: Will there be any difference in the
print out if the line is broken before the whitespace instead of
after?

If so, please show me an example :)

Luis

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:45     ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Luis de Bethencourt
  2010-04-04 10:46       ` Sven Eckelmann
@ 2010-04-04 13:56       ` Andrew Lunn
  2010-04-04 14:56         ` Luis de Bethencourt
  1 sibling, 1 reply; 19+ messages in thread
From: Andrew Lunn @ 2010-04-04 13:56 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking
  Cc: devel, gregkh, linux-kernel

> Sorry about the conflict, thanks for redoing the changes. Where can I
> find the current and development branches? I want to avoid doing this
> mistake again in the future. Specially since I'm planning on doing
> some janitorial work on Staging for a while if it's OK with you guys.
> I see it as nice experience and practice while learning and getting
> ready for more valuable contributions :)

Sven has told you about how batman uses different repositories. You
can find some more information at:

http://www.open-mesh.org/wiki/UsingBatmanGit

When working on other staging drivers i suggest you work on either the
linux-next tree, or contact the driver maintainers and ask if they
have there own development tree. Staging drivers tend to be fast
moving. They change a lot. What is in the current release kernel,
which is effectively 3 months old, can be very different to the latest
development version. I've received many patches to things we have
fixed months ago and are either waiting in linux-next for the next
kernel release, or our in or development tree. I'm sure the same
applies to other drivers in staging.

Another option for interesting work to get involved in the kernel is
to ask GregKH if there is a staging driver which is not being actively
worked on. Some drivers just get dumped there and nobody spends the
time and effort needed to get them merged. After a while they get
thrown out of the staging. You could adopt such a driver, get hold of
the hardware and do the work needed to get it out of staging and into
the main tree.

    Andrew

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 12:39             ` Luis de Bethencourt
@ 2010-04-04 14:42               ` Marek Lindner
  2010-04-04 15:02                 ` Luis de Bethencourt
  0 siblings, 1 reply; 19+ messages in thread
From: Marek Lindner @ 2010-04-04 14:42 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

On Sunday 04 April 2010 20:39:49 Luis de Bethencourt wrote:
> Honestly, I don't understand the intention of the whitespaces you are
> talking about. Userspace applications have to split the string after
> each whitespace because there is a \n there, my fix just suggested to
> split the line before the whitespace since I see no need for it.
> 
> So am I missunderstanding and there is a need for that whitespace?
> Same question asked differently: Will there be any difference in the
> print out if the line is broken before the whitespace instead of
> after?

Let's take this string as an example:
"commands: enable, disable, 0, 1 \n"
The batctl code uses strchr() to jump to each whitespace location within the 
string and handle each word individually. By removing the last whitespace the 
code will not handle "1" because there is not more whitespace. See 
handle_sys_setting() in http://www.open-mesh.org/browser/trunk/batctl/sys.c

That is not tragic but the batctl code needs to be changed as well if the 
whitespace is removed.

Regards,
Marek

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 13:56       ` Andrew Lunn
@ 2010-04-04 14:56         ` Luis de Bethencourt
  0 siblings, 0 replies; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 14:56 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: devel,
	The list for a Better Approach To Mobile Ad-hoc Networking,
	gregkh, linux-kernel

On Sun, Apr 4, 2010 at 2:56 PM, Andrew Lunn <andrew@lunn.ch> wrote:
>> Sorry about the conflict, thanks for redoing the changes. Where can I
>> find the current and development branches? I want to avoid doing this
>> mistake again in the future. Specially since I'm planning on doing
>> some janitorial work on Staging for a while if it's OK with you guys.
>> I see it as nice experience and practice while learning and getting
>> ready for more valuable contributions :)
>
> Sven has told you about how batman uses different repositories. You
> can find some more information at:
>
> http://www.open-mesh.org/wiki/UsingBatmanGit
>
> When working on other staging drivers i suggest you work on either the
> linux-next tree, or contact the driver maintainers and ask if they
> have there own development tree. Staging drivers tend to be fast
> moving. They change a lot. What is in the current release kernel,
> which is effectively 3 months old, can be very different to the latest
> development version. I've received many patches to things we have
> fixed months ago and are either waiting in linux-next for the next
> kernel release, or our in or development tree. I'm sure the same
> applies to other drivers in staging.

Andrew,

Oh thanks! After learning about this about the batman development tree
I wondered how to find out where the equivalent branches for other
projects are. Checking the linux-next branch sounds great. I'm still
learning the details of the kernel development process, I knew about
this branch but now I understand it's function and purpose.

I will also contact driver maintainers before sending a patch even if
it is small. I appreciate hugely that Sven redid my changes with the
new branch, but I don't want to create more work for a maintainer in
the future. On the contrary, I want to help :)

>
> Another option for interesting work to get involved in the kernel is
> to ask GregKH if there is a staging driver which is not being actively
> worked on. Some drivers just get dumped there and nobody spends the
> time and effort needed to get them merged. After a while they get
> thrown out of the staging. You could adopt such a driver, get hold of
> the hardware and do the work needed to get it out of staging and into
> the main tree.
>
>    Andrew

That sounds awesome. I will contact him and see if there is any orphan
driver that is of my interest and that I can get my hands on the
hardware. I presume it is a good starting point since it involves
doing the last steps of the process and not starting something from
scratch. A good angle to understand the 'big picture' of driver
development better.

Thanks a million for the suggestions and help. :)

Luis


PD: By the way, I know top posting is a big no-no. is inline posting
ok? in cases like your email where the two paragraphs address diferent
topics I find it more logical to down-post after each one. just
checking before I continue doing so.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 14:42               ` Marek Lindner
@ 2010-04-04 15:02                 ` Luis de Bethencourt
  2010-04-04 15:14                   ` Sven Eckelmann
  0 siblings, 1 reply; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 15:02 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n

On Sun, Apr 4, 2010 at 3:42 PM, Marek Lindner <lindner_marek@yahoo.de> wrote:
> On Sunday 04 April 2010 20:39:49 Luis de Bethencourt wrote:
>> Honestly, I don't understand the intention of the whitespaces you are
>> talking about. Userspace applications have to split the string after
>> each whitespace because there is a \n there, my fix just suggested to
>> split the line before the whitespace since I see no need for it.
>>
>> So am I missunderstanding and there is a need for that whitespace?
>> Same question asked differently: Will there be any difference in the
>> print out if the line is broken before the whitespace instead of
>> after?
>
> Let's take this string as an example:
> "commands: enable, disable, 0, 1 \n"
> The batctl code uses strchr() to jump to each whitespace location within the
> string and handle each word individually. By removing the last whitespace the
> code will not handle "1" because there is not more whitespace. See
> handle_sys_setting() in http://www.open-mesh.org/browser/trunk/batctl/sys.c
>
> That is not tragic but the batctl code needs to be changed as well if the
> whitespace is removed.
>
> Regards,
> Marek
>

Ohhhhhh... I wasn't aware of that.

In this case the whitespace is needed to separate 1 from \n. Being
this the case you are correct, I agree with you that keeping those
whitespaces is a small cost compared to changing the logic of how
batctl works.

I stand corrected :P

Thanks for taking the time of writing the example Marek.


Sven,

Should I redo the patch you sent taking out the changes that are
affected by the above?

Luis

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 15:02                 ` Luis de Bethencourt
@ 2010-04-04 15:14                   ` Sven Eckelmann
  2010-04-04 15:19                     ` Luis de Bethencourt
  0 siblings, 1 reply; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04 15:14 UTC (permalink / raw)
  To: Luis de Bethencourt; +Cc: b.a.t.m.a.n, Marek Lindner

[-- Attachment #1: Type: Text/Plain, Size: 402 bytes --]

On Sunday 04 April 2010 17:02:52 Luis de Bethencourt wrote:
> Sven,
> 
> Should I redo the patch you sent taking out the changes that are
> affected by the above?

No, Marek or I or someone who is faster will do the changes needed in batctl. 
It is high on my agenta and not really complicated. Just have to make it at 
the same time the whitespace patch gets applied.

Best regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues
  2010-04-04 15:14                   ` Sven Eckelmann
@ 2010-04-04 15:19                     ` Luis de Bethencourt
  0 siblings, 0 replies; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 15:19 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n, Marek Lindner

On Sun, Apr 4, 2010 at 4:14 PM, Sven Eckelmann <sven.eckelmann@gmx.de> wrote:
> On Sunday 04 April 2010 17:02:52 Luis de Bethencourt wrote:
>> Sven,
>>
>> Should I redo the patch you sent taking out the changes that are
>> affected by the above?
>
> No, Marek or I or someone who is faster will do the changes needed in batctl.
> It is high on my agenta and not really complicated. Just have to make it at
> the same time the whitespace patch gets applied.
>
> Best regards,
>        Sven
>

Cool! Thanks.

Luis

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline
  2010-04-04  1:44     ` [B.A.T.M.A.N.] [PATCHv2-trunk] " Sven Eckelmann
  2010-04-04  2:48       ` Marek Lindner
@ 2010-04-04 16:33       ` Sven Eckelmann
  2010-04-06  5:33         ` Marek Lindner
  1 sibling, 1 reply; 19+ messages in thread
From: Sven Eckelmann @ 2010-04-04 16:33 UTC (permalink / raw)
  To: b.a.t.m.a.n

The current settings parser assumes that a newline is at the end of each
line starting with "commands:". Luis de Bethencourt reported that this
is a bad coding style and should be avoided.

To parse the new settings lines we must also check for \n and not only
for single whitespaces. After each check it must be ensured that the old
character is placed again at the old place and the line seems to be
unmodified to the user.

For old versions with extra whitespace before a newline an extra check
must be applied to not allow commands with empty parameter like in
 batctl vis_mode ''

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batctl/functions.c |   18 ++++++++++++++++++
 batctl/functions.h |    1 +
 batctl/sys.c       |   13 +++++++++----
 3 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/batctl/functions.c b/batctl/functions.c
index 7d8be51..e5fe670 100644
--- a/batctl/functions.c
+++ b/batctl/functions.c
@@ -311,3 +311,21 @@ out:
 		close(fd);
 	return res;
 }
+
+char *strchr_anyof(const char *s, const char *n)
+{
+	char *cur, *first = NULL;
+	size_t i, len;
+
+	if (s == NULL || n == NULL)
+		return first;
+
+	len = strlen(n);
+	for (i = 0; i < len; i++) {
+		cur = strchr(s, n[i]);
+		if (cur != NULL && (cur < first || first == NULL))
+			first = cur;
+	}
+
+	return first;
+}
diff --git a/batctl/functions.h b/batctl/functions.h
index 63740d2..14b8478 100644
--- a/batctl/functions.h
+++ b/batctl/functions.h
@@ -37,6 +37,7 @@ char *get_name_by_macstr(char *mac_str, int read_opt);
 int read_file(char *dir, char *path, int read_opt);
 int write_file(char *dir, char *fname, char *arg1, char *arg2);
 int check_proc_dir(char *dir);
+char *strchr_anyof(const char *s, const char *n);
 
 extern char *line_ptr;
 
diff --git a/batctl/sys.c b/batctl/sys.c
index 1b0b784..5f44c6a 100644
--- a/batctl/sys.c
+++ b/batctl/sys.c
@@ -335,6 +335,7 @@ void orig_interval_usage(void)
 int handle_sys_setting(int argc, char **argv, char *file_path, void setting_usage(void))
 {
 	int optchar, res;
+	char space_char;
 	char *space_ptr, *comma_char, *cmds = NULL;
 
 	while ((optchar = getopt(argc, argv, "h")) != -1) {
@@ -355,15 +356,19 @@ int handle_sys_setting(int argc, char **argv, char *file_path, void setting_usag
 	if (res != EXIT_SUCCESS)
 		return res;
 
-	while ((space_ptr = strchr(line_ptr, ' ')) != NULL) {
+	while ((space_ptr = strchr_anyof(line_ptr, " \n")) != NULL) {
+		space_char = *space_ptr;
 		*space_ptr = '\0';
+		comma_char = NULL;
 
 		if (strncmp(line_ptr, SEARCH_ARGS_TAG, strlen(SEARCH_ARGS_TAG)) == 0) {
 			cmds = space_ptr + 1;
 			goto next;
 		}
 
-		comma_char = NULL;
+		if (strlen(line_ptr) == 0)
+			goto next;
+
 		if (line_ptr[strlen(line_ptr) - 1] == ',') {
 			comma_char = line_ptr + strlen(line_ptr) - 1;
 			*comma_char = '\0';
@@ -372,11 +377,11 @@ int handle_sys_setting(int argc, char **argv, char *file_path, void setting_usag
 		if (strcmp(line_ptr, argv[1]) == 0)
 			goto write_file;
 
-		*space_ptr = ' ';
+next:
+		*space_ptr = space_char;
 		if (comma_char)
 			*comma_char = ',';
 
-next:
 		line_ptr = space_ptr + 1;
 	}
 
-- 
1.7.0.3


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2-maint] Staging: batman-adv: fix whitespace style issues
  2010-04-04  1:24     ` [B.A.T.M.A.N.] [PATCHv2-maint] " Sven Eckelmann
@ 2010-04-04 17:09       ` Marek Lindner
  2010-04-04 17:51         ` Luis de Bethencourt
  0 siblings, 1 reply; 19+ messages in thread
From: Marek Lindner @ 2010-04-04 17:09 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

On Sunday 04 April 2010 09:24:01 Sven Eckelmann wrote:
> From: Luis de Bethencourt <luisbg@ubuntu.com>
> 
> This patch fixes the 31 unnecessary whitespaces before a quoted
> newline that the batman-adv files had.
> 
> Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
> [sven.eckelmann@gmx.de: Redone to apply against current version]
> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>

Ok, that patch is in the repos now!

Thanks,
Marek

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCHv2-maint] Staging: batman-adv: fix whitespace style issues
  2010-04-04 17:09       ` Marek Lindner
@ 2010-04-04 17:51         ` Luis de Bethencourt
  0 siblings, 0 replies; 19+ messages in thread
From: Luis de Bethencourt @ 2010-04-04 17:51 UTC (permalink / raw)
  To: Marek Lindner; +Cc: b.a.t.m.a.n

On Sun, Apr 4, 2010 at 6:09 PM, Marek Lindner <lindner_marek@yahoo.de> wrote:
> On Sunday 04 April 2010 09:24:01 Sven Eckelmann wrote:
>> From: Luis de Bethencourt <luisbg@ubuntu.com>
>>
>> This patch fixes the 31 unnecessary whitespaces before a quoted
>> newline that the batman-adv files had.
>>
>> Signed-off-by: Luis de Bethencourt <luisbg@ubuntu.com>
>> [sven.eckelmann@gmx.de: Redone to apply against current version]
>> Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
>
> Ok, that patch is in the repos now!
>
> Thanks,
> Marek
>

w00t \o/

Thanks to all!
Luis

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline
  2010-04-04 16:33       ` [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline Sven Eckelmann
@ 2010-04-06  5:33         ` Marek Lindner
  0 siblings, 0 replies; 19+ messages in thread
From: Marek Lindner @ 2010-04-06  5:33 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Luis de Bethencourt

On Monday 05 April 2010 00:33:57 Sven Eckelmann wrote:
> The current settings parser assumes that a newline is at the end of each
> line starting with "commands:". Luis de Bethencourt reported that this
> is a bad coding style and should be avoided.

Ok, I just verfied and committed your patch which allowed me to submit the 
remaining "whitespace" changes from Luis as well.

Thanks,
Marek

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2010-04-06  5:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <batman-adv>
     [not found] ` <1270341625-28764-1-git-send-email-luisbg@ubuntu.com>
2010-04-04  1:12   ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Sven Eckelmann
2010-04-04  1:24     ` [B.A.T.M.A.N.] [PATCHv2-maint] " Sven Eckelmann
2010-04-04 17:09       ` Marek Lindner
2010-04-04 17:51         ` Luis de Bethencourt
2010-04-04  1:44     ` [B.A.T.M.A.N.] [PATCHv2-trunk] " Sven Eckelmann
2010-04-04  2:48       ` Marek Lindner
2010-04-04 16:33       ` [B.A.T.M.A.N.] [PATCH] batctl: Parse allowed settings for sysfs without whitespace before newline Sven Eckelmann
2010-04-06  5:33         ` Marek Lindner
2010-04-04  1:45     ` [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues Luis de Bethencourt
2010-04-04 10:46       ` Sven Eckelmann
2010-04-04 11:10         ` Luis de Bethencourt
2010-04-04 11:30           ` Sven Eckelmann
2010-04-04 12:39             ` Luis de Bethencourt
2010-04-04 14:42               ` Marek Lindner
2010-04-04 15:02                 ` Luis de Bethencourt
2010-04-04 15:14                   ` Sven Eckelmann
2010-04-04 15:19                     ` Luis de Bethencourt
2010-04-04 13:56       ` Andrew Lunn
2010-04-04 14:56         ` Luis de Bethencourt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).