Changed off_t to loff_t

- off_t is long, loff_t is long long (32bit vs. 64bit)
- exfat requites 64 bit to support larger than 2GB fs

Change-Id: I70293e45d7d6686317edc759092e738a2ebdd860
diff --git a/exfat/dump/main.c b/exfat/dump/main.c
index b6e0409..3ed3d8f 100644
--- a/exfat/dump/main.c
+++ b/exfat/dump/main.c
@@ -106,7 +106,7 @@
 
 static void dump_sectors(struct exfat* ef)
 {
-	off_t a = 0, b = 0;
+	loff_t a = 0, b = 0;
 
 	printf("Used sectors ");
 	while (exfat_find_used_sectors(ef, &a, &b) == 0)
diff --git a/exfat/fuse/main.c b/exfat/fuse/main.c
index aad082b..30958f6 100644
--- a/exfat/fuse/main.c
+++ b/exfat/fuse/main.c
@@ -74,7 +74,7 @@
 	return 0;
 }
 
-static int fuse_exfat_truncate(const char* path, off_t size)
+static int fuse_exfat_truncate(const char* path, loff_t size)
 {
 	struct exfat_node* node;
 	int rc;
@@ -98,7 +98,7 @@
 }
 
 static int fuse_exfat_readdir(const char* path, void* buffer,
-		fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* fi)
+		fuse_fill_dir_t filler, loff_t offset, struct fuse_file_info* fi)
 {
 	struct exfat_node* parent;
 	struct exfat_node* node;
@@ -216,7 +216,7 @@
 }
 
 static int fuse_exfat_read(const char* path, char* buffer, size_t size,
-		off_t offset, struct fuse_file_info* fi)
+		loff_t offset, struct fuse_file_info* fi)
 {
 	ssize_t ret;
 
@@ -228,7 +228,7 @@
 }
 
 static int fuse_exfat_write(const char* path, const char* buffer, size_t size,
-		off_t offset, struct fuse_file_info* fi)
+		loff_t offset, struct fuse_file_info* fi)
 {
 	ssize_t ret;
 
diff --git a/exfat/libexfat/cluster.c b/exfat/libexfat/cluster.c
index fc3657b..394ca4a 100644
--- a/exfat/libexfat/cluster.c
+++ b/exfat/libexfat/cluster.c
@@ -28,7 +28,7 @@
 /*
  * Sector to absolute offset.
  */
-static off_t s2o(const struct exfat* ef, off_t sector)
+static loff_t s2o(const struct exfat* ef, loff_t sector)
 {
 	return sector << ef->sb->sector_bits;
 }
@@ -36,18 +36,18 @@
 /*
  * Cluster to sector.
  */
-static off_t c2s(const struct exfat* ef, cluster_t cluster)
+static loff_t c2s(const struct exfat* ef, cluster_t cluster)
 {
 	if (cluster < EXFAT_FIRST_DATA_CLUSTER)
 		exfat_bug("invalid cluster number %u", cluster);
 	return le32_to_cpu(ef->sb->cluster_sector_start) +
-		((off_t) (cluster - EXFAT_FIRST_DATA_CLUSTER) << ef->sb->spc_bits);
+		((loff_t) (cluster - EXFAT_FIRST_DATA_CLUSTER) << ef->sb->spc_bits);
 }
 
 /*
  * Cluster to absolute offset.
  */
-off_t exfat_c2o(const struct exfat* ef, cluster_t cluster)
+loff_t exfat_c2o(const struct exfat* ef, cluster_t cluster)
 {
 	return s2o(ef, c2s(ef, cluster));
 }
@@ -55,7 +55,7 @@
 /*
  * Sector to cluster.
  */
-static cluster_t s2c(const struct exfat* ef, off_t sector)
+static cluster_t s2c(const struct exfat* ef, loff_t sector)
 {
 	return ((sector - le32_to_cpu(ef->sb->cluster_sector_start)) >>
 			ef->sb->spc_bits) + EXFAT_FIRST_DATA_CLUSTER;
@@ -74,7 +74,7 @@
 		const struct exfat_node* node, cluster_t cluster)
 {
 	le32_t next;
-	off_t fat_offset;
+	loff_t fat_offset;
 
 	if (cluster < EXFAT_FIRST_DATA_CLUSTER)
 		exfat_bug("bad cluster 0x%x", cluster);
@@ -174,7 +174,7 @@
 static bool set_next_cluster(const struct exfat* ef, bool contiguous,
 		cluster_t current, cluster_t next)
 {
-	off_t fat_offset;
+	loff_t fat_offset;
 	le32_t next_le32;
 
 	if (contiguous)
@@ -359,7 +359,7 @@
 	return 0;
 }
 
-static bool erase_raw(struct exfat* ef, size_t size, off_t offset)
+static bool erase_raw(struct exfat* ef, size_t size, loff_t offset)
 {
 	if (exfat_pwrite(ef->dev, ef->zero_cluster, size, offset) < 0)
 	{
@@ -472,7 +472,7 @@
 	return 0;
 }
 
-int exfat_find_used_sectors(const struct exfat* ef, off_t* a, off_t* b)
+int exfat_find_used_sectors(const struct exfat* ef, loff_t* a, loff_t* b)
 {
 	cluster_t ca, cb;
 
diff --git a/exfat/libexfat/exfat.h b/exfat/libexfat/exfat.h
index 5beba7c..009a0c0 100644
--- a/exfat/libexfat/exfat.h
+++ b/exfat/libexfat/exfat.h
@@ -66,8 +66,8 @@
 	((bitmap)[BMAP_BLOCK(index)] &= ~BMAP_MASK(index))
 
 /* The size of off_t type must be 64 bits. File systems larger than 2 GB will
-   be corrupted with 32-bit off_t. */
-STATIC_ASSERT(sizeof(off_t) == 8);
+   be corrupted with 32-bit off_t. So, we use loff_t here.*/
+STATIC_ASSERT(sizeof(loff_t) == 8);
 
 struct exfat_node
 {
@@ -80,7 +80,7 @@
 	uint32_t fptr_index;
 	cluster_t fptr_cluster;
 	cluster_t entry_cluster;
-	off_t entry_offset;
+	loff_t entry_offset;
 	cluster_t start_cluster;
 	int flags;
 	uint64_t size;
@@ -146,18 +146,18 @@
 int exfat_close(struct exfat_dev* dev);
 int exfat_fsync(struct exfat_dev* dev);
 enum exfat_mode exfat_get_mode(const struct exfat_dev* dev);
-off_t exfat_get_size(const struct exfat_dev* dev);
-off_t exfat_seek(struct exfat_dev* dev, off_t offset, int whence);
+loff_t exfat_get_size(const struct exfat_dev* dev);
+loff_t exfat_seek(struct exfat_dev* dev, loff_t offset, int whence);
 ssize_t exfat_read(struct exfat_dev* dev, void* buffer, size_t size);
 ssize_t exfat_write(struct exfat_dev* dev, const void* buffer, size_t size);
 ssize_t exfat_pread(struct exfat_dev* dev, void* buffer, size_t size,
-		off_t offset);
+		loff_t offset);
 ssize_t exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
-		off_t offset);
+		loff_t offset);
 ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
-		void* buffer, size_t size, off_t offset);
+		void* buffer, size_t size, loff_t offset);
 ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
