From 4b53a65e1ad2d404253b641fd857f533203fa519 Mon Sep 17 00:00:00 2001 From: gkostka Date: Tue, 8 Dec 2015 20:32:15 +0100 Subject: [PATCH] ext4_mbr: improve printf formatting --- fs_test/lwext4_mbr.c | 4 ++-- lwext4/ext4_mbr.c | 13 +++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/fs_test/lwext4_mbr.c b/fs_test/lwext4_mbr.c index dbf5d81..8c37c09 100644 --- a/fs_test/lwext4_mbr.c +++ b/fs_test/lwext4_mbr.c @@ -170,10 +170,10 @@ int main(int argc, char **argv) continue; } - printf("\toffeset: 0x%llx, %lluMB\n", + printf("\toffeset: 0x%"PRIx64", %"PRIu64"MB\n", bdevs.partitions[i].part_offset, bdevs.partitions[i].part_offset / (1024 * 1024)); - printf("\tsize: 0x%llx, %lluMB\n", + printf("\tsize: 0x%"PRIx64", %"PRIu64"MB\n", bdevs.partitions[i].part_size, bdevs.partitions[i].part_size / (1024 * 1024)); } diff --git a/lwext4/ext4_mbr.c b/lwext4/ext4_mbr.c index e394ab2..cd2fa51 100644 --- a/lwext4/ext4_mbr.c +++ b/lwext4/ext4_mbr.c @@ -39,6 +39,7 @@ #include "ext4_debug.h" #include "ext4_mbr.h" +#include #include #define MBR_SIGNATURE 0xAA55 @@ -90,20 +91,20 @@ int ext4_mbr_scan(struct ext4_blockdev *parent, struct ext4_mbr_bdevs *bdevs) ext4_dbg(DEBUG_MBR, "mbr_part: %d\n", i); ext4_dbg(DEBUG_MBR, "\tstatus: 0x%x\n", pe->status); ext4_dbg(DEBUG_MBR, "\ttype 0x%x:\n", pe->type); - ext4_dbg(DEBUG_MBR, "\tfirst_lba: 0x%x\n", pe->first_lba); - ext4_dbg(DEBUG_MBR, "\tsectors: 0x%x\n", pe->sectors); + ext4_dbg(DEBUG_MBR, "\tfirst_lba: 0x%"PRIx32"\n", pe->first_lba); + ext4_dbg(DEBUG_MBR, "\tsectors: 0x%"PRIx32"\n", pe->sectors); if (!pe->sectors) - continue; + continue; /*Empty entry*/ if (pe->type != 0x83) - continue; + continue; /*Unsupported entry. 0x83 - linux native*/ bdevs->partitions[i].bdif = parent->bdif; bdevs->partitions[i].part_offset = - pe->first_lba * parent->bdif->ph_bsize; + (uint64_t)pe->first_lba * parent->bdif->ph_bsize; bdevs->partitions[i].part_size = - (uint64_t)pe->sectors * parent->bdif->ph_bsize; + (uint64_t)pe->sectors * parent->bdif->ph_bsize; } blockdev_fini: