From d69ac2b18baf0b62f62e0f8b19a861efb7ce536a Mon Sep 17 00:00:00 2001 From: Spegelius Date: Sun, 23 Nov 2014 15:15:06 +0200 Subject: 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 --- exfat/mkfs/cbm.c | 4 ++-- exfat/mkfs/fat.c | 6 +++--- exfat/mkfs/main.c | 8 ++++---- exfat/mkfs/mkexfat.c | 24 ++++++++++++------------ exfat/mkfs/mkexfat.h | 10 +++++----- exfat/mkfs/rootdir.c | 4 ++-- exfat/mkfs/uct.c | 4 ++-- exfat/mkfs/vbr.c | 6 +++--- 8 files changed, 33 insertions(+), 33 deletions(-) (limited to 'exfat/mkfs') diff --git a/exfat/mkfs/cbm.c b/exfat/mkfs/cbm.c index 025057132..eb67592fd 100644 --- a/exfat/mkfs/cbm.c +++ b/exfat/mkfs/cbm.c @@ -27,12 +27,12 @@ #include #include -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 c70dc8637..d8dff2bee 100644 --- a/exfat/mkfs/fat.c +++ b/exfat/mkfs/fat.c @@ -26,12 +26,12 @@ #include "rootdir.h" #include -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 2ee6da6ac..43bc0fbea 100644 --- a/exfat/mkfs/main.c +++ b/exfat/mkfs/main.c @@ -51,7 +51,7 @@ static struct { 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 @@ int get_spc_bits(void) return param.spc_bits; } -off_t get_volume_size(void) +loff_t get_volume_size(void) { return param.volume_size; } @@ -98,13 +98,13 @@ int get_cluster_size(void) 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 4b7a344c8..0929062be 100644 --- a/exfat/mkfs/mkexfat.c +++ b/exfat/mkfs/mkexfat.c @@ -27,10 +27,10 @@ #include #include -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 check_size(off_t volume_size) } 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_object(struct exfat_dev* dev, const void* block, 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 erase(struct exfat_dev* dev) 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 @@ static int create(struct exfat_dev* dev) 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 @@ int mkfs(struct exfat_dev* dev, off_t volume_size) 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 8d2b5e393..6e15c59e4 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 @@ extern const struct fs_object* objects[]; 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 84fa31f40..33ac3f979 100644 --- a/exfat/mkfs/rootdir.c +++ b/exfat/mkfs/rootdir.c @@ -26,12 +26,12 @@ #include "uctc.h" #include -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 d1deb2d02..14fa56fc7 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 702aa6d14..a45cc9003 100644 --- a/exfat/mkfs/vbr.c +++ b/exfat/mkfs/vbr.c @@ -27,12 +27,12 @@ #include "rootdir.h" #include -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 @@ static void init_sb(struct exfat_super_block* sb) 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)); -- cgit v1.2.3