diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-03-17 23:17:13 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-03-17 23:17:13 -0400 |
commit | 2d328bb76d2d63bdfdba923b54c28bd686bd8fec (patch) | |
tree | 1fed780f438de72083387ebaa81f4cbccd2aaf2c | |
parent | a7c9cb7d0dc464eda26958595b728a6c3a4cacbc (diff) | |
download | e2fsprogs-2d328bb76d2d63bdfdba923b54c28bd686bd8fec.tar.gz |
Fix miscellaneous gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | debugfs/debugfs.c | 2 | ||||
-rw-r--r-- | debugfs/logdump.c | 2 | ||||
-rw-r--r-- | debugfs/util.c | 2 | ||||
-rw-r--r-- | e2fsck/super.c | 1 | ||||
-rw-r--r-- | lib/ext2fs/block.c | 7 | ||||
-rw-r--r-- | lib/ext2fs/bmap.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/closefs.c | 5 | ||||
-rw-r--r-- | lib/ext2fs/dblist.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/ext2fs.h | 1 | ||||
-rw-r--r-- | lib/ext2fs/extent.c | 19 | ||||
-rw-r--r-- | lib/ext2fs/ind_block.c | 4 | ||||
-rw-r--r-- | lib/ext2fs/openfs.c | 5 | ||||
-rw-r--r-- | misc/chattr.c | 8 | ||||
-rw-r--r-- | misc/dumpe2fs.c | 20 | ||||
-rw-r--r-- | misc/fsck.c | 2 | ||||
-rw-r--r-- | misc/fsck.h | 3 | ||||
-rw-r--r-- | misc/ismounted.c | 4 | ||||
-rw-r--r-- | misc/mke2fs.c | 6 | ||||
-rw-r--r-- | misc/tune2fs.c | 1 | ||||
-rw-r--r-- | misc/uuidd.c | 15 |
20 files changed, 62 insertions, 49 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index c4da2a20..1ed86153 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -39,7 +39,7 @@ extern char *optarg; extern ss_request_table debug_cmds; ss_request_table *extra_cmds; -char *debug_prog_name; +const char *debug_prog_name; ext2_filsys current_fs = NULL; ext2_ino_t root, cwd; diff --git a/debugfs/logdump.c b/debugfs/logdump.c index cf3aae6d..08e58f7d 100644 --- a/debugfs/logdump.c +++ b/debugfs/logdump.c @@ -366,7 +366,7 @@ static void dump_journal(char *cmdname, FILE *out_file, fprintf(out_file, "\tuuid=%s\n", jsb_buffer); fprintf(out_file, "\tblocksize=%d\n", blocksize); fprintf(out_file, "\tjournal data size %lu\n", - sb->s_blocks_count); + (unsigned long) sb->s_blocks_count); } } diff --git a/debugfs/util.c b/debugfs/util.c index cb84bd27..9ac570e8 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -121,7 +121,7 @@ ext2_ino_t string_to_inode(char *str) retval = ext2fs_namei(current_fs, root, cwd, str, &ino); if (retval) { - com_err(str, retval, ""); + com_err(str, retval, 0); return 0; } return ino; diff --git a/e2fsck/super.c b/e2fsck/super.c index b93ec955..494765fe 100644 --- a/e2fsck/super.c +++ b/e2fsck/super.c @@ -802,7 +802,6 @@ int check_backup_super_block(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; ext2_filsys tfs = 0; - io_manager io_ptr; errcode_t retval; dgrp_t g; blk_t sb; diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c index 79b4c217..279a33f3 100644 --- a/lib/ext2fs/block.c +++ b/lib/ext2fs/block.c @@ -364,6 +364,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, e2_blkcnt_t blockcnt; blk_t blk; int op = EXT2_EXTENT_ROOT; + unsigned int j; if (!(flags & BLOCK_FLAG_READ_ONLY)) return EXT2_ET_EXTENT_NOT_SUPPORTED; @@ -396,9 +397,9 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, extent_errout); continue; } - for (blockcnt = extent.e_lblk, i = 0; - i < extent.e_len; - blk++, blockcnt++, i++) { + for (blockcnt = extent.e_lblk, j = 0; + j < extent.e_len; + blk++, blockcnt++, j++) { ret |= (*ctx.func)(fs, &blk, blockcnt, 0, 0, priv_data); diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index 24f05fd2..5fe09868 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -158,7 +158,7 @@ errcode_t ext2fs_bmap2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, if (inode->i_flags & EXT4_EXTENTS_FL) { struct ext2fs_extent extent; - int offset; + unsigned int offset; if (bmap_flags & BMAP_SET) { retval = EXT2_ET_EXTENT_NOT_SUPPORTED; diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c index a523c8e8..086c28a6 100644 --- a/lib/ext2fs/closefs.c +++ b/lib/ext2fs/closefs.c @@ -203,13 +203,16 @@ static errcode_t write_backup_super(ext2_filsys fs, dgrp_t group, errcode_t ext2fs_flush(ext2_filsys fs) { - dgrp_t i,j; + dgrp_t i; errcode_t retval; unsigned long fs_state; __u32 feature_incompat; struct ext2_super_block *super_shadow = 0; struct ext2_group_desc *group_shadow = 0; +#ifdef WORDS_BIGENDIAN struct ext2_group_desc *s, *t; + dgrp_t j; +#endif char *group_ptr; int old_desc_blocks; diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 3bf63a0f..0067caee 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -263,8 +263,6 @@ int ext2fs_dblist_count(ext2_dblist dblist) errcode_t ext2fs_dblist_get_last(ext2_dblist dblist, struct ext2_db_entry **entry) { - errcode_t retval; - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); if (dblist->count == 0) diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index d52fa345..23026089 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -803,6 +803,7 @@ extern errcode_t ext2fs_adjust_ea_refcount(ext2_filsys fs, blk_t blk, extern errcode_t ext2fs_extent_header_verify(void *ptr, int size); extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, ext2_extent_handle_t *handle); +extern void ext2fs_extent_free(ext2_extent_handle_t handle); extern errcode_t ext2fs_extent_get(ext2_extent_handle_t handle, int flags, struct ext2fs_extent *extent); extern errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags, diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index ab211b17..dd7faa72 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -151,7 +151,6 @@ errcode_t ext2fs_extent_header_verify(void *ptr, int size) /* * Begin functions to handle an inode's extent information */ - extern void ext2fs_extent_free(ext2_extent_handle_t handle) { int i; @@ -178,7 +177,6 @@ extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, errcode_t retval; int isize = EXT2_INODE_SIZE(fs->super); struct ext3_extent_header *eh; - struct ext3_extent_idx *ix; EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS); @@ -204,7 +202,7 @@ extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, if (!(handle->inode->i_flags & EXT4_EXTENTS_FL)) return EXT2_ET_INODE_NOT_EXTENT; - eh = (struct ext3_extent_header *) &handle->inode->i_block; + eh = (struct ext3_extent_header *) &handle->inode->i_block[0]; retval = ext2fs_extent_header_verify(eh, sizeof(handle->inode->i_block)); if (retval) @@ -498,7 +496,6 @@ retry: static errcode_t update_path(ext2_extent_handle_t handle) { - struct extent_path *path; blk64_t blk; errcode_t retval; struct ext3_extent_idx *ix; @@ -517,6 +514,7 @@ static errcode_t update_path(ext2_extent_handle_t handle) return retval; } +#if 0 errcode_t ext2fs_extent_save_path(ext2_extent_handle_t handle, ext2_extent_path_t *ret_path) { @@ -553,11 +551,12 @@ errcode_t ext2fs_extent_free_path(ext2_extent_path_t path) ext2fs_free_mem(&path); return 0; } +#endif static errcode_t extent_goto(ext2_extent_handle_t handle, int leaf_level, blk64_t blk) { - struct ext2fs_extent extent, next; + struct ext2fs_extent extent; errcode_t retval; retval = ext2fs_extent_get(handle, EXT2_EXTENT_ROOT, &extent); @@ -618,7 +617,8 @@ errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle, return extent_goto(handle, 0, blk); } -errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, int flags, +errcode_t ext2fs_extent_replace(ext2_extent_handle_t handle, + int flags EXT2FS_ATTR((unused)), struct ext2fs_extent *extent) { struct extent_path *path; @@ -713,7 +713,8 @@ errout: return retval; } -errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, int flags) +errcode_t ext2fs_extent_delete(ext2_extent_handle_t handle, + int flags EXT2FS_ATTR((unused))) { struct extent_path *path; char *cp; @@ -759,8 +760,6 @@ errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle, struct ext2_extent_info *info) { struct extent_path *path; - struct ext3_extent_idx *ix; - struct ext3_extent *ex; EXT2_CHECK_MAGIC(handle, EXT2_ET_MAGIC_EXTENT_HANDLE); @@ -796,7 +795,7 @@ errcode_t ext2fs_extent_get_info(ext2_extent_handle_t handle, /* * Hook in new commands into debugfs */ -char *debug_prog_name = "tst_extents"; +const char *debug_prog_name = "tst_extents"; extern ss_request_table extent_cmds; ss_request_table *extra_cmds = &extent_cmds; diff --git a/lib/ext2fs/ind_block.c b/lib/ext2fs/ind_block.c index 9baa37f5..efd7fb10 100644 --- a/lib/ext2fs/ind_block.c +++ b/lib/ext2fs/ind_block.c @@ -22,9 +22,11 @@ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf) { errcode_t retval; +#ifdef WORDS_BIGENDIAN blk_t *block_nr; int i; int limit = fs->blocksize >> 2; +#endif if ((fs->flags & EXT2_FLAG_IMAGE_FILE) && (fs->io != fs->image_io)) @@ -44,9 +46,11 @@ errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf) errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf) { +#ifdef WORDS_BIGENDIAN blk_t *block_nr; int i; int limit = fs->blocksize >> 2; +#endif if (fs->flags & EXT2_FLAG_IMAGE_FILE) return 0; diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index a6a82174..134c1e36 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -86,10 +86,13 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, errcode_t retval; unsigned long i; __u32 features; - int j, groups_per_block, blocks_per_group, io_flags; + int groups_per_block, blocks_per_group, io_flags; blk_t group_block, blk; char *dest, *cp; +#ifdef WORDS_BIGENDIAN struct ext2_group_desc *gdp; + int j; +#endif EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER); diff --git a/misc/chattr.c b/misc/chattr.c index efaa5596..daae163d 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -185,9 +185,9 @@ static int decode_arg (int * i, int argc, char ** argv) return 1; } -static int chattr_dir_proc (const char *, struct dirent *, void *); +static int chattr_dir_proc(const char *, struct dirent *, void *); -static int change_attributes (const char * name, int cmdline) +static int change_attributes(const char * name) { unsigned long flags; STRUCT_STAT st; @@ -265,7 +265,7 @@ static int chattr_dir_proc (const char * dir_name, struct dirent * de, return -1; } sprintf(path, "%s/%s", dir_name, de->d_name); - ret = change_attributes(path, 0); + ret = change_attributes(path); free(path); } return ret; @@ -314,7 +314,7 @@ int main (int argc, char ** argv) fprintf (stderr, "chattr %s (%s)\n", E2FSPROGS_VERSION, E2FSPROGS_DATE); for (j = i; j < argc; j++) { - err = change_attributes (argv[j], 1); + err = change_attributes (argv[j]); if (err) retval = 1; } diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index f6e7972e..befaa636 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -336,9 +336,9 @@ static void print_journal_information(ext2_filsys fs) static void parse_extended_opts(const char *opts, blk_t *superblock, int *blocksize) { - char *buf, *token, *next, *p, *arg, *badopt = ""; + char *buf, *token, *next, *p, *arg, *badopt = 0; int len; - int usage = 0; + int do_usage = 0; len = strlen(opts); buf = malloc(len+1); @@ -363,7 +363,7 @@ static void parse_extended_opts(const char *opts, blk_t *superblock, if (strcmp(token, "superblock") == 0 || strcmp(token, "sb") == 0) { if (!arg) { - usage++; + do_usage++; badopt = token; continue; } @@ -372,13 +372,13 @@ static void parse_extended_opts(const char *opts, blk_t *superblock, fprintf(stderr, _("Invalid superblock parameter: %s\n"), arg); - usage++; + do_usage++; continue; } } else if (strcmp(token, "blocksize") == 0 || strcmp(token, "bs") == 0) { if (!arg) { - usage++; + do_usage++; badopt = token; continue; } @@ -387,15 +387,15 @@ static void parse_extended_opts(const char *opts, blk_t *superblock, fprintf(stderr, _("Invalid blocksize parameter: %s\n"), arg); - usage++; + do_usage++; continue; } } else { - usage++; + do_usage++; badopt = token; } } - if (usage) { + if (do_usage) { fprintf(stderr, _("\nBad extended option(s) specified: %s\n\n" "Extended options are separated by commas, " "and may take an argument which\n" @@ -403,7 +403,7 @@ static void parse_extended_opts(const char *opts, blk_t *superblock, "Valid extended options are:\n" "\tsuperblock=<superblock number>\n" "\tblocksize=<blocksize>\n"), - badopt); + badopt ? badopt : ""); free(buf); exit(1); } @@ -415,7 +415,7 @@ int main (int argc, char ** argv) errcode_t retval; ext2_filsys fs; int print_badblocks = 0; - int use_superblock = 0; + blk_t use_superblock = 0; int use_blocksize = 0; int image_dump = 0; int force = 0; diff --git a/misc/fsck.c b/misc/fsck.c index db572b1e..baddba2d 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -800,7 +800,7 @@ static void compile_fs_type(char *fs_type, struct fs_type_compile *cmp) * This function returns true if a particular option appears in a * comma-delimited options list */ -static int opt_in_list(char *opt, char *optlist) +static int opt_in_list(const char *opt, char *optlist) { char *list, *s; diff --git a/misc/fsck.h b/misc/fsck.h index 55cb5258..8a0f70e3 100644 --- a/misc/fsck.h +++ b/misc/fsck.h @@ -68,3 +68,6 @@ struct fsck_instance { extern char *base_device(const char *device); extern const char *identify_fs(const char *fs_name, const char *fs_types); + +/* ismounted.h */ +extern int is_mounted(const char *file); diff --git a/misc/ismounted.c b/misc/ismounted.c index 72f4cbae..94a2d6e7 100644 --- a/misc/ismounted.c +++ b/misc/ismounted.c @@ -28,6 +28,9 @@ #endif #include <string.h> #include <sys/stat.h> +#include <ctype.h> + +#include "fsck.h" /* * ext2fs_check_if_mounted flags @@ -80,7 +83,6 @@ static errcode_t check_mntent_file(const char *mtab_file, const char *file, ino_t file_ino=0; FILE *f; char buf[1024], *device = 0, *mnt_dir = 0, *cp; - int fd; *mount_flags = 0; if ((f = fopen(mtab_file, "r")) == NULL) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 072a3a8c..461448ff 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -513,11 +513,11 @@ static void create_root_dir(ext2_filsys fs) static void create_lost_and_found(ext2_filsys fs) { + unsigned int lpf_size = 0; errcode_t retval; ext2_ino_t ino; const char *name = "lost+found"; int i; - int lpf_size = 0; fs->umask = 077; retval = ext2fs_mkdir(fs, EXT2_ROOT_INO, 0, name); @@ -757,7 +757,7 @@ static int set_os(struct ext2_super_block *sb, char *os) static void parse_extended_opts(struct ext2_super_block *param, const char *opts) { - char *buf, *token, *next, *p, *arg, *badopt = ""; + char *buf, *token, *next, *p, *arg, *badopt = 0; int len; int r_usage = 0; @@ -884,7 +884,7 @@ static void parse_extended_opts(struct ext2_super_block *param, "\tstripe-width=<RAID stride * data disks in blocks>\n" "\tresize=<resize maximum size in blocks>\n\n" "\ttest_fs\n"), - badopt); + badopt ? badopt : ""); free(buf); exit(1); } diff --git a/misc/tune2fs.c b/misc/tune2fs.c index dc44d566..5a20d2fc 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -315,7 +315,6 @@ static void update_mntopts(ext2_filsys fs, char *mntopts) static void update_feature_set(ext2_filsys fs, char *features) { struct ext2_super_block *sb= fs->super; - __u32 old_compat, old_incompat, old_ro_compat; __u32 old_features[3]; int type_err; unsigned int mask_err; diff --git a/misc/uuidd.c b/misc/uuidd.c index c964b4ea..1af8c863 100644 --- a/misc/uuidd.c +++ b/misc/uuidd.c @@ -206,12 +206,12 @@ static void server_loop(const char *socket_path, const char *pidfile_path, int debug, int timeout, int quiet) { struct sockaddr_un my_addr, from_addr; - unsigned char reply_buf[1024], *cp; struct flock fl; socklen_t fromlen; int32_t reply_len = 0; uuid_t uu; mode_t save_umask; + char reply_buf[1024], *cp; char op, str[37]; int i, s, ns, len, num; int fd_pidfile, ret; @@ -329,12 +329,12 @@ static void server_loop(const char *socket_path, const char *pidfile_path, switch(op) { case UUIDD_OP_GETPID: - sprintf((char *) reply_buf, "%d", getpid()); - reply_len = strlen((char *) reply_buf)+1; + sprintf(reply_buf, "%d", getpid()); + reply_len = strlen(reply_buf)+1; break; case UUIDD_OP_GET_MAXOP: - sprintf((char *) reply_buf, "%d", UUIDD_MAX_OP); - reply_len = strlen((char *) reply_buf)+1; + sprintf(reply_buf, "%d", UUIDD_MAX_OP); + reply_len = strlen(reply_buf)+1; break; case UUIDD_OP_TIME_UUID: num = 1; @@ -375,12 +375,13 @@ static void server_loop(const char *socket_path, const char *pidfile_path, num = 1000; if (num*16 > (int) (sizeof(reply_buf)-sizeof(num))) num = (sizeof(reply_buf)-sizeof(num)) / 16; - uuid__generate_random(reply_buf+sizeof(num), &num); + uuid__generate_random((unsigned char *) reply_buf + + sizeof(num), &num); if (debug) { printf(_("Generated %d UUID's:\n"), num); for (i=0, cp=reply_buf+sizeof(num); i < num; i++, cp+=16) { - uuid_unparse(cp, str); + uuid_unparse((unsigned char *)cp, str); printf("\t%s\n", str); } } |