On Wed, Oct 23, 2013 at 10:00:30AM -0700, Joe Perches wrote:
On Wed, 2013-10-23 at 18:04 +0200, Antonio Quartulli wrote:
Each routing protocol has its own metric and private variables, therefore it is useful to introduce a new API for originator information printing.
This API needs to be implemented by each protocol in order to provide its specific originator table output.
[]
+static void batadv_iv_ogm_orig_print(struct batadv_priv *bat_priv,
struct seq_file *seq)
[]
- seq_printf(seq, " %-15s %s (%s/%i) %17s [%10s]: %20s ...\n",
"Originator", "last-seen", "#", BATADV_TQ_MAX_VALUE,
"Nexthop", "outgoingIF", "Potential nexthops");
This header printf really doesn't add much with the formatting sizes. It's pretty obscure why some of these are sized and others not sized. For instance: %-15s doesn't refer to a mac address size. Perhaps it'd be better to just emit the fixed string just using BATADV_TO_MAX_VALUE. It'd also be easier to find via grep.
This string is printed out of a debugfs file and follows a format that we have been using for long time (this patch is just moving this code from one point to another).
I didn't get what you mean with BATADV_TO_MAX_VALUE (maybe you meant BATADV_TQ_MAX_VALUE? but even in this case I don't get it).
The sized parameters in the format string are such that this header is correctly aligned with the entries of the table that follow. Moreover we tried to keep this table human readable as much as possible.
Here you have an example of what we get (this output is not printed with exactly that format string because it belongs to an older batman-adv version)
[B.A.T.M.A.N. adv 2013.3.0, MainIF/MAC: mesh0/xx:xx:xx:xx:xx:xx (bat0)] Originator last-seen (#/255) Nexthop [outgoingIF]: Potential nexthops ... yyyy 4.720s (247) yyyy [ mesh0]: aaaaa (221) bbbbbb (200) aaaaa 4.270s (237) ddddd [ mesh0]: aaaa (195) vvvvvv (215) bbbbbb 4.480s (248) cccccc [ mesh0]: bbbb (213) cccccc (200) ccccc 0.480s (255) bbbbb [ mesh0]: cccc (217) dddddd (190) dddddd 1.050s (223) dddddd [ mesh0]: dddddd (191) eeee (203)
If the width of your terminal is adequate you get a nice table which is rather helpful for debugging purposes.
Regards,