lib/log: do not put trailing whitespace in fdump

fdump puts out buffer in following format:
"00000000  76 61 6c 00                                        val.            "

Each buffer is displayed with hex values up to maximum, then
followed up with a value. This is done to keep starting value
with the same alignment between each consecutive line.
Value contents should end at its length instead of
adding trailing whitespace.

After this patch, output is changed to:
"00000000  76 61 6c 00                                        val."

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I26b327e83f296ba3865f1a337f4a70764a80e2b0
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483706
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-01-28 08:39:20 -05:00 committed by Jim Harris
parent 2d687618f3
commit 16cc6464db
2 changed files with 0 additions and 4 deletions

View File

@ -199,7 +199,6 @@ fdump(FILE *fp, const char *label, const uint8_t *buf, size_t len)
}
total += snprintf(tmpbuf + total, sizeof tmpbuf - total, " ");
buf16[idx % 16] = ' ';
}
snprintf(tmpbuf + total, sizeof tmpbuf - total, " %s", buf16);
fprintf(fp, "%s\n", tmpbuf);

View File

@ -19,9 +19,6 @@ dd if=/dev/urandom of=$testdir/test.pattern bs=1M count=1
(cd $testdir &&
$rootdir/examples/blob/cli/blobcli -c $testdir/blobcli.conf -b Nvme0n1 -T $testdir/test.bs > $testdir/btest.out)
# the tool leaves some trailing whitespaces that we need to strip out
sed -i 's/[[:space:]]*$//' $testdir/btest.out
# the test script will import the test pattern generated by dd and then export
# it to a file so we can compare and confirm basic read and write
$rootdir/test/app/match/match -v $testdir/btest.out.match