if (common_args_process(argc, argv, 2, 3, argv[0], "<file> [num]",
CHECK_FS_RW | CHECK_FS_BITMAPS))
- return 1;
+ return;
if (check_fs_read_write(argv[0]))
return;
* is 1-based, it means that we need to adjust it by -1 in this
* function to compute right offset in the particular inode table.
*/
-static void e2fsck_discard_inodes(e2fsck_t ctx, int group,
- int start, int count)
+static void e2fsck_discard_inodes(e2fsck_t ctx, dgrp_t group,
+ ext2_ino_t start, int count)
{
ext2_filsys fs = ctx->fs;
blk64_t blk, num;
- int orig = count;
/*
* Sanity check for 'start'
{
ext2_filsys fs = ctx->fs;
blk64_t i;
- int *free_array;
+ unsigned int *free_array;
int group = 0;
- int blocks = 0;
+ unsigned int blocks = 0;
blk64_t free_blocks = 0;
blk64_t first_free = ext2fs_blocks_count(fs->super);
- int group_free = 0;
+ unsigned int group_free = 0;
int actual, bitmap;
struct problem_context pctx;
int problem, save_problem, fixit, had_problem;
int cmp_block = 0;
int redo_flag = 0;
blk64_t super_blk, old_desc_blk, new_desc_blk;
- io_manager manager = ctx->fs->io->manager;
clear_problem_context(&pctx);
- free_array = (int *) e2fsck_allocate_memory(ctx,
- fs->group_desc_count * sizeof(int), "free block count array");
+ free_array = (unsigned int *) e2fsck_allocate_memory(ctx,
+ fs->group_desc_count * sizeof(unsigned int), "free block count array");
if ((B2C(fs->super->s_first_data_block) <
ext2fs_get_block_bitmap_start2(ctx->block_found_map)) ||
int dirs_count = 0;
int group = 0;
unsigned int inodes = 0;
- int *free_array;
- int *dir_array;
+ ext2_ino_t *free_array;
+ ext2_ino_t *dir_array;
int actual, bitmap;
errcode_t retval;
struct problem_context pctx;
int csum_flag;
int skip_group = 0;
int redo_flag = 0;
- io_manager manager = ctx->fs->io->manager;
- int first_free = fs->super->s_inodes_per_group + 1;
+ ext2_ino_t first_free = fs->super->s_inodes_per_group + 1;
clear_problem_context(&pctx);
- free_array = (int *) e2fsck_allocate_memory(ctx,
- fs->group_desc_count * sizeof(int), "free inode count array");
+ free_array = (ext2_ino_t *) e2fsck_allocate_memory(ctx,
+ fs->group_desc_count * sizeof(ext2_ino_t), "free inode count array");
- dir_array = (int *) e2fsck_allocate_memory(ctx,
- fs->group_desc_count * sizeof(int), "directory count array");
+ dir_array = (ext2_ino_t *) e2fsck_allocate_memory(ctx,
+ fs->group_desc_count * sizeof(ext2_ino_t), "directory count array");
if ((1 < ext2fs_get_inode_bitmap_start2(ctx->inode_used_map)) ||
(fs->super->s_inodes_count >
static void move_quota_inode(ext2_filsys fs, ext2_ino_t from_ino,
ext2_ino_t to_ino, int qtype)
{
- struct ext2_super_block *sb = fs->super;
- ext2_ino_t ino;
struct ext2_inode inode;
- errcode_t retval;
char qf_name[QUOTA_NAME_LEN];
if (ext2fs_read_inode(fs, from_ino, &inode))
f = fopen("/sys/class/power_supply/AC/online", "r");
if (f) {
- if (fscanf(f, "%d\n", &acflag) == 1) {
+ if (fscanf(f, "%u\n", &acflag) == 1) {
fclose(f);
return (!acflag);
}
static const char *my_ver_string = E2FSPROGS_VERSION;
static const char *my_ver_date = E2FSPROGS_DATE;
-int e2fsck_check_mmp(ext2_filsys fs, e2fsck_t ctx)
+static int e2fsck_check_mmp(ext2_filsys fs, e2fsck_t ctx)
{
struct mmp_struct *mmp_s;
unsigned int mmp_check_interval;
struct rb_node *parent = NULL;
struct rb_node **n = &bp->root.rb_node;
struct bmap_rb_extent *ext;
- int i=0;
rcursor = *bp->rcursor;
if (!rcursor)
static int rb_mark_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
{
struct ext2fs_rb_private *bp;
- int i;
-
bp = (struct ext2fs_rb_private *) bitmap->private;
arg -= bitmap->start;
unsigned int num)
{
struct ext2fs_rb_private *bp;
- struct bmap_rb_extent *new_ext;
bp = (struct ext2fs_rb_private *) bitmap->private;
arg -= bitmap->start;
unsigned int num)
{
struct ext2fs_rb_private *bp;
- int ret;
bp = (struct ext2fs_rb_private *) bitmap->private;
arg -= bitmap->start;
__u64 max_size = 0;
__u64 min_size = ULONG_MAX;
__u64 size = 0, avg_size = 0;
+ double eff;
+#ifdef BMAP_STATS_OPS
__u64 mark_all, test_all;
- double eff, m_hit = 0.0, t_hit = 0.0;
+ double m_hit = 0.0, t_hit = 0.0;
+#endif
bp = (struct ext2fs_rb_private *) bitmap->private;
#define __force
#define min(x, y) ((x) > (y) ? (y) : (x))
#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
-#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
+#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
-#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+#define PTR_ALIGN(p, a) ((__typeof__(p))ALIGN((unsigned long)(p), (a)))
#include "crc32c_defs.h"
#include "ext2fs.h"
_INLINE_ int ext2fs_open_file(const char *pathname, int flags, mode_t mode)
{
- va_list args;
-
if (mode)
#if defined(HAVE_OPEN64) && !defined(__OSX_AVAILABLE_BUT_DEPRECATED)
return open64(pathname, flags, mode);
void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap bitmap)
{
struct ext2_bmap_statistics *stats = &bitmap->stats;
+#ifdef BMAP_STATS_OPS
float mark_seq_perc = 0.0, test_seq_perc = 0.0;
float mark_back_perc = 0.0, test_back_perc = 0.0;
+#endif
double inuse;
struct timeval now;
retval = ext2fs_dir_iterate(fs, dir, 0, buf, get_pathname_proc, &gp);
if (retval == EXT2_ET_NO_DIRECTORY) {
- char buf[32];
+ char tmp[32];
if (ino)
- snprintf(buf, sizeof(buf), "<%u>/<%u>", dir, ino);
+ snprintf(tmp, sizeof(tmp), "<%u>/<%u>", dir, ino);
else
- snprintf(buf, sizeof(buf), "<%u>", dir);
- retval = ext2fs_get_mem(strlen(buf)+1, name);
+ snprintf(tmp, sizeof(tmp), "<%u>", dir);
+ retval = ext2fs_get_mem(strlen(tmp)+1, name);
if (retval)
goto cleanup;
- strcpy(*name, buf);
+ strcpy(*name, tmp);
return 0;
} else if (retval)
goto cleanup;
static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
ext2_ino_t ino, int create)
{
- float range;
int low, high, mid;
- ext2_ino_t lowval, highval;
if (!icount || !icount->list)
return 0;
#endif
#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
+ const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
struct rb_node
static void lseek_error_and_exit(int errnum)
{
- perror("seek");
+ fprintf(stderr, "seek: %s\n", error_message(errnum));
exit(1);
}
ext2fs_free_mem(&buf);
}
-static void init_l1_table(struct ext2_super_block *sb,
- struct ext2_qcow2_image *image)
+static void init_l1_table(struct ext2_qcow2_image *image)
{
__u64 *l1_table;
errcode_t ret;
image->hdr = header;
/* Initialize l1 and l2 tables */
- init_l1_table(sb, image);
+ init_l1_table(image);
init_l2_cache(image);
return 0;
void parse_quota_opts(const char *opts)
{
- char *buf, *token, *next, *p, *arg;
+ char *buf, *token, *next, *p;
int len;
len = strlen(opts);