From ac7648179c856750b719c7a9e0464466df390b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rob=20N=20=E2=98=85?= Date: Wed, 8 Feb 2023 08:48:22 +1100 Subject: [PATCH] zdb: zero-pad checksum output The leading zeroes are part of the checksum so we should show them. Reviewed-by: Richard Yao Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #14464 --- cmd/zdb/zdb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c index d6e3c58069..d239da6761 100644 --- a/cmd/zdb/zdb.c +++ b/cmd/zdb/zdb.c @@ -2377,7 +2377,8 @@ snprintf_blkptr_compact(char *blkbuf, size_t buflen, const blkptr_t *bp, (void) snprintf(blkbuf + strlen(blkbuf), buflen - strlen(blkbuf), " %s", "FREE"); (void) snprintf(blkbuf + strlen(blkbuf), - buflen - strlen(blkbuf), " cksum=%llx:%llx:%llx:%llx", + buflen - strlen(blkbuf), + " cksum=%016llx:%016llx:%016llx:%016llx", (u_longlong_t)bp->blk_cksum.zc_word[0], (u_longlong_t)bp->blk_cksum.zc_word[1], (u_longlong_t)bp->blk_cksum.zc_word[2], @@ -8383,7 +8384,9 @@ zdb_read_block(char *thing, spa_t *spa) DVA_GET_OFFSET(&bp->blk_dva[0]); ck_zio->io_bp = bp; zio_checksum_compute(ck_zio, ck, pabd, lsize); - printf("%12s\tcksum=%llx:%llx:%llx:%llx\n", + printf( + "%12s\t" + "cksum=%016llx:%016llx:%016llx:%016llx\n", zio_checksum_table[ck].ci_name, (u_longlong_t)bp->blk_cksum.zc_word[0], (u_longlong_t)bp->blk_cksum.zc_word[1],