-		const void* buffer, size_t size, off_t offset);
+		const void* buffer, size_t size, loff_t offset);
 
 int exfat_opendir(struct exfat* ef, struct exfat_node* dir,
 		struct exfat_iterator* it);
@@ -168,7 +168,7 @@
 int exfat_split(struct exfat* ef, struct exfat_node** parent,
 		struct exfat_node** node, le16_t* name, const char* path);
 
-off_t exfat_c2o(const struct exfat* ef, cluster_t cluster);
+loff_t exfat_c2o(const struct exfat* ef, cluster_t cluster);
 cluster_t exfat_next_cluster(const struct exfat* ef,
 		const struct exfat_node* node, cluster_t cluster);
 cluster_t exfat_advance_cluster(const struct exfat* ef,
@@ -178,7 +178,7 @@
 int exfat_truncate(struct exfat* ef, struct exfat_node* node, uint64_t size,
 		bool erase);
 uint32_t exfat_count_free_clusters(const struct exfat* ef);
-int exfat_find_used_sectors(const struct exfat* ef, off_t* a, off_t* b);
+int exfat_find_used_sectors(const struct exfat* ef, loff_t* a, loff_t* b);
 
 void exfat_stat(const struct exfat* ef, const struct exfat_node* node,
 		struct stat* stbuf);
diff --git a/exfat/libexfat/io.c b/exfat/libexfat/io.c
index 3d7aaad..3c3bd27 100644
--- a/exfat/libexfat/io.c
+++ b/exfat/libexfat/io.c
@@ -46,9 +46,9 @@
 {
 	int fd;
 	enum exfat_mode mode;
-	off_t size; /* in bytes */
+	loff_t size; /* in bytes */
 #ifdef USE_UBLIO
-	off_t pos;
+	loff_t pos;
 	ublio_filehandle_t ufh;
 #endif
 };
@@ -287,12 +287,12 @@
 	return dev->mode;
 }
 
