Whamcloud - gitweb
misc: replace remaining loff_t with ext2_loff_t 51/40951/4
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 12 Dec 2020 09:11:07 +0000 (02:11 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 14 Dec 2020 19:05:10 +0000 (19:05 +0000)
Replace the remaining loff_t uses with ext2_loff_t, as
was done in patch 1df6a4555, since loff_t is a GCC'ism
and is not portable.

Change-Id: I92e3643c05021a18f40a9a022bbf7e54121e453a
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/40951
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
contrib/fallocate.c
lib/ext2fs/imager.c
misc/e2fuzz.c
misc/e4defrag.c
misc/findsuper.c

index d4273d8..16c08ab 100644 (file)
@@ -95,8 +95,8 @@ int main(int argc, char **argv)
        int     fd;
        char    *fname;
        int     opt;
-       loff_t  length = -2LL;
-       loff_t  offset = 0;
+       ext2_loff_t length = -2LL;
+       ext2_loff_t offset = 0;
        int     falloc_mode = 0;
        int     error;
        int     tflag = 0;
index b3ede9a..1aebe62 100644 (file)
@@ -67,7 +67,7 @@ errcode_t ext2fs_image_inode_write(ext2_filsys fs, int fd, int flags)
        blk64_t         blk;
        ssize_t         actual;
        errcode_t       retval;
-       loff_t          r;
+       ext2_loff_t     r;
 
        buf = malloc(fs->blocksize * BUF_BLOCKS);
        if (!buf)
index 7c0f776..f9347c6 100644 (file)
@@ -181,9 +181,8 @@ static int process_fs(const char *fsname)
        int flags, fd;
        ext2_filsys fs = NULL;
        ext2fs_block_bitmap corrupt_map;
-       loff_t hsize, count, off, offset, corrupt_bytes;
+       ext2_loff_t hsize, count, off, offset, corrupt_bytes, i;
        unsigned char c;
-       loff_t i;
 
        /* If mounted rw, force dryrun mode */
        ret = ext2fs_check_if_mounted(fsname, &flags);
index c6c6f13..47be2e0 100644 (file)
@@ -362,7 +362,7 @@ static int page_in_core(int fd, struct move_extent defrag_data,
 {
        long    pagesize;
        void    *page = NULL;
-       loff_t  offset, end_offset, length;
+       ext2_loff_t offset, end_offset, length;
 
        if (vec == NULL || *vec != NULL)
                return -1;
@@ -371,8 +371,8 @@ static int page_in_core(int fd, struct move_extent defrag_data,
        if (pagesize < 0)
                return -1;
        /* In mmap, offset should be a multiple of the page size */
-       offset = (loff_t)defrag_data.orig_start * block_size;
-       length = (loff_t)defrag_data.len * block_size;
+       offset = (ext2_loff_t)defrag_data.orig_start * block_size;
+       length = (ext2_loff_t)defrag_data.len * block_size;
        end_offset = offset + length;
        /* Round the offset down to the nearest multiple of pagesize */
        offset = (offset / pagesize) * pagesize;
@@ -418,18 +418,18 @@ static int defrag_fadvise(int fd, struct move_extent defrag_data,
                            SYNC_FILE_RANGE_WRITE |
                            SYNC_FILE_RANGE_WAIT_AFTER;
        unsigned int    i;
-       loff_t  offset;
+       ext2_loff_t     offset;
 
        if (pagesize < 1)
                return -1;
 
-       offset = (loff_t)defrag_data.orig_start * block_size;
+       offset = (ext2_loff_t)defrag_data.orig_start * block_size;
        offset = (offset / pagesize) * pagesize;
 
 #ifdef HAVE_SYNC_FILE_RANGE
        /* Sync file for fadvise process */
        if (sync_file_range(fd, offset,
-               (loff_t)pagesize * page_num, sync_flag) < 0)
+               (ext2_loff_t)pagesize * page_num, sync_flag) < 0)
                return -1;
 #endif
 
@@ -1286,7 +1286,8 @@ out:
  * @start:             logical offset for defrag target file
  * @file_size:         defrag target filesize
  */
-static void print_progress(const char *file, loff_t start, loff_t file_size)
+static void print_progress(const char *file, ext2_loff_t start,
+                          ext2_loff_t file_size)
 {
        int percent = (start * 100) / file_size;
        printf("\033[79;0H\033[K[%u/%u]%s:\t%3d%%",
@@ -1308,7 +1309,7 @@ static void print_progress(const char *file, loff_t start, loff_t file_size)
 static int call_defrag(int fd, int donor_fd, const char *file,
        const struct stat64 *buf, struct fiemap_extent_list *ext_list_head)
 {
-       loff_t  start = 0;
+       ext2_loff_t     start = 0;
        unsigned int    page_num;
        unsigned char   *vec = NULL;
        int     defraged_ret = 0;
@@ -1561,8 +1562,8 @@ static int file_defrag(const char *file, const struct stat64 *buf,
        orig_group_tmp = orig_group_head;
        do {
                ret = fallocate64(donor_fd, 0,
-                 (loff_t)orig_group_tmp->start->data.logical * block_size,
-                 (loff_t)orig_group_tmp->len * block_size);
+                 (ext2_loff_t)orig_group_tmp->start->data.logical * block_size,
+                 (ext2_loff_t)orig_group_tmp->len * block_size);
                if (ret < 0) {
                        if (mode_flag & DETAIL) {
                                PRINT_FILE_NAME(file);
index 765295c..7e78c1f 100644 (file)
@@ -115,11 +115,11 @@ static void usage(void)
 int main(int argc, char *argv[])
 {
        int skiprate=512;               /* one sector */
-       loff_t sk=0, skl=0;
+       ext2_loff_t sk=0, skl=0;
        int fd;
        char *s;
        time_t tm, last = time(0);
-       loff_t interval = 1024 * 1024;
+       ext2_loff_t interval = 1024 * 1024;
        int c, print_jnl_copies = 0;
        const char * device_name;
        struct ext2_super_block ext2;