currently_testing += got;
if (got != try) {
try = 1;
- if (recover_block == ~0)
+ if (recover_block == ~0U)
recover_block = currently_testing - got +
blocks_at_once;
continue;
currently_testing += got;
if (got != try) {
try = 1;
- if (recover_block == ~0)
+ if (recover_block == ~0U)
recover_block = currently_testing -
got + blocks_at_once;
continue;
currently_testing += got;
if (got != try) {
try = 1;
- if (recover_block == ~0)
+ if (recover_block == ~0U)
recover_block = currently_testing -
got + blocks_at_once;
continue;
} else if (currently_testing == recover_block) {
try = blocks_at_once;
- recover_block = ~0;
+ recover_block = ~0U;
}
for (i=0; i < got; i++) {
if (memcmp(read_buffer + i * block_size,
errcode_t errcode;
unsigned long buf_used;
static unsigned int bb_count;
- int granularity = blocks_at_once;
- blk_t recover_block = ~0;
+ unsigned int granularity = blocks_at_once;
+ blk_t recover_block = ~0U;
bb_count = 0;
errcode = ext2fs_badblocks_list_iterate_begin(bb_list,&bb_iter);
got = do_read (dev, save_ptr, try, block_size,
currently_testing);
if (got == 0) {
- if (recover_block == ~0)
+ if (recover_block == ~0U)
recover_block = currently_testing +
blocks_at_once;
if (granularity != 1) {
currently_testing += got;
if (got != try) {
try = 1;
- if (recover_block == ~0)
+ if (recover_block == ~0U)
recover_block = currently_testing -
got + blocks_at_once;
continue;
/*
* Return TRUE if the profile has the given subsection
*/
-static int profile_has_subsection(profile_t profile, const char *section,
+static int profile_has_subsection(profile_t prof, const char *section,
const char *subsection)
{
void *state;
names[1] = subsection;
names[2] = 0;
- if (profile_iterator_create(profile, names,
+ if (profile_iterator_create(prof, names,
PROFILE_ITER_LIST_SECTION |
PROFILE_ITER_RELATIONS_ONLY, &state))
return 0;
static char **parse_fs_type(const char *fs_type,
const char *usage_types,
- struct ext2_super_block *fs_param,
+ struct ext2_super_block *sb,
blk64_t fs_blocks_count,
char *progname)
{
}
}
- meg = (1024 * 1024) / EXT2_BLOCK_SIZE(fs_param);
+ meg = (1024 * 1024) / EXT2_BLOCK_SIZE(sb);
if (fs_blocks_count < 3 * meg)
size_type = "floppy";
else if (fs_blocks_count < 512 * meg)
}
if (t)
cp = t+1;
- else {
- cp = "";
+ else
break;
- }
}
free(parse_str);
free(profile_type);
return (list.list);
}
-static char *get_string_from_profile(char **fs_types, const char *opt,
+static char *get_string_from_profile(char **types, const char *opt,
const char *def_val)
{
char *ret = 0;
int i;
- for (i=0; fs_types[i]; i++);
+ for (i=0; types[i]; i++);
for (i-=1; i >=0 ; i--) {
- profile_get_string(profile, "fs_types", fs_types[i],
+ profile_get_string(profile, "fs_types", types[i],
opt, 0, &ret);
if (ret)
return ret;
return (ret);
}
-static int get_int_from_profile(char **fs_types, const char *opt, int def_val)
+static int get_int_from_profile(char **types, const char *opt, int def_val)
{
int ret;
char **cpp;
profile_get_integer(profile, "defaults", opt, 0, def_val, &ret);
- for (cpp = fs_types; *cpp; cpp++)
+ for (cpp = types; *cpp; cpp++)
profile_get_integer(profile, "fs_types", *cpp, opt, ret, &ret);
return ret;
}
-static double get_double_from_profile(char **fs_types, const char *opt,
+static double get_double_from_profile(char **types, const char *opt,
double def_val)
{
double ret;
char **cpp;
profile_get_double(profile, "defaults", opt, 0, def_val, &ret);
- for (cpp = fs_types; *cpp; cpp++)
+ for (cpp = types; *cpp; cpp++)
profile_get_double(profile, "fs_types", *cpp, opt, ret, &ret);
return ret;
}
-static int get_bool_from_profile(char **fs_types, const char *opt, int def_val)
+static int get_bool_from_profile(char **types, const char *opt, int def_val)
{
int ret;
char **cpp;
profile_get_boolean(profile, "defaults", opt, 0, def_val, &ret);
- for (cpp = fs_types; *cpp; cpp++)
+ for (cpp = types; *cpp; cpp++)
profile_get_boolean(profile, "fs_types", *cpp, opt, ret, &ret);
return ret;
}
fs_param.s_inodes_count = num_inodes ? num_inodes :
(ext2fs_blocks_count(&fs_param) * blocksize) / inode_ratio;
- if ((((long long)fs_param.s_inodes_count) *
+ if ((((unsigned long long)fs_param.s_inodes_count) *
(inode_size ? inode_size : EXT2_GOOD_OLD_INODE_SIZE)) >=
((ext2fs_blocks_count(&fs_param)) *
EXT2_BLOCK_SIZE(&fs_param))) {
{
errcode_t retval = ENOMEM;
char *tdb_dir = NULL, *tdb_file = NULL;
- char *device_name, *tmp_name;
+ char *dev_name, *tmp_name;
int free_tdb_dir = 0;
/*
tmp_name = strdup(name);
if (!tmp_name)
goto errout;
- device_name = basename(tmp_name);
- tdb_file = malloc(strlen(tdb_dir) + 8 + strlen(device_name) + 7 + 1);
+ dev_name = basename(tmp_name);
+ tdb_file = malloc(strlen(tdb_dir) + 8 + strlen(dev_name) + 7 + 1);
if (!tdb_file) {
free(tmp_name);
goto errout;
}
- sprintf(tdb_file, "%s/mke2fs-%s.e2undo", tdb_dir, device_name);
+ sprintf(tdb_file, "%s/mke2fs-%s.e2undo", tdb_dir, dev_name);
free(tmp_name);
if (!access(tdb_file, F_OK)) {
static void fix_cluster_bg_counts(ext2_filsys fs)
{
blk64_t cluster, num_clusters, tot_free;
- int grp_free, num_free, group, num;
+ unsigned num = 0;
+ int grp_free, num_free, group;
num_clusters = EXT2FS_B2C(fs, ext2fs_blocks_count(fs->super));
- tot_free = num_free = num = group = grp_free = 0;
+ tot_free = num_free = group = grp_free = 0;
for (cluster = EXT2FS_B2C(fs, fs->super->s_first_data_block);
cluster < num_clusters; cluster++) {
if (!ext2fs_test_block_bitmap2(fs->block_map,
struct ext2_super_block *sb = fs->super;
struct ext2_group_desc *gd;
__u32 old_features[3];
- int i, type_err;
+ dgrp_t i;
+ int type_err;
unsigned int mask_err;
#define FEATURE_ON(type, mask) (!(old_features[(type)] & (mask)) && \
return 1;
}
-void handle_quota_options(ext2_filsys fs)
+static void handle_quota_options(ext2_filsys fs)
{
quota_ctx_t qctx;
ext2_ino_t qf_ino;
return;
}
-void parse_quota_opts(const char *opts)
+static void parse_quota_opts(const char *opts)
{
char *buf, *token, *next, *p;
int len;
strcmp(token, "clear_mmp") == 0) {
clear_mmp = 1;
} else if (strcmp(token, "mmp_update_interval") == 0) {
- unsigned long interval;
+ unsigned long intv;
if (!arg) {
r_usage++;
continue;
}
- interval = strtoul(arg, &p, 0);
+ intv = strtoul(arg, &p, 0);
if (*p) {
fprintf(stderr,
_("Invalid mmp_update_interval: %s\n"),
r_usage++;
continue;
}
- if (interval == 0) {
- interval = EXT4_MMP_UPDATE_INTERVAL;
- } else if (interval > EXT4_MMP_MAX_UPDATE_INTERVAL) {
+ if (intv == 0) {
+ intv = EXT4_MMP_UPDATE_INTERVAL;
+ } else if (intv > EXT4_MMP_MAX_UPDATE_INTERVAL) {
fprintf(stderr,
_("mmp_update_interval too big: %lu\n"),
- interval);
+ intv);
r_usage++;
continue;
}
printf(P_("Setting multiple mount protection update "
"interval to %lu second\n",
"Setting multiple mount protection update "
- "interval to %lu seconds\n", interval),
- interval);
- fs->super->s_mmp_update_interval = interval;
+ "interval to %lu seconds\n", intv),
+ intv);
+ fs->super->s_mmp_update_interval = intv;
ext2fs_mark_super_dirty(fs);
} else if (!strcmp(token, "test_fs")) {
fs->super->s_flags |= EXT2_FLAGS_TEST_FILESYS;