Commit 1db6c18e authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

log/fdump: fix alignment of the last printed line



Our log_ut currently dumps two buffers which end up being
printed with a different column alignment.

`00000000  6c 6f 67 20 64 75 6d 70                           log dump`
vs
`00000000  73 70 64 6b 20 64 75 6d  70                        spdk dump`

In short dumps (len % 16 < 8) we didn't include the extra
arbitrary whitespace between the 8-byte parts.

Change-Id: I00bf1d334f71370922d939c4397a479f8d707112
Signed-off-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452058


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent fb7dbc1c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -174,6 +174,11 @@ fdump(FILE *fp, const char *label, const uint8_t *buf, size_t len)
		buf16[idx % 16] = isprint(buf[idx]) ? buf[idx] : '.';
	}
	for (; idx % 16 != 0; idx++) {
		if (idx == 8) {
			total += snprintf(tmpbuf + total, sizeof tmpbuf - total,
					  " ");
		}

		total += snprintf(tmpbuf + total, sizeof tmpbuf - total, "   ");
		buf16[idx % 16] = ' ';
	}