Add a cli option so that users won't have to byteswap u32 values when
they're digging through broken logs on little-endian systems. Also make
it more obvious which column is the offset and which are the byte(s).
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
while (j < nums) {
if ((j % 8) == 0)
- printf("%2x ", j);
- printf("%8x ", *dp);
+ printf("%2x: ", j);
+ printf("%08x ", print_host_endian ? be32_to_cpu(*dp) :
+ *dp);
dp++;
j++;
if ((j % 8) == 0)
int print_overwrite;
int print_no_data;
int print_no_print;
+int print_host_endian;
static int print_operation = OP_PRINT;
static struct libxfs_init x;
-d dump the log in log-record format\n\
-e exit when an error is found in the log\n\
-f specified device is actually a file\n\
+ -h print hex data in host-endian order\n\
-l <device> filename of external log\n\
-n don't try and interpret log data\n\
-o print buffer data in hex\n\
x.log.name = optarg;
x.log.isfile = 1;
break;
+ case 'h':
+ print_host_endian = 1;
+ break;
case 'i':
print_inode++;
break;
extern int print_overwrite;
extern int print_no_data;
extern int print_no_print;
+extern int print_host_endian;
/* exports */
extern time64_t xlog_extract_dinode_ts(const xfs_log_timestamp_t);
an ordinary file with
.BR xfs_copy (8).
.TP
+.B \-h
+Print u32 hex dump data in host-endian order.
+The default is to print without any endian decoding.
+.TP
.BI \-l " logdev"
External log device. Only for those filesystems which use an external log.
.TP