diff options
Diffstat (limited to 'exfat/libexfat')
-rw-r--r-- | exfat/libexfat/cluster.c | 18 | ||||
-rw-r--r-- | exfat/libexfat/exfat.h | 22 | ||||
-rw-r--r-- | exfat/libexfat/io.c | 20 | ||||
-rw-r--r-- | exfat/libexfat/mount.c | 2 | ||||
-rw-r--r-- | exfat/libexfat/node.c | 32 | ||||
-rw-r--r-- | exfat/libexfat/utils.c | 4 |
6 files changed, 49 insertions, 49 deletions
diff --git a/exfat/libexfat/cluster.c b/exfat/libexfat/cluster.c index fc3657b53..394ca4a22 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 @@ static off_t s2o(const struct exfat* ef, off_t sector) /* * 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 @@ off_t exfat_c2o(const struct exfat* ef, cluster_t cluster) /* * 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 @@ cluster_t exfat_next_cluster(const struct exfat* ef, 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 @@ int exfat_flush(struct exfat* ef) 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 @@ static int shrink_file(struct exfat* ef, struct exfat_node* node, 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 @@ static int find_used_clusters(const struct exfat* ef, 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 5beba7cba..009a0c081 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 @@ struct exfat_node 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 @@ struct exfat_dev* exfat_open(const char* spec, enum exfat_mode mode); 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_lookup(struct exfat* ef, struct exfat_node** node, 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_flush(struct exfat* ef); 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 3d7aaad2e..3c3bd270b 100644 --- a/exfat/libexfat/io.c +++ b/exfat/libexfat/io.c @@ -46,9 +46,9 @@ struct exfat_dev { 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 @@ enum exfat_mode exfat_get_mode(const struct exfat_dev* dev) 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_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) { #ifdef USE_UBLIO return ublio_pread(dev->ufh, buffer, size, offset); @@ -337,7 +337,7 @@ ssize_t exfat_pread(struct exfat_dev* dev, void* buffer, size_t size, } 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_pwrite(struct exfat_dev* dev, const void* buffer, size_t size, } 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_pread(const struct exfat* ef, struct exfat_node* node, } 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 0d6ce9ead..45a5d4999 100644 --- a/exfat/libexfat/mount.c +++ b/exfat/libexfat/mount.c @@ -106,7 +106,7 @@ static void parse_options(struct exfat* ef, const char* options) } 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 d05f20dc1..e4fd32f31 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 @@ int exfat_cleanup_node(struct exfat* ef, struct exfat_node* node) /** * 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 @@ void exfat_reset_cache(struct exfat* ef) } 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 @@ static bool next_entry(struct exfat* ef, const struct exfat_node* parent, 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 @@ int exfat_flush_node(struct exfat* ef, struct exfat_node* node) 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 bool erase_entry(struct exfat* ef, struct exfat_node* node) } 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 shrink_directory(struct exfat* ef, struct exfat_node* dir, 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 grow_directory(struct exfat* ef, struct exfat_node* dir, } 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 find_slot(struct exfat* ef, struct exfat_node* dir, } 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 @@ static int create(struct exfat* ef, const char* path, uint16_t attrib) 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 @@ int exfat_mkdir(struct exfat* ef, const char* path) 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 @@ int exfat_rename(struct exfat* ef, const char* old_path, const char* new_path) 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 @@ const char* exfat_get_label(struct exfat* ef) 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 @@ int exfat_set_label(struct exfat* ef, const char* label) 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 388f360d9..39d708e6e 100644 --- a/exfat/libexfat/utils.c +++ b/exfat/libexfat/utils.c @@ -161,8 +161,8 @@ void exfat_print_info(const struct exfat_super_block* sb, 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); |