ext4_utils: fix build for 64 bit

Correct u64/s64 definitions
Use PRIu64 to print u64

Change-Id: Icaf7998946b0a2faa03495b404af8b94e4e3d047
diff --git a/ext4_utils/ext2simg.c b/ext4_utils/ext2simg.c
index 77c3650..1531f0b 100644
--- a/ext4_utils/ext2simg.c
+++ b/ext4_utils/ext2simg.c
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 #include <sys/mman.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <libgen.h>
 #include <unistd.h>
 
@@ -86,13 +87,13 @@
 
 	if (verbose) {
 		printf("Found filesystem with parameters:\n");
-		printf("    Size: %llu\n", info.len);
+		printf("    Size: %"PRIu64"\n", info.len);
 		printf("    Block size: %d\n", info.block_size);
 		printf("    Blocks per group: %d\n", info.blocks_per_group);
 		printf("    Inodes per group: %d\n", info.inodes_per_group);
 		printf("    Inode size: %d\n", info.inode_size);
 		printf("    Label: %s\n", info.label);
-		printf("    Blocks: %llu\n", aux_info.len_blocks);
+		printf("    Blocks: %"PRIu64"\n", aux_info.len_blocks);
 		printf("    Block groups: %d\n", aux_info.groups);
 		printf("    Reserved block group size: %d\n", info.bg_desc_reserve_blocks);
 		printf("    Used %d/%d inodes and %d/%d blocks\n",
diff --git a/ext4_utils/ext4_utils.h b/ext4_utils/ext4_utils.h
index 9b5b7c4..447d416 100644
--- a/ext4_utils/ext4_utils.h
+++ b/ext4_utils/ext4_utils.h
@@ -70,8 +70,13 @@
 #define le32_to_cpu(x) (x)
 #define le16_to_cpu(x) (x)
 
+#ifdef __LP64__
+typedef unsigned long u64;
+typedef signed long s64;
+#else
 typedef unsigned long long u64;
 typedef signed long long s64;
+#endif
 typedef unsigned int u32;
 typedef unsigned short int u16;
 typedef unsigned char u8;
diff --git a/ext4_utils/ext4fixup.c b/ext4_utils/ext4fixup.c
index 7cf1f0e..7beeefb 100644
--- a/ext4_utils/ext4fixup.c
+++ b/ext4_utils/ext4fixup.c
@@ -25,6 +25,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <unistd.h>
 
 #ifndef USE_MINGW
@@ -235,13 +236,13 @@
 
     if (verbose) {
         printf("Found filesystem with parameters:\n");
-        printf("    Size: %llu\n", info.len);
+        printf("    Size: %"PRIu64"\n", info.len);
         printf("    Block size: %d\n", info.block_size);
         printf("    Blocks per group: %d\n", info.blocks_per_group);
         printf("    Inodes per group: %d\n", info.inodes_per_group);
         printf("    Inode size: %d\n", info.inode_size);
         printf("    Label: %s\n", info.label);
-        printf("    Blocks: %llu\n", aux_info.len_blocks);
+        printf("    Blocks: %"PRIu64"\n", aux_info.len_blocks);
         printf("    Block groups: %d\n", aux_info.groups);
         printf("    Reserved block group size: %d\n", info.bg_desc_reserve_blocks);
         printf("    Used %d/%d inodes and %d/%d blocks\n",
diff --git a/ext4_utils/extent.c b/ext4_utils/extent.c
index aeff0f6..abb30ce 100644
--- a/ext4_utils/extent.c
+++ b/ext4_utils/extent.c
@@ -19,6 +19,7 @@
 
 #include <sparse/sparse.h>
 
+#include <inttypes.h>
 #include <stdlib.h>
 #include <stdio.h>
 
@@ -128,7 +129,7 @@
 
 		if (((int)(info.block_size - sizeof(struct ext4_extent_header) /
 				sizeof(struct ext4_extent))) < allocation_len) {
-			error("File size %llu is too big to fit in a single extent block\n",
+			error("File size %"PRIu64" is too big to fit in a single extent block\n",
 					len);
 			return NULL;
 		}
@@ -184,14 +185,14 @@
 
 	alloc = do_inode_allocate_extents(inode, len);
 	if (alloc == NULL) {
-		error("failed to allocate extents for %llu bytes", len);
+		error("failed to allocate extents for %"PRIu64" bytes", len);
 		return NULL;
 	}
 
 	if (backing_len) {
 		data = extent_create_backing(alloc, backing_len);
 		if (!data)
-			error("failed to create backing for %llu bytes", backing_len);
+			error("failed to create backing for %"PRIu64" bytes", backing_len);
 	}
 
 	free_alloc(alloc);
@@ -208,7 +209,7 @@
 
 	alloc = do_inode_allocate_extents(inode, len);
 	if (alloc == NULL) {
-		error("failed to allocate extents for %llu bytes", len);
+		error("failed to allocate extents for %"PRIu64" bytes", len);
 		return;
 	}
 
@@ -224,7 +225,7 @@
 
 	alloc = do_inode_allocate_extents(inode, len);
 	if (alloc == NULL) {
-		error("failed to allocate extents for %llu bytes", len);
+		error("failed to allocate extents for %"PRIu64" bytes", len);
 		return;
 	}
 
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 2250241..0cb5bae 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -26,6 +26,7 @@
 #include <assert.h>
 #include <dirent.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <libgen.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -531,7 +532,7 @@
 	info.bg_desc_reserve_blocks = compute_bg_desc_reserve_blocks();
 
 	printf("Creating filesystem with parameters:\n");
-	printf("    Size: %llu\n", info.len);
+	printf("    Size: %"PRIu64"\n", info.len);
 	printf("    Block size: %d\n", info.block_size);
 	printf("    Blocks per group: %d\n", info.blocks_per_group);
 	printf("    Inodes per group: %d\n", info.inodes_per_group);
@@ -541,7 +542,7 @@
 
 	ext4_create_fs_aux_info();
 
-	printf("    Blocks: %llu\n", aux_info.len_blocks);
+	printf("    Blocks: %"PRIu64"\n", aux_info.len_blocks);
 	printf("    Block groups: %d\n", aux_info.groups);
 	printf("    Reserved block group size: %d\n", info.bg_desc_reserve_blocks);