-off_t exfat_get_size(const struct exfat_dev* dev)
+loff_t exfat_get_size(const struct exfat_dev* dev)
 {
 	return dev->size;
 }
 
-off_t exfat_seek(struct exfat_dev* dev, off_t offset, int whence)
+loff_t exfat_seek(struct exfat_dev* dev, loff_t offset, int whence)
 {
 #ifdef USE_UBLIO
 	/* XXX SEEK_CUR will be handled incorrectly */
@@ -327,7 +327,7 @@
 }
 
 ssize_t exfat_pread(struct exfat_dev* dev, void* buffer, size_t size,
-		off_t offset)
+		loff_t offset)
 {
 #ifdef USE_UBLIO
 	return ublio_pread(dev->ufh, buffer, size, offset);
@@ -337,7 +337,7 @@
 }
 
 ssize_t exfat_pwrite(struct exfat_dev* dev, const void* buffer, size_t size,
-		off_t offset)
+		loff_t offset)
 {
 #ifdef USE_UBLIO
 	return ublio_pwrite(dev->ufh, buffer, size, offset);
@@ -347,11 +347,11 @@
 }
 
 ssize_t exfat_generic_pread(const struct exfat* ef, struct exfat_node* node,
-		void* buffer, size_t size, off_t offset)
+		void* buffer, size_t size, loff_t offset)
 {
 	cluster_t cluster;
 	char* bufp = buffer;
-	off_t lsize, loffset, remainder;
+	loff_t lsize, loffset, remainder;
 
 	if (offset >= node->size)
 		return 0;
@@ -392,11 +392,11 @@
 }
 
 ssize_t exfat_generic_pwrite(struct exfat* ef, struct exfat_node* node,
-		const void* buffer, size_t size, off_t offset)
+		const void* buffer, size_t size, loff_t offset)
 {
 	cluster_t cluster;
 	const char* bufp = buffer;
-	off_t lsize, loffset, remainder;
+	loff_t lsize, loffset, remainder;
 
  	if (offset > node->size)
  		if (exfat_truncate(ef, node, offset, true) != 0)
diff --git a/exfat/libexfat/mount.c b/exfat/libexfat/mount.c
index 0d6ce9e..45a5d49 100644
--- a/exfat/libexfat/mount.c
+++ b/exfat/libexfat/mount.c
@@ -106,7 +106,7 @@
 }
 
 static bool verify_vbr_checksum(struct exfat_dev* dev, void* sector,
-		off_t sector_size)
+		loff_t sector_size)
 {
 	uint32_t vbr_checksum;
 	int i;
diff --git a/exfat/libexfat/node.c b/exfat/libexfat/node.c
index d05f20d..e4fd32f 100644
--- a/exfat/libexfat/node.c
+++ b/exfat/libexfat/node.c
@@ -29,7 +29,7 @@
 struct iterator
 {
 	cluster_t cluster;
-	off_t offset;
+	loff_t offset;
 	int contiguous;
 	char* chunk;
 };
@@ -87,7 +87,7 @@
 /**
  * Cluster + offset from the beginning of the directory to absolute offset.
  */
-static off_t co2o(struct exfat* ef, cluster_t cluster, off_t offset)
+static loff_t co2o(struct exfat* ef, cluster_t cluster, loff_t offset)
 {
 	return exfat_c2o(ef, cluster) + offset % CLUSTER_SIZE(*ef->sb);
 }
@@ -584,7 +584,7 @@
 }
 
 static bool next_entry(struct exfat* ef, const struct exfat_node* parent,
-		cluster_t* cluster, off_t* offset)
+		cluster_t* cluster, loff_t* offset)
 {
 	*offset += sizeof(struct exfat_entry);
 	if (*offset % CLUSTER_SIZE(*ef->sb) == 0)
@@ -603,8 +603,8 @@
 int exfat_flush_node(struct exfat* ef, struct exfat_node* node)
 {
 	cluster_t cluster;
-	off_t offset;
-	off_t meta1_offset, meta2_offset;
+	loff_t offset;
+	loff_t meta1_offset, meta2_offset;
 	struct exfat_entry_meta1 meta1;
 	struct exfat_entry_meta2 meta2;
 
@@ -670,7 +670,7 @@
 static bool erase_entry(struct exfat* ef, struct exfat_node* node)
 {
 	cluster_t cluster = node->entry_cluster;
-	off_t offset = node->entry_offset;
+	loff_t offset = node->entry_offset;
 	int name_entries = DIV_ROUND_UP(utf16_length(node->name), EXFAT_ENAME_MAX);
 	uint8_t entry_type;
 
@@ -706,7 +706,7 @@
 }
 
 static int shrink_directory(struct exfat* ef, struct exfat_node* dir,
-		off_t deleted_offset)
+		loff_t deleted_offset)
 {
 	const struct exfat_node* node;
 	const struct exfat_node* last_node;
@@ -753,7 +753,7 @@
 static int delete(struct exfat* ef, struct exfat_node* node)
 {
 	struct exfat_node* parent = node->parent;
-	off_t deleted_offset = node->entry_offset;
+	loff_t deleted_offset = node->entry_offset;
 	int rc;
 
 	exfat_get_node(parent);
@@ -808,7 +808,7 @@
 }
 
 static int find_slot(struct exfat* ef, struct exfat_node* dir,
-		cluster_t* cluster, off_t* offset, int subentries)
+		cluster_t* cluster, loff_t* offset, int subentries)
 {
 	struct iterator it;
 	int rc;
@@ -853,7 +853,7 @@
 }
 
 static int write_entry(struct exfat* ef, struct exfat_node* dir,
-		const le16_t* name, cluster_t cluster, off_t offset, uint16_t attrib)
+		const le16_t* name, cluster_t cluster, loff_t offset, uint16_t attrib)
 {
 	struct exfat_node* node;
 	struct exfat_entry_meta1 meta1;
@@ -931,7 +931,7 @@
 	struct exfat_node* dir;
 	struct exfat_node* existing;
 	cluster_t cluster = EXFAT_CLUSTER_BAD;
-	off_t offset = -1;
+	loff_t offset = -1;
 	le16_t name[EXFAT_NAME_MAX + 1];
 	int rc;
 
@@ -1000,12 +1000,12 @@
 
 static int rename_entry(struct exfat* ef, struct exfat_node* dir,
 		struct exfat_node* node, const le16_t* name, cluster_t new_cluster,
-		off_t new_offset)
+		loff_t new_offset)
 {
 	struct exfat_entry_meta1 meta1;
 	struct exfat_entry_meta2 meta2;
 	cluster_t old_cluster = node->entry_cluster;
-	off_t old_offset = node->entry_offset;
+	loff_t old_offset = node->entry_offset;
 	const size_t name_length = utf16_length(name);
 	const int name_entries = DIV_ROUND_UP(name_length, EXFAT_ENAME_MAX);
 	int i;
@@ -1077,7 +1077,7 @@
 	struct exfat_node* existing;
 	struct exfat_node* dir;
 	cluster_t cluster = EXFAT_CLUSTER_BAD;
-	off_t offset = -1;
+	loff_t offset = -1;
 	le16_t name[EXFAT_NAME_MAX + 1];
 	int rc;
 
@@ -1177,7 +1177,7 @@
 	return ef->label;
 }
 
-static int find_label(struct exfat* ef, cluster_t* cluster, off_t* offset)
+static int find_label(struct exfat* ef, cluster_t* cluster, loff_t* offset)
 {
 	struct iterator it;
 	int rc;
@@ -1215,7 +1215,7 @@
 	le16_t label_utf16[EXFAT_ENAME_MAX + 1];
 	int rc;
 	cluster_t cluster;
-	off_t offset;
+	loff_t offset;
 	struct exfat_entry_label entry;
 
 	memset(label_utf16, 0, sizeof(label_utf16));
diff --git a/exfat/libexfat/utils.c b/exfat/libexfat/utils.c
index 388f360..39d708e 100644
--- a/exfat/libexfat/utils.c
+++ b/exfat/libexfat/utils.c
@@ -161,8 +161,8 @@
 		uint32_t free_clusters)
 {
 	struct exfat_human_bytes hb;
-	off_t total_space = le64_to_cpu(sb->sector_count) * SECTOR_SIZE(*sb);
-	off_t avail_space = (off_t) free_clusters * CLUSTER_SIZE(*sb);
+	loff_t total_space = le64_to_cpu(sb->sector_count) * SECTOR_SIZE(*sb);
+	loff_t avail_space = (loff_t) free_clusters * CLUSTER_SIZE(*sb);
 
 	printf("File system version           %hhu.%hhu\n",
 			sb->version.major, sb->version.minor);
diff --git a/exfat/mkfs/cbm.c b/exfat/mkfs/cbm.c
index 0250571..eb67592 100644
--- a/exfat/mkfs/cbm.c
+++ b/exfat/mkfs/cbm.c
@@ -27,12 +27,12 @@
 #include <limits.h>
 #include <string.h>
 
-static off_t cbm_alignment(void)
+static loff_t cbm_alignment(void)
 {
 	return get_cluster_size();
 }
 
-static off_t cbm_size(void)
+static loff_t cbm_size(void)
 {
 	return DIV_ROUND_UP(
 			(get_volume_size() - get_position(&cbm)) / get_cluster_size(),
diff --git a/exfat/mkfs/fat.c b/exfat/mkfs/fat.c
index c70dc86..d8dff2b 100644
--- a/exfat/mkfs/fat.c
+++ b/exfat/mkfs/fat.c
@@ -26,12 +26,12 @@
 #include "rootdir.h"
 #include <unistd.h>
 
-static off_t fat_alignment(void)
+static loff_t fat_alignment(void)
 {
-	return (off_t) 128 * get_sector_size();
+	return (loff_t) 128 * get_sector_size();
 }
 
-static off_t fat_size(void)
+static loff_t fat_size(void)
 {
 	return get_volume_size() / get_cluster_size() * sizeof(cluster_t);
 }
diff --git a/exfat/mkfs/main.c b/exfat/mkfs/main.c
index 2ee6da6..43bc0fb 100644
--- a/exfat/mkfs/main.c
+++ b/exfat/mkfs/main.c
@@ -51,7 +51,7 @@
 {
 	int sector_bits;
 	int spc_bits;
-	off_t volume_size;
+	loff_t volume_size;
 	le16_t volume_label[EXFAT_ENAME_MAX + 1];
 	uint32_t volume_serial;
 	uint64_t first_sector;
@@ -68,7 +68,7 @@
 	return param.spc_bits;
 }
 
-off_t get_volume_size(void)
+loff_t get_volume_size(void)
 {
 	return param.volume_size;
 }
@@ -98,13 +98,13 @@
 	return get_sector_size() << get_spc_bits();
 }
 
-static int setup_spc_bits(int sector_bits, int user_defined, off_t volume_size)
+static int setup_spc_bits(int sector_bits, int user_defined, loff_t volume_size)
 {
 	int i;
 
 	if (user_defined != -1)
 	{
-		off_t cluster_size = 1 << sector_bits << user_defined;
+		loff_t cluster_size = 1 << sector_bits << user_defined;
 		if (volume_size / cluster_size > EXFAT_LAST_DATA_CLUSTER)
 		{
 			struct exfat_human_bytes chb, vhb;
diff --git a/exfat/mkfs/mkexfat.c b/exfat/mkfs/mkexfat.c
index 4b7a344..0929062 100644
--- a/exfat/mkfs/mkexfat.c
+++ b/exfat/mkfs/mkexfat.c
@@ -27,10 +27,10 @@
 #include <stdio.h>
 #include <string.h>
 
-static int check_size(off_t volume_size)
+static int check_size(loff_t volume_size)
 {
 	const struct fs_object** pp;
-	off_t position = 0;
+	loff_t position = 0;
 
 	for (pp = objects; *pp; pp++)
 	{
@@ -52,12 +52,12 @@
 }
 
 static int erase_object(struct exfat_dev* dev, const void* block,
-		size_t block_size, off_t start, off_t size)
+		size_t block_size, loff_t start, loff_t size)
 {
-	const off_t block_count = DIV_ROUND_UP(size, block_size);
-	off_t i;
+	const loff_t block_count = DIV_ROUND_UP(size, block_size);
+	loff_t i;
 
-	if (exfat_seek(dev, start, SEEK_SET) == (off_t) -1)
+	if (exfat_seek(dev, start, SEEK_SET) == (loff_t) -1)
 	{
 		exfat_error("seek to 0x%"PRIx64" failed", start);
 		return 1;
@@ -77,7 +77,7 @@
 static int erase(struct exfat_dev* dev)
 {
 	const struct fs_object** pp;
-	off_t position = 0;
+	loff_t position = 0;
 	const size_t block_size = 1024 * 1024;
 	void* block = malloc(block_size);
 
@@ -107,12 +107,12 @@
 static int create(struct exfat_dev* dev)
 {
 	const struct fs_object** pp;
-	off_t position = 0;
+	loff_t position = 0;
 
 	for (pp = objects; *pp; pp++)
 	{
 		position = ROUND_UP(position, (*pp)->get_alignment());
-		if (exfat_seek(dev, position, SEEK_SET) == (off_t) -1)
+		if (exfat_seek(dev, position, SEEK_SET) == (loff_t) -1)
 		{
 			exfat_error("seek to 0x%"PRIx64" failed", position);
 			return 1;
@@ -124,7 +124,7 @@
 	return 0;
 }
 
-int mkfs(struct exfat_dev* dev, off_t volume_size)
+int mkfs(struct exfat_dev* dev, loff_t volume_size)
 {
 	if (check_size(volume_size) != 0)
 		return 1;
@@ -146,10 +146,10 @@
 	return 0;
 }
 
-off_t get_position(const struct fs_object* object)
+loff_t get_position(const struct fs_object* object)
 {
 	const struct fs_object** pp;
-	off_t position = 0;
+	loff_t position = 0;
 
 	for (pp = objects; *pp; pp++)
 	{
diff --git a/exfat/mkfs/mkexfat.h b/exfat/mkfs/mkexfat.h
index 8d2b5e3..6e15c59 100644
--- a/exfat/mkfs/mkexfat.h
+++ b/exfat/mkfs/mkexfat.h
@@ -27,8 +27,8 @@
 
 struct fs_object
 {
-	off_t (*get_alignment)(void);
-	off_t (*get_size)(void);
+	loff_t (*get_alignment)(void);
+	loff_t (*get_size)(void);
 	int (*write)(struct exfat_dev* dev);
 };
 
@@ -36,14 +36,14 @@
 
 int get_sector_bits(void);
 int get_spc_bits(void);
-off_t get_volume_size(void);
+loff_t get_volume_size(void);
 const le16_t* get_volume_label(void);
 uint32_t get_volume_serial(void);
 uint64_t get_first_sector(void);
 int get_sector_size(void);
 int get_cluster_size(void);
 
-int mkfs(struct exfat_dev* dev, off_t volume_size);
-off_t get_position(const struct fs_object* object);
+int mkfs(struct exfat_dev* dev, loff_t volume_size);
+loff_t get_position(const struct fs_object* object);
 
 #endif /* ifndef MKFS_MKEXFAT_H_INCLUDED */
diff --git a/exfat/mkfs/rootdir.c b/exfat/mkfs/rootdir.c
index 84fa31f..33ac3f9 100644
--- a/exfat/mkfs/rootdir.c
+++ b/exfat/mkfs/rootdir.c
@@ -26,12 +26,12 @@
 #include "uctc.h"
 #include <string.h>
 
-static off_t rootdir_alignment(void)
+static loff_t rootdir_alignment(void)
 {
 	return get_cluster_size();
 }
 
-static off_t rootdir_size(void)
+static loff_t rootdir_size(void)
 {
 	return get_cluster_size();
 }
diff --git a/exfat/mkfs/uct.c b/exfat/mkfs/uct.c
index d1deb2d..14fa56f 100644
--- a/exfat/mkfs/uct.c
+++ b/exfat/mkfs/uct.c
@@ -23,12 +23,12 @@
 #include "uct.h"
 #include "uctc.h"
 
-static off_t uct_alignment(void)
+static loff_t uct_alignment(void)
 {
 	return get_cluster_size();
 }
 
-static off_t uct_size(void)
+static loff_t uct_size(void)
 {
 	return sizeof(upcase_table);
 }
diff --git a/exfat/mkfs/vbr.c b/exfat/mkfs/vbr.c
index 702aa6d..a45cc90 100644
--- a/exfat/mkfs/vbr.c
+++ b/exfat/mkfs/vbr.c
@@ -27,12 +27,12 @@
 #include "rootdir.h"
 #include <string.h>
 
-static off_t vbr_alignment(void)
+static loff_t vbr_alignment(void)
 {
 	return get_sector_size();
 }
 
-static off_t vbr_size(void)
+static loff_t vbr_size(void)
 {
 	return 12 * get_sector_size();
 }
@@ -43,7 +43,7 @@
 	uint32_t fat_sectors;
 
 	clusters_max = get_volume_size() / get_cluster_size();
-	fat_sectors = DIV_ROUND_UP((off_t) clusters_max * sizeof(cluster_t),
+	fat_sectors = DIV_ROUND_UP((loff_t) clusters_max * sizeof(cluster_t),
 			get_sector_size());
 
 	memset(sb, 0, sizeof(struct exfat_super_block));