From ad4bc3352285f467f4ffa03c3171b19fa0a8758d Mon Sep 17 00:00:00 2001 From: Filipe Brandenburger Date: Tue, 26 Jun 2018 09:43:49 -0700 Subject: [PATCH] sleep: fix printf format of fiemap fields Use PRIu64 and PRIu32 constants to also get the format right on LP-64 architectures. For the 64-bit fields, we need a cast to (uint64_t), since __u64 is defined as a `long long unsigned` and PRIu64 expects a `long unsigned`. In practice, both are the same, so the cast should be OK. --- src/test/test-sleep.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/test-sleep.c b/src/test/test-sleep.c index 5286442e268..acfcf6a630b 100644 --- a/src/test/test-sleep.c +++ b/src/test/test-sleep.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ +#include #include #include @@ -32,11 +33,11 @@ static int test_fiemap(const char *path) { if (r < 0) return log_error_errno(r, "Unable to read extent map for '%s': %m", path); log_info("extent map information for %s:", path); - log_info("\t start: %llu", fiemap->fm_start); - log_info("\t length: %llu", fiemap->fm_length); - log_info("\t flags: %u", fiemap->fm_flags); - log_info("\t number of mapped extents: %u", fiemap->fm_mapped_extents); - log_info("\t extent count: %u", fiemap->fm_extent_count); + log_info("\t start: %" PRIu64, (uint64_t) fiemap->fm_start); + log_info("\t length: %" PRIu64, (uint64_t) fiemap->fm_length); + log_info("\t flags: %" PRIu32, fiemap->fm_flags); + log_info("\t number of mapped extents: %" PRIu32, fiemap->fm_mapped_extents); + log_info("\t extent count: %" PRIu32, fiemap->fm_extent_count); if (fiemap->fm_extent_count > 0) log_info("\t first extent location: %llu", fiemap->fm_extents[0].fe_physical / page_size()); -- 2.39.2