Skip to content

Commit 0aca236

Browse files
ecsvAntonio Quartulli
authored andcommitted
batman-adv: Fix alignment after opened parentheses
Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
1 parent cb4cca7 commit 0aca236

5 files changed

Lines changed: 24 additions & 19 deletions

File tree

‎net/batman-adv/debugfs.c‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ static int batadv_log_release(struct inode *inode, struct file *file)
111111
return 0;
112112
}
113113

114+
static int batadv_log_empty(struct batadv_debug_log *debug_log)
115+
{
116+
return !(debug_log->log_start - debug_log->log_end);
117+
}
118+
114119
static ssize_t batadv_log_read(struct file *file, char __user *buf,
115120
size_t count, loff_t *ppos)
116121
{
@@ -120,8 +125,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
120125
char *char_addr;
121126
char c;
122127

123-
if ((file->f_flags & O_NONBLOCK) &&
124-
!(debug_log->log_end - debug_log->log_start))
128+
if ((file->f_flags & O_NONBLOCK) && batadv_log_empty(debug_log))
125129
return -EAGAIN;
126130

127131
if (!buf)
@@ -134,7 +138,7 @@ static ssize_t batadv_log_read(struct file *file, char __user *buf,
134138
return -EFAULT;
135139

136140
error = wait_event_interruptible(debug_log->queue_wait,
137-
(debug_log->log_start - debug_log->log_end));
141+
(!batadv_log_empty(debug_log)));
138142

139143
if (error)
140144
return error;
@@ -175,7 +179,7 @@ static unsigned int batadv_log_poll(struct file *file, poll_table *wait)
175179

176180
poll_wait(file, &debug_log->queue_wait, wait);
177181

178-
if (debug_log->log_end - debug_log->log_start)
182+
if (!batadv_log_empty(debug_log))
179183
return POLLIN | POLLRDNORM;
180184

181185
return 0;
@@ -370,9 +374,9 @@ int batadv_debugfs_add_meshif(struct net_device *dev)
370374

371375
for (bat_debug = batadv_mesh_debuginfos; *bat_debug; ++bat_debug) {
372376
file = debugfs_create_file(((*bat_debug)->attr).name,
373-
S_IFREG | ((*bat_debug)->attr).mode,
374-
bat_priv->debug_dir,
375-
dev, &(*bat_debug)->fops);
377+
S_IFREG | ((*bat_debug)->attr).mode,
378+
bat_priv->debug_dir,
379+
dev, &(*bat_debug)->fops);
376380
if (!file) {
377381
batadv_err(dev, "Can't add debugfs file: %s/%s\n",
378382
dev->name, ((*bat_debug)->attr).name);

‎net/batman-adv/hard-interface.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,15 +324,15 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
324324
batadv_info(hard_iface->soft_iface, "Adding interface: %s\n",
325325
hard_iface->net_dev->name);
326326

327-
if (atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
328-
ETH_DATA_LEN + BATADV_HEADER_LEN)
327+
if (atomic_read(&bat_priv->fragmentation) &&
328+
hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
329329
batadv_info(hard_iface->soft_iface,
330330
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to %zi would solve the problem.\n",
331331
hard_iface->net_dev->name, hard_iface->net_dev->mtu,
332332
ETH_DATA_LEN + BATADV_HEADER_LEN);
333333

334-
if (!atomic_read(&bat_priv->fragmentation) && hard_iface->net_dev->mtu <
335-
ETH_DATA_LEN + BATADV_HEADER_LEN)
334+
if (!atomic_read(&bat_priv->fragmentation) &&
335+
hard_iface->net_dev->mtu < ETH_DATA_LEN + BATADV_HEADER_LEN)
336336
batadv_info(hard_iface->soft_iface,
337337
"The MTU of interface %s is too small (%i) to handle the transport of batman-adv packets. If you experience problems getting traffic through try increasing the MTU to %zi.\n",
338338
hard_iface->net_dev->name, hard_iface->net_dev->mtu,

‎net/batman-adv/originator.c‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
413413
int batman_count = 0;
414414
int last_seen_secs;
415415
int last_seen_msecs;
416+
unsigned long last_seen_jiffies;
416417
uint32_t i;
417418
int ret = 0;
418419

@@ -451,10 +452,10 @@ int batadv_orig_seq_print_text(struct seq_file *seq, void *offset)
451452
if (neigh_node->tq_avg == 0)
452453
goto next;
453454

454-
last_seen_secs = jiffies_to_msecs(jiffies -
455-
orig_node->last_seen) / 1000;
456-
last_seen_msecs = jiffies_to_msecs(jiffies -
457-
orig_node->last_seen) % 1000;
455+
last_seen_jiffies = jiffies - orig_node->last_seen;
456+
last_seen_msecs = jiffies_to_msecs(last_seen_jiffies);
457+
last_seen_secs = last_seen_msecs / 1000;
458+
last_seen_msecs = last_seen_msecs % 1000;
458459

459460
seq_printf(seq, "%pM %4i.%03is (%3i) %pM [%10s]:",
460461
orig_node->orig, last_seen_secs,

‎net/batman-adv/routing.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,7 @@ static int batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
969969
ETH_HLEN) < 0)
970970
return 0;
971971

972-
ethhdr = (struct ethhdr *)(skb->data +
973-
sizeof(struct batadv_unicast_packet));
972+
ethhdr = (struct ethhdr *)(skb->data + sizeof(*unicast_packet));
974973

975974
/* we don't have an updated route for this client, so we should
976975
* not try to reroute the packet!!

‎net/batman-adv/unicast.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv)
296296
struct batadv_neigh_node *neigh_node;
297297
int data_len = skb->len;
298298
int ret = 1;
299+
unsigned int dev_mtu;
299300

300301
/* get routing information */
301302
if (is_multicast_ether_addr(ethhdr->h_dest)) {
@@ -344,9 +345,9 @@ int batadv_unicast_send_skb(struct sk_buff *skb, struct batadv_priv *bat_priv)
344345
if (batadv_tt_global_client_is_roaming(bat_priv, ethhdr->h_dest))
345346
unicast_packet->ttvn = unicast_packet->ttvn - 1;
346347

348+
dev_mtu = neigh_node->if_incoming->net_dev->mtu;
347349
if (atomic_read(&bat_priv->fragmentation) &&
348-
data_len + sizeof(*unicast_packet) >
349-
neigh_node->if_incoming->net_dev->mtu) {
350+
data_len + sizeof(*unicast_packet) > dev_mtu) {
350351
/* send frag skb decreases ttl */
351352
unicast_packet->header.ttl++;
352353
ret = batadv_frag_send_skb(skb, bat_priv,

0 commit comments

Comments
 (0)