]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
batman-adv: unify and properly print hex values
authorAntonio Quartulli <ordex@autistici.org>
Mon, 19 Nov 2012 08:01:43 +0000 (09:01 +0100)
committerAntonio Quartulli <ordex@autistici.org>
Sat, 12 Jan 2013 10:58:20 +0000 (20:58 +1000)
Values are printed in hexadecimal format in several points in the
code, but they are not printed using the same format string.

This patches unifies the format used for such numbers so that they
look the same everywhere.

Given the fact that all the variables printed as hexadecimal are 16
bit long, this is the chosen printing format: %#.4x

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/translation-table.c

index 7d02ebd11a7f1bd13b173cbe1eb0f54e623e0345..f2a364970f57a275a14918af11c2cf16417e4854 100644 (file)
@@ -1033,7 +1033,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr,
                is_single_hop_neigh = true;
 
        batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
-                  "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %u, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
+                  "Received BATMAN packet via NB: %pM, IF: %s [%pM] (from OG: %pM, via prev OG: %pM, seqno %u, ttvn %u, crc %#.4x, changes %u, td %d, TTL %d, V %d, IDF %d)\n",
                   ethhdr->h_source, if_incoming->net_dev->name,
                   if_incoming->net_dev->dev_addr, batadv_ogm_packet->orig,
                   batadv_ogm_packet->prev_sender,
index 5aebe9327d68c8fd691243f78880c12d69951611..ec12c79104ec4a3cb538a8ebeae0161c542a82ee 100644 (file)
@@ -661,12 +661,12 @@ static int batadv_handle_announce(struct batadv_priv *bat_priv,
        crc = ntohs(*((__be16 *)(&an_addr[4])));
 
        batadv_dbg(BATADV_DBG_BLA, bat_priv,
-                  "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %04x\n",
+                  "handle_announce(): ANNOUNCE vid %d (sent by %pM)... CRC = %#.4x\n",
                   vid, backbone_gw->orig, crc);
 
        if (backbone_gw->crc != crc) {
                batadv_dbg(BATADV_DBG_BLA, backbone_gw->bat_priv,
-                          "handle_announce(): CRC FAILED for %pM/%d (my = %04x, sent = %04x)\n",
+                          "handle_announce(): CRC FAILED for %pM/%d (my = %#.4x, sent = %#.4x)\n",
                           backbone_gw->orig, backbone_gw->vid,
                           backbone_gw->crc, crc);
 
@@ -835,7 +835,7 @@ static int batadv_check_claim_group(struct batadv_priv *bat_priv,
        /* if our mesh friends mac is bigger, use it for ourselves. */
        if (ntohs(bla_dst->group) > ntohs(bla_dst_own->group)) {
                batadv_dbg(BATADV_DBG_BLA, bat_priv,
-                          "taking other backbones claim group: %04x\n",
+                          "taking other backbones claim group: %#.4x\n",
                           ntohs(bla_dst->group));
                bla_dst_own->group = bla_dst->group;
        }
@@ -1626,10 +1626,10 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
 
        primary_addr = primary_if->net_dev->dev_addr;
        seq_printf(seq,
-                  "Claims announced for the mesh %s (orig %pM, group id %04x)\n",
+                  "Claims announced for the mesh %s (orig %pM, group id %#.4x)\n",
                   net_dev->name, primary_addr,
                   ntohs(bat_priv->bla.claim_dest.group));
-       seq_printf(seq, "   %-17s    %-5s    %-17s [o] (%-4s)\n",
+       seq_printf(seq, "   %-17s    %-5s    %-17s [o] (%-6s)\n",
                   "Client", "VID", "Originator", "CRC");
        for (i = 0; i < hash->size; i++) {
                head = &hash->table[i];
@@ -1638,7 +1638,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset)
                hlist_for_each_entry_rcu(claim, node, head, hash_entry) {
                        is_own = batadv_compare_eth(claim->backbone_gw->orig,
                                                    primary_addr);
-                       seq_printf(seq, " * %pM on % 5d by %pM [%c] (%04x)\n",
+                       seq_printf(seq, " * %pM on % 5d by %pM [%c] (%#.4x)\n",
                                   claim->addr, claim->vid,
                                   claim->backbone_gw->orig,
                                   (is_own ? 'x' : ' '),
@@ -1672,10 +1672,10 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
 
        primary_addr = primary_if->net_dev->dev_addr;
        seq_printf(seq,
-                  "Backbones announced for the mesh %s (orig %pM, group id %04x)\n",
+                  "Backbones announced for the mesh %s (orig %pM, group id %#.4x)\n",
                   net_dev->name, primary_addr,
                   ntohs(bat_priv->bla.claim_dest.group));
-       seq_printf(seq, "   %-17s    %-5s %-9s (%-4s)\n",
+       seq_printf(seq, "   %-17s    %-5s %-9s (%-6s)\n",
                   "Originator", "VID", "last seen", "CRC");
        for (i = 0; i < hash->size; i++) {
                head = &hash->table[i];
@@ -1693,7 +1693,7 @@ int batadv_bla_backbone_table_seq_print_text(struct seq_file *seq, void *offset)
                                continue;
 
                        seq_printf(seq,
-                                  " * %pM on % 5d % 4i.%03is (%04x)\n",
+                                  " * %pM on % 5d % 4i.%03is (%#.4x)\n",
                                   backbone_gw->orig, backbone_gw->vid,
                                   secs, msecs, backbone_gw->crc);
                }
index 408807eb9df34a42362285c432213927309e6e0f..40ef9557288ae6638129deeb9e805975f3be855e 100644 (file)
@@ -2518,7 +2518,7 @@ void batadv_tt_update_orig(struct batadv_priv *bat_priv,
                    orig_node->tt_crc != tt_crc) {
 request_table:
                        batadv_dbg(BATADV_DBG_TT, bat_priv,
-                                  "TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %u last_crc: %u num_changes: %u)\n",
+                                  "TT inconsistency for %pM. Need to retrieve the correct information (ttvn: %u last_ttvn: %u crc: %#.4x last_crc: %#.4x num_changes: %u)\n",
                                   orig_node->orig, ttvn, orig_ttvn, tt_crc,
                                   orig_node->tt_crc, tt_num_changes);
                        batadv_send_tt_request(bat_priv, orig_node, ttvn,