Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277943
b: refs/heads/master
c: d099c2c
h: refs/heads/master
i:
  277941: fc8352c
  277939: 46fcdf8
  277935: 754f62a
v: v3
  • Loading branch information
Simon Wunderlich authored and Sven Eckelmann committed Nov 20, 2011
1 parent 35a2d0b commit 6cc522b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 56 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c90681b8505946761b55d4981c9c3b56b3c4171b
refs/heads/master: d099c2c541f003bfde9a9eda5519913b313c4c27
57 changes: 2 additions & 55 deletions trunk/net/batman-adv/translation-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,6 @@ int tt_local_seq_print_text(struct seq_file *seq, void *offset)
struct hard_iface *primary_if;
struct hlist_node *node;
struct hlist_head *head;
size_t buf_size, pos;
char *buff;
uint32_t i;
int ret = 0;

Expand All @@ -338,34 +336,13 @@ int tt_local_seq_print_text(struct seq_file *seq, void *offset)
"announced via TT (TTVN: %u):\n",
net_dev->name, (uint8_t)atomic_read(&bat_priv->ttvn));

buf_size = 1;
/* Estimate length for: " * xx:xx:xx:xx:xx:xx\n" */
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];

rcu_read_lock();
__hlist_for_each_rcu(node, head)
buf_size += 29;
rcu_read_unlock();
}

buff = kmalloc(buf_size, GFP_ATOMIC);
if (!buff) {
ret = -ENOMEM;
goto out;
}

buff[0] = '\0';
pos = 0;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];

rcu_read_lock();
hlist_for_each_entry_rcu(tt_local_entry, node,
head, hash_entry) {
pos += snprintf(buff + pos, 30, " * %pM "
"[%c%c%c%c%c]\n",
seq_printf(seq, " * %pM [%c%c%c%c%c]\n",
tt_local_entry->addr,
(tt_local_entry->flags &
TT_CLIENT_ROAM ? 'R' : '.'),
Expand All @@ -380,9 +357,6 @@ int tt_local_seq_print_text(struct seq_file *seq, void *offset)
}
rcu_read_unlock();
}

seq_printf(seq, "%s", buff);
kfree(buff);
out:
if (primary_if)
hardif_free_ref(primary_if);
Expand Down Expand Up @@ -591,8 +565,6 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
struct hard_iface *primary_if;
struct hlist_node *node;
struct hlist_head *head;
size_t buf_size, pos;
char *buff;
uint32_t i;
int ret = 0;

Expand All @@ -617,35 +589,13 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
seq_printf(seq, " %-13s %s %-15s %s %s\n",
"Client", "(TTVN)", "Originator", "(Curr TTVN)", "Flags");

buf_size = 1;
/* Estimate length for: " * xx:xx:xx:xx:xx:xx (ttvn) via
* xx:xx:xx:xx:xx:xx (cur_ttvn)\n"*/
for (i = 0; i < hash->size; i++) {
head = &hash->table[i];

rcu_read_lock();
__hlist_for_each_rcu(node, head)
buf_size += 67;
rcu_read_unlock();
}

buff = kmalloc(buf_size, GFP_ATOMIC);
if (!buff) {
ret = -ENOMEM;
goto out;
}

buff[0] = '\0';
pos = 0;

for (i = 0; i < hash->size; i++) {
head = &hash->table[i];

rcu_read_lock();
hlist_for_each_entry_rcu(tt_global_entry, node,
head, hash_entry) {
pos += snprintf(buff + pos, 69,
" * %pM (%3u) via %pM (%3u) "
seq_printf(seq, " * %pM (%3u) via %pM (%3u) "
"[%c%c%c]\n", tt_global_entry->addr,
tt_global_entry->ttvn,
tt_global_entry->orig_node->orig,
Expand All @@ -661,9 +611,6 @@ int tt_global_seq_print_text(struct seq_file *seq, void *offset)
}
rcu_read_unlock();
}

seq_printf(seq, "%s", buff);
kfree(buff);
out:
if (primary_if)
hardif_free_ref(primary_if);
Expand Down

0 comments on commit 6cc522b

Please sign in to comment.