From: Theodore Ts'o Date: Wed, 5 Mar 2014 00:10:26 +0000 (-0500) Subject: e2fsck: don't use e2fsck_global_ctx in e2fsck_set_bitmap_type() X-Git-Tag: v1.42.10~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93d0db347e29fa49942aaf9f7dd0d42b33396e51;p=thirdparty%2Fe2fsprogs.git e2fsck: don't use e2fsck_global_ctx in e2fsck_set_bitmap_type() There is no reason to use e2fsck_global_ctx in e2fsck_set_bitmap_type(), since we can get the context structure from fs->priv_data. Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 23316b89d..155e6b4a4 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1066,9 +1066,11 @@ static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr, retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags, 0, 0, io_ptr, ret_fs); - if (retval == 0) + if (retval == 0) { + (*ret_fs)->priv_data = ctx; e2fsck_set_bitmap_type(*ret_fs, EXT2FS_BMAP64_RBTREE, "default", NULL); + } return retval; } @@ -1417,7 +1419,6 @@ failure: } ctx->fs = fs; - fs->priv_data = ctx; fs->now = ctx->now; sb = fs->super; diff --git a/e2fsck/util.c b/e2fsck/util.c index 9f920b2c4..434863137 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -792,13 +792,13 @@ void e2fsck_set_bitmap_type(ext2_filsys fs, unsigned int default_type, const char *profile_name, unsigned int *old_type) { unsigned type; + e2fsck_t ctx = (e2fsck_t) fs->priv_data; if (old_type) *old_type = fs->default_bitmap_type; - profile_get_uint(e2fsck_global_ctx->profile, "bitmaps", - profile_name, 0, default_type, &type); - profile_get_uint(e2fsck_global_ctx->profile, "bitmaps", - "all", 0, type, &type); + profile_get_uint(ctx->profile, "bitmaps", profile_name, 0, + default_type, &type); + profile_get_uint(ctx->profile, "bitmaps", "all", 0, type, &type); fs->default_bitmap_type = type ? type : default_type; }