mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Fix zdb_dump_block on little endian systems
When dumping a block on a little endian system the data must be byte swapped to display correctly. Example incorrect output: $ echo 0123456789abcdef > aaa $ zdb -eR pp 3:1ee00:200 3:1ee00:200 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 000000: 3736353433323130 6665646362613938 0123456789abcdef 000010: 000000000000000a 0000000000000000 ................ Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4020
This commit is contained in:
parent
90aa094d6d
commit
a179a3aa35
@ -3212,6 +3212,10 @@ zdb_dump_block(char *label, void *buf, uint64_t size, int flags)
|
|||||||
|
|
||||||
(void) printf("\n%s\n%6s %s 0123456789abcdef\n", label, "", hdr);
|
(void) printf("\n%s\n%6s %s 0123456789abcdef\n", label, "", hdr);
|
||||||
|
|
||||||
|
#ifdef _LITTLE_ENDIAN
|
||||||
|
/* correct the endianess */
|
||||||
|
do_bswap = !do_bswap;
|
||||||
|
#endif
|
||||||
for (i = 0; i < nwords; i += 2) {
|
for (i = 0; i < nwords; i += 2) {
|
||||||
(void) printf("%06llx: %016llx %016llx ",
|
(void) printf("%06llx: %016llx %016llx ",
|
||||||
(u_longlong_t)(i * sizeof (uint64_t)),
|
(u_longlong_t)(i * sizeof (uint64_t)),
|
||||||
|
Loading…
Reference in New Issue
Block a user