From 93d0db347e29fa49942aaf9f7dd0d42b33396e51 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Tue, 4 Mar 2014 19:10:26 -0500 Subject: [PATCH] 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" --- e2fsck/unix.c | 5 +++-- e2fsck/util.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 23316b8..155e6b4 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 9f920b2..4348631 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; } -- 1.8.3.1