Re: [PATCH 1/3] hexdump: more output formatting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/05/07, Randy Dunlap <[email protected]> wrote:
From: Randy Dunlap <[email protected]>


Some friendly nitpicking below :-)

Add a prefix string parameter.  Callers are responsible for any
string length/alignment that they want to see in the output.  I.e.,
callers should pad strings to achieve alignment if they want that.

Add rowsize parameter.  This is the number of raw data bytes
to be printed per line.  Must be 16 or 32.

Add a group_size parameter.  This allows callers to dump values

One is called "rowsize" the other "group_size". How about consistent
naming; either "row_size" and "group_size" or "rowsize" and
"groupsize" ?

as 1-byte, 2-byte, 4-byte, or 8-byte numbers.  Default is
1-byte numbers.  If the total length is not an even multiple
of group_size, 1-byte numbers are printed.

Add an "ascii" output parameter.  This causes ASCII data output
following the hex data output.

Clean up some doc examples.

Signed-off-by: Randy Dunlap <[email protected]>
---
[snip]
+
+       switch (group_size) {
+       case 8: {
+               const u64 *ptr8 = buf;
+               int ngroups = len / group_size;
+
+               for (j = 0; j < ngroups; j++)
+                       lx += scnprintf(linebuf + lx, linebuflen - lx,
+                               "%16.16llx ", (unsigned long long)*(ptr8 + j));
+               break;
+       }
+

I don't see the point in this (and the other) extra blank lines
between closing brace of one case and the start of the next. Removing
the blank line wouldn't hurt readability but would allow more lines of
code to be visible on the screen at once.

+       case 4: {

[snip]


Apart from those nits, nice patch, nice improvement.


--
Jesper Juhl <[email protected]>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux