ref: 4b53a65e1ad2d404253b641fd857f533203fa519
parent: e69f4b3ad8c1b56035b669e10072054ae2939695
author: gkostka <[email protected]>
date: Tue Dec 8 15:32:15 EST 2015
ext4_mbr: improve printf formatting
--- a/fs_test/lwext4_mbr.c
+++ b/fs_test/lwext4_mbr.c
@@ -170,10 +170,10 @@
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));
}
--- a/lwext4/ext4_mbr.c
+++ b/lwext4/ext4_mbr.c
@@ -39,6 +39,7 @@
#include "ext4_debug.h"
#include "ext4_mbr.h"
+#include <inttypes.h>
#include <string.h>
#define MBR_SIGNATURE 0xAA55
@@ -90,20 +91,20 @@
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: