Whamcloud - gitweb
misc: quiet minor compiler errors
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 24 Sep 2011 16:59:31 +0000 (12:59 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 24 Sep 2011 17:00:24 +0000 (13:00 -0400)
Several compiler errors are quieted:
- zero-length gnu_printf format string
- unused variable
- uninitalized variable (though it isn't actually used for anything)
- fixed a bug in ext2fs_stat() if stat64() does not exist

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/ea_refcount.c
e2fsck/problem.c
e2fsck/region.c
lib/ext2fs/crc32c.c
lib/ext2fs/ext2fs.h
lib/ext2fs/getsize.c
lib/quota/dqblk_v2.h
misc/tune2fs.c

index 115bd6f..35105e4 100644 (file)
@@ -407,8 +407,8 @@ int main(int argc, char **argv)
                        size = bcode_program[i++];
                        retval = ea_refcount_create(size, &refcount);
                        if (retval) {
-                               com_err("ea_refcount_create",
-                                       retval, "");
+                               com_err("ea_refcount_create", retval,
+                                       "while creating size %d", size);
                                exit(1);
                        } else
                                printf("Creating refcount with size %d\n",
@@ -422,35 +422,35 @@ int main(int argc, char **argv)
                case BCODE_STORE:
                        blk = (blk_t) bcode_program[i++];
                        arg = bcode_program[i++];
-                       retval = ea_refcount_store(refcount, blk, arg);
                        printf("Storing blk %u with value %d\n", blk, arg);
+                       retval = ea_refcount_store(refcount, blk, arg);
                        if (retval)
-                               com_err("ea_refcount_store", retval, "");
+                               com_err("ea_refcount_store", retval,
+                                       "while storing blk %u", blk);
                        break;
                case BCODE_FETCH:
                        blk = (blk_t) bcode_program[i++];
                        retval = ea_refcount_fetch(refcount, blk, &arg);
                        if (retval)
-                               com_err("ea_refcount_fetch", retval, "");
+                               com_err("ea_refcount_fetch", retval,
+                                       "while fetching blk %u", blk);
                        else
                                printf("bcode_fetch(%u) returns %d\n",
                                       blk, arg);
                        break;
                case BCODE_INCR:
                        blk = (blk_t) bcode_program[i++];
-                       retval = ea_refcount_increment(refcount, blk,
-                                                          &arg);
+                       retval = ea_refcount_increment(refcount, blk, &arg);
                        if (retval)
                                com_err("ea_refcount_increment", retval,
-                                       "");
+                                       "while incrementing blk %u", blk);
                        else
                                printf("bcode_increment(%u) returns %d\n",
                                       blk, arg);
                        break;
                case BCODE_DECR:
                        blk = (blk_t) bcode_program[i++];
-                       retval = ea_refcount_decrement(refcount, blk,
-                                                          &arg);
+                       retval = ea_refcount_decrement(refcount, blk, &arg);
                        if (retval)
                                com_err("ea_refcount_decrement", retval,
                                        "while decrementing blk %u", blk);
@@ -461,20 +461,18 @@ int main(int argc, char **argv)
                case BCODE_VALIDATE:
                        retval = ea_refcount_validate(refcount, stderr);
                        if (retval)
-                               com_err("ea_refcount_validate",
-                                       retval, "");
+                               com_err("ea_refcount_validate", retval,
+                                       "while validating");
                        else
                                printf("Refcount validation OK.\n");
                        break;
                case BCODE_LIST:
                        ea_refcount_intr_begin(refcount);
                        while (1) {
-                               blk = ea_refcount_intr_next(refcount,
-                                                               &arg);
+                               blk = ea_refcount_intr_next(refcount, &arg);
                                if (!blk)
                                        break;
-                               printf("\tblk=%u, count=%d\n", blk,
-                                      arg);
+                               printf("\tblk=%u, count=%d\n", blk, arg);
                        }
                        break;
                case BCODE_COLLAPSE:
index 0d56983..2c49493 100644 (file)
@@ -1979,6 +1979,7 @@ int main(int argc, char *argv[])
        e2fsck_t ctx;
        int rc;
 
+       memset(&ctx, 0, sizeof(ctx)); /* just to quiet compiler */
        rc = verify_problem_table(ctx);
        if (rc == 0)
                printf("e2fsck problem table verified\n");
index 2d59356..e9abb56 100644 (file)
@@ -173,7 +173,7 @@ int main(int argc, char **argv)
 {
        region_t        r;
        int             pc = 0, ret;
-       region_addr_t   start, end, len;
+       region_addr_t   start, end;
 
 
        while (1) {
index c9b610b..65bca5c 100644 (file)
@@ -30,7 +30,6 @@
  */
 #include "config.h"
 #include <stdint.h>
-#include <endian.h>
 #include <stdlib.h>
 #include <stdio.h>
 #define __force
index c3237db..b91eef8 100644 (file)
@@ -586,7 +586,7 @@ typedef struct ext2_icount *ext2_icount_t;
 #define EXT2FS_NUM_B2C(fs, blks)       (((blks) + EXT2FS_CLUSTER_MASK(fs)) >> \
                                         (fs)->cluster_ratio_bits)
 
-#ifdef HAVE_OPEN64
+#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
 typedef struct stat64 ext2fs_struct_stat;
 #else
 typedef struct stat ext2fs_struct_stat;
@@ -1411,6 +1411,7 @@ extern unsigned int ext2fs_div_ceil(unsigned int a, unsigned int b);
 extern __u64 ext2fs_div64_ceil(__u64 a, __u64 b);
 extern int ext2fs_open_file(const char *pathname, int flags, ...);
 extern int ext2fs_stat(const char *path, ext2fs_struct_stat *buf);
+extern int ext2fs_fstat(int fd, ext2fs_struct_stat *buf);
 
 /*
  * The actual inlined functions definitions themselves...
@@ -1671,7 +1672,7 @@ _INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...)
        va_end(args);
 
        if (mode)
-#ifdef HAVE_OPEN64
+#if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
                return open64(pathname, flags, mode);
        else
                return open64(pathname, flags);
@@ -1684,10 +1685,19 @@ _INLINE_ int ext2fs_open_file(const char *pathname, int flags, ...)
 
 _INLINE_ int ext2fs_stat(const char *path, ext2fs_struct_stat *buf)
 {
-#ifdef HAVE_OPEN64
+#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
        return stat64(path, buf);
 #else
-       return open(path, buf);
+       return stat(path, buf);
+#endif
+}
+
+_INLINE_ int ext2fs_fstat(int fd, ext2fs_struct_stat *buf)
+{
+#if defined(HAVE_STAT64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
+       return fstat64(fd, buf);
+#else
+       return fstat(fd, buf);
 #endif
 }
 
index 690349c..a2e6e47 100644 (file)
@@ -232,13 +232,9 @@ errcode_t ext2fs_get_device_size2(const char *file, int blocksize,
 #endif /* HAVE_SYS_DISKLABEL_H */
 
        {
-#if defined(HAVE_FSTAT64) && !defined(__OSX__)
-               struct stat64   st;
-               if (fstat64(fd, &st) == 0)
-#else
-               struct stat     st;
-               if (fstat(fd, &st) == 0)
-#endif
+               ext2fs_struct_stat st;
+
+               if (ext2fs_fstat(fd, &st) == 0)
                        if (S_ISREG(st.st_mode)) {
                                *retblocks = st.st_size / blocksize;
                                goto out;
index ca07902..18055c6 100644 (file)
@@ -32,7 +32,7 @@ struct v2_mem_dqinfo {
 };
 
 struct v2_mem_dqblk {
-       loff_t dqb_off;         /* Offset of dquot in file */
+       long long dqb_off;      /* Offset of dquot in file */
 };
 
 struct quotafile_ops;          /* Will be defined later in quotaio.h */
index 11ef095..3e12697 100644 (file)
@@ -2017,7 +2017,7 @@ retry_open:
                printf(_("Setting stripe width to %d\n"), stripe_width);
        }
        if (ext_mount_opts) {
-               strncpy(fs->super->s_mount_opts, ext_mount_opts,
+               strncpy((char *)(fs->super->s_mount_opts), ext_mount_opts,
                        sizeof(fs->super->s_mount_opts));
                fs->super->s_mount_opts[sizeof(fs->super->s_mount_opts)-1] = 0;
                ext2fs_mark_super_dirty(fs);