This is an automated email from the git hooks/post-receive script.
andyp pushed a commit to branch andyp-fsck_cx
in repository gfs2-utils.
commit 2dd2e939c25b12bc4b50faf6f3ed1d14a09a7076
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Mon Aug 1 11:43:37 2022 +0100
fsck.gfs2: Pass fsck_cx into fsck_query()
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/afterpass1_common.c | 2 +-
gfs2/fsck/fs_recovery.c | 23 ++++++++--------
gfs2/fsck/fsck.h | 6 ++---
gfs2/fsck/initialize.c | 36 ++++++++++++-------------
gfs2/fsck/main.c | 2 +-
gfs2/fsck/metawalk.c | 10 +++----
gfs2/fsck/pass1.c | 30 ++++++++++-----------
gfs2/fsck/pass1b.c | 12 ++++-----
gfs2/fsck/pass2.c | 63 +++++++++++++++++++++----------------------
gfs2/fsck/pass3.c | 11 ++++----
gfs2/fsck/pass4.c | 10 +++----
gfs2/fsck/pass5.c | 7 +++--
gfs2/fsck/rgrepair.c | 8 +++---
gfs2/fsck/util.c | 6 ++---
14 files changed, 110 insertions(+), 116 deletions(-)
diff --git a/gfs2/fsck/afterpass1_common.c b/gfs2/fsck/afterpass1_common.c
index 9e27d9ba..999b74dc 100644
--- a/gfs2/fsck/afterpass1_common.c
+++ b/gfs2/fsck/afterpass1_common.c
@@ -290,7 +290,7 @@ int delete_eattr_extentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
int i, __b
if (error) {
log_err(_("Bad extended attribute found at block %"PRIu64 "
(0x%"PRIx64")"),
be64_to_cpu(*ea_data_ptr), be64_to_cpu(*ea_data_ptr));
- if (query( _("Repair the bad Extended Attribute? (y/n) "))) {
+ if (query(cx, _("Repair the bad Extended Attribute? (y/n) "))) {
ea_hdr->ea_num_ptrs = i;
ea_hdr->ea_data_len = cpu_to_be32(tot_ealen);
*ea_data_ptr = 0;
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
index 0fd92442..d778167e 100644
--- a/gfs2/fsck/fs_recovery.c
+++ b/gfs2/fsck/fs_recovery.c
@@ -476,8 +476,7 @@ int preen_is_safe(struct lgfs2_sbd *sdp, const struct fsck_options *
const _opts
* Returns: errno
*/
-static int recover_journal(struct lgfs2_inode *ip, int j, const struct fsck_options *
const _opts,
- int *was_clean)
+static int recover_journal(struct lgfs2_inode *ip, int j, struct fsck_cx *cx, int
*was_clean)
{
struct lgfs2_sbd *sdp = ip->i_sbd;
struct lgfs2_log_header head;
@@ -499,12 +498,12 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const
struct fsck_opti
}
}
if (error) {
- if (_opts->no) {
+ if (cx->opts->no) {
log_err( _("Journal #%d (\"journal%d\") is corrupt\n"),j+1, j);
log_err( _("Not fixing it due to the -n option.\n"));
goto out;
}
- if (!preen_is_safe(sdp, _opts)) {
+ if (!preen_is_safe(sdp, cx->opts)) {
log_err(_("Journal #%d (\"journal%d\") is corrupt.\n"),
j+1, j);
log_err(_("I'm not fixing it because it may be unsafe:\n"
@@ -515,7 +514,7 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const struct
fsck_opti
"without -a or -p.\n"));
goto out;
}
- if (!query( _("\nJournal #%d (\"journal%d\") is "
+ if (!query(cx, _("\nJournal #%d (\"journal%d\") is "
"corrupt. Okay to repair it? (y/n)"),
j+1, j)) {
log_err( _("jid=%u: The journal was not repaired.\n"),
@@ -543,12 +542,12 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const
struct fsck_opti
*was_clean = 1;
return 0;
}
- if (_opts->no) {
+ if (cx->opts->no) {
log_err(_("Journal #%d (\"journal%d\") is dirty\n"),j+1, j);
log_err(_("not replaying due to the -n option.\n"));
goto out;
}
- if (!preen_is_safe(sdp, _opts)) {
+ if (!preen_is_safe(sdp, cx->opts)) {
log_err( _("Journal #%d (\"journal%d\") is dirty\n"), j+1, j);
log_err( _("I'm not replaying it because it may be unsafe:\n"
"Locking protocol is not lock_nolock and "
@@ -559,7 +558,7 @@ static int recover_journal(struct lgfs2_inode *ip, int j, const struct
fsck_opti
error = FSCK_ERROR;
goto out;
}
- if (!query( _("\nJournal #%d (\"journal%d\") is dirty. Okay to "
+ if (!query(cx, _("\nJournal #%d (\"journal%d\") is dirty. Okay to
"
"replay it? (y/n)"), j+1, j))
goto reinit;
@@ -596,7 +595,7 @@ out:
}
log_err( _("jid=%u: Failed\n"), j);
reinit:
- if (query( _("Do you want to clear the journal instead? (y/n)"))) {
+ if (query(cx, _("Do you want to clear the journal instead? (y/n)"))) {
error = lgfs2_write_journal(sdp->md.journal[j], sdp->sd_bsize,
sdp->md.journal[j]->i_size /
sdp->sd_bsize);
@@ -710,7 +709,7 @@ int replay_journals(struct fsck_cx *cx, int *clean_journals)
if (sdp->jsize == LGFS2_DEFAULT_JSIZE && jsize &&
jsize != sdp->jsize)
sdp->jsize = jsize;
- error = recover_journal(sdp->md.journal[i], i, cx->opts, &clean);
+ error = recover_journal(sdp->md.journal[i], i, cx, &clean);
if (!clean)
dirty_journals++;
if (!gave_msg && dirty_journals == 1 && !cx->opts->no
&&
@@ -890,7 +889,7 @@ int init_jindex(struct fsck_cx *cx, int allow_ji_rebuild)
"corrupt.\n"));
return -1;
}
- if (!query( _("The gfs2 system jindex inode is missing. "
+ if (!query(cx, _("The gfs2 system jindex inode is missing. "
"Okay to rebuild it? (y/n) "))) {
log_crit(_("Error: cannot proceed without a valid "
"jindex file.\n"));
@@ -920,7 +919,7 @@ int init_jindex(struct fsck_cx *cx, int allow_ji_rebuild)
&jindex_check_fxns);
if (error) {
log_err(_("The system journal index is damaged.\n"));
- if (!query( _("Okay to rebuild it? (y/n) "))) {
+ if (!query(cx, _("Okay to rebuild it? (y/n) "))) {
log_crit(_("Error: cannot proceed without a "
"valid jindex file.\n"));
return -1;
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
index b854997e..34faf3ca 100644
--- a/gfs2/fsck/fsck.h
+++ b/gfs2/fsck/fsck.h
@@ -10,7 +10,7 @@
#define FSCK_HASH_SIZE (1 << FSCK_HASH_SHIFT)
#define FSCK_HASH_MASK (FSCK_HASH_SIZE - 1)
-#define query(fmt, args...) fsck_query(fmt, ##args)
+#define query(cx, fmt, args...) fsck_query(cx, fmt, ##args)
/*
* Exit codes used by fsck-type programs
@@ -140,8 +140,8 @@ extern int pass3(struct fsck_cx *cx);
extern int pass4(struct fsck_cx *cx);
extern int pass5(struct fsck_cx *cx, struct bmap *bl);
extern int rindex_repair(struct fsck_cx *cx, int trust_lvl, int *ok);
-extern int fsck_query(const char *format, ...)
- __attribute__((format(printf,1,2)));
+extern int fsck_query(struct fsck_cx *cx, const char *format, ...)
+ __attribute__((format(printf,2,3)));
extern struct dir_info *dirtree_find(struct fsck_cx *cx, uint64_t block);
extern void dup_delete(struct fsck_cx *cx, struct duptree *dt);
extern void dirtree_delete(struct fsck_cx *cx, struct dir_info *b);
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
index e08a5169..671e34f1 100644
--- a/gfs2/fsck/initialize.c
+++ b/gfs2/fsck/initialize.c
@@ -265,7 +265,7 @@ static void check_rgrp_integrity(struct fsck_cx *cx, struct
lgfs2_rgrp_tree *rgd
"metadata in resource group "
"%"PRIu64" (0x%"PRIx64")? (y/n)"),
rgd->rt_addr, rgd->rt_addr);
- if (query("%s", msg))
+ if (query(cx, "%s", msg))
*fixit = 1;
}
if (!(*fixit)) {
@@ -324,7 +324,7 @@ static void check_rgrp_integrity(struct fsck_cx *cx, struct
lgfs2_rgrp_tree *rgd
log_err( _("Error: resource group %"PRIu64" (0x%"PRIx64"):
"
"free space (%d) does not match bitmap (%d)\n"),
rgd->rt_addr, rgd->rt_addr, rgd->rt_free, rg_free);
- if (query( _("Fix the rgrp free blocks count? (y/n)"))) {
+ if (query(cx, _("Fix the rgrp free blocks count? (y/n)"))) {
rgd->rt_free = rg_free;
if (sdp->gfs1)
lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
@@ -345,7 +345,7 @@ static void check_rgrp_integrity(struct fsck_cx *cx, struct
lgfs2_rgrp_tree *rgd
log_err(_("Error: resource group %"PRIu64" (0x%"PRIx64"):
"
"free meta (%d) does not match bitmap (%d)\n"),
rgd->rt_addr, rgd->rt_addr, rgd->rt_freemeta, rg_unlinked);
- if (query( _("Fix the rgrp free meta blocks count? (y/n)"))) {
+ if (query(cx, _("Fix the rgrp free meta blocks count? (y/n)"))) {
rgd->rt_freemeta = rg_unlinked;
lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
rgd->bits[0].bi_modified = 1;
@@ -360,7 +360,7 @@ static void check_rgrp_integrity(struct fsck_cx *cx, struct
lgfs2_rgrp_tree *rgd
log_err(_("Error: resource group %"PRIu64" (0x%"PRIx64"): used
dinode "
"count (%d) does not match bitmap (%d)\n"),
rgd->rt_addr, rgd->rt_addr, rgd->rt_useddi, rg_useddi);
- if (query( _("Fix the rgrp used dinode block count? (y/n)"))) {
+ if (query(cx, _("Fix the rgrp used dinode block count? (y/n)"))) {
rgd->rt_useddi = rg_useddi;
lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
rgd->bits[0].bi_modified = 1;
@@ -375,7 +375,7 @@ static void check_rgrp_integrity(struct fsck_cx *cx, struct
lgfs2_rgrp_tree *rgd
log_err(_("Error: resource group %"PRIu64" (0x%"PRIx64"): used
"
"metadata (%d) does not match bitmap (%d)\n"),
rgd->rt_addr, rgd->rt_addr, rgd->rt_usedmeta, rg_usedmeta);
- if (query( _("Fix the rgrp used meta blocks count? (y/n)"))) {
+ if (query(cx, _("Fix the rgrp used meta blocks count? (y/n)"))) {
rgd->rt_usedmeta = rg_usedmeta;
lgfs2_gfs_rgrp_out(rgd, rgd->bits[0].bi_data);
rgd->bits[0].bi_modified = 1;
@@ -438,7 +438,7 @@ static int rebuild_sysdir(struct fsck_cx *cx)
int err = 0;
log_err(_("The system directory seems to be destroyed.\n"));
- if (!query(_("Okay to rebuild it? (y/n)"))) {
+ if (!query(cx, _("Okay to rebuild it? (y/n)"))) {
log_err(_("System directory not rebuilt; aborting.\n"));
return -1;
}
@@ -606,7 +606,7 @@ static void lookup_per_node(struct fsck_cx *cx, int allow_rebuild)
return;
}
- if (query( _("The gfs2 system per_node directory "
+ if (query(cx, _("The gfs2 system per_node directory "
"inode is missing. Okay to rebuild it? (y/n) "))) {
int err;
@@ -800,7 +800,7 @@ static int init_system_inodes(struct fsck_cx *cx)
/* Look for "inum" entry in master dinode */
lgfs2_lookupi(sdp->master_dir, "inum", 4, &sdp->md.inum);
if (!sdp->md.inum) {
- if (!query( _("The gfs2 system inum inode is missing. "
+ if (!query(cx, _("The gfs2 system inum inode is missing. "
"Okay to rebuild it? (y/n) "))) {
log_err( _("fsck.gfs2 cannot continue without "
"a valid inum file; aborting.\n"));
@@ -833,7 +833,7 @@ static int init_system_inodes(struct fsck_cx *cx)
/* In gfs1, the license_di is always 3 blocks after the jindex_di */
if ((sdp->sd_license_di.in_addr != sdp->sd_jindex_di.in_addr + 3) ||
(sdp->sd_license_di.in_formal_ino != sdp->sd_jindex_di.in_addr + 3)) {
- if (!query( _("The gfs system statfs inode pointer is incorrect. "
+ if (!query(cx, _("The gfs system statfs inode pointer is incorrect. "
"Okay to correct? (y/n) "))) {
log_err( _("fsck.gfs2 cannot continue without a valid "
"statfs file; aborting.\n"));
@@ -851,7 +851,7 @@ static int init_system_inodes(struct fsck_cx *cx)
} else
lgfs2_lookupi(sdp->master_dir, "statfs", 6, &sdp->md.statfs);
if (!sdp->gfs1 && !sdp->md.statfs) {
- if (!query( _("The gfs2 system statfs inode is missing. "
+ if (!query(cx, _("The gfs2 system statfs inode is missing. "
"Okay to rebuild it? (y/n) "))) {
log_err( _("fsck.gfs2 cannot continue without a valid "
"statfs file; aborting.\n"));
@@ -890,7 +890,7 @@ static int init_system_inodes(struct fsck_cx *cx)
/* In gfs1, the quota_di is always 2 blocks after the jindex_di */
if ((sdp->sd_quota_di.in_addr != sdp->sd_jindex_di.in_addr + 2) ||
(sdp->sd_quota_di.in_formal_ino != sdp->sd_jindex_di.in_addr + 2)) {
- if (!query( _("The gfs system quota inode pointer is incorrect. "
+ if (!query(cx, _("The gfs system quota inode pointer is incorrect. "
" Okay to correct? (y/n) "))) {
log_err( _("fsck.gfs2 cannot continue without a valid "
"quota file; aborting.\n"));
@@ -908,7 +908,7 @@ static int init_system_inodes(struct fsck_cx *cx)
} else
lgfs2_lookupi(sdp->master_dir, "quota", 5, &sdp->md.qinode);
if (!sdp->gfs1 && !sdp->md.qinode) {
- if (!query( _("The gfs2 system quota inode is missing. "
+ if (!query(cx, _("The gfs2 system quota inode is missing. "
"Okay to rebuild it? (y/n) "))) {
log_crit(_("System quota inode was not "
"rebuilt. Aborting.\n"));
@@ -1087,7 +1087,7 @@ static void peruse_user_dinode(struct fsck_cx *cx, struct
lgfs2_inode *ip)
log_warn(_("Found a copy of the root directory in a journal "
"at block: 0x%"PRIx64".\n"),
ip->i_bh->b_blocknr);
- if (!query(_("Do you want to replace the root dinode from the copy? (y/n)")))
{
+ if (!query(cx, _("Do you want to replace the root dinode from the copy?
(y/n)"))) {
log_err(_("Damaged root dinode not fixed.\n"));
return;
}
@@ -1287,7 +1287,7 @@ static int sb_repair(struct fsck_cx *cx)
"reinitializing it.\n"
"Hopefully everything will later "
"be put into lost+found.\n"));
- if (!query(_("Okay to reinitialize the root "
+ if (!query(cx, _("Okay to reinitialize the root "
"dinode? (y/n)"))) {
log_err(_("The root dinode was not "
"reinitialized; aborting.\n"));
@@ -1302,7 +1302,7 @@ static int sb_repair(struct fsck_cx *cx)
}
}
/* Step 3 - Rebuild the lock protocol and file system table name */
- if (query(_("Okay to fix the GFS2 superblock? (y/n)"))) {
+ if (query(cx, _("Okay to fix the GFS2 superblock? (y/n)"))) {
log_info(_("Found system master directory at: 0x%"PRIx64"\n"),
sdp->sd_meta_dir.in_addr);
sdp->master_dir = lgfs2_inode_read(sdp, sdp->sd_meta_dir.in_addr);
@@ -1427,7 +1427,7 @@ static int reset_journal_seg_size(struct fsck_cx *cx, unsigned int
jsize, unsign
seg_size = 16; /* The default with 128MB journal and 4K bsize */
if (seg_size != sdp->sd_seg_size) {
sdp->sd_seg_size = seg_size;
- if (!query(_("Computed correct journal segment size to %u."
+ if (!query(cx, _("Computed correct journal segment size to %u."
" Reset it? (y/n) "), seg_size)) {
log_crit(_("Error: Cannot proceed without a valid journal"
" segment size value.\n"));
@@ -1456,7 +1456,7 @@ static int correct_journal_seg_size(struct fsck_cx *cx)
if (sdp->md.journals == 1) {
if (sdp->sd_seg_size == 0) {
- if (!query(_("The gfs2 journal segment size is 0 and a"
+ if (!query(cx, _("The gfs2 journal segment size is 0 and a"
" correct value cannot be determined in a"
" single-journal filesystem.\n"
"Continue with default? (y/n) "))) {
@@ -1538,7 +1538,7 @@ static int init_rindex(struct fsck_cx *cx)
if (sdp->md.riinode)
return 0;
- if (!query( _("The gfs2 system rindex inode is missing. "
+ if (!query(cx, _("The gfs2 system rindex inode is missing. "
"Okay to rebuild it? (y/n) "))) {
log_crit(_("Error: Cannot proceed without a valid rindex.\n"));
return -1;
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index b070ec9b..cda02def 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -208,7 +208,7 @@ static int check_statfs(struct fsck_cx *cx)
sdp->dinodes_alloced, sdp->dinodes_alloced);
errors_found++;
- if (!query( _("Okay to fix the master statfs file? (y/n)"))) {
+ if (!query(cx, _("Okay to fix the master statfs file? (y/n)"))) {
log_err( _("The statfs file was not fixed.\n"));
return 0;
}
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index 498a2abe..9fb36aac 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -69,7 +69,7 @@ int check_n_fix_bitmap(struct fsck_cx *cx, struct lgfs2_rgrp_tree *rgd,
huge and unmanageable. */
log_err(_("Block %"PRIu64" (0x%"PRIx64") was '%s',
should be %s.\n"),
blk, blk, allocdesc[sdp->gfs1][old_state],
allocdesc[sdp->gfs1][new_state]);
- if (!query( _("Fix the bitmap? (y/n)"))) {
+ if (!query(cx, _("Fix the bitmap? (y/n)"))) {
log_err( _("The bitmap inconsistency was ignored.\n"));
return 0;
}
@@ -421,7 +421,7 @@ static int check_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct lgfs
"is corrupt.\n"),
bh->b_blocknr, bh->b_blocknr, (*count) + 1,
ip->i_num.in_addr, ip->i_num.in_addr);
- if (query( _("Attempt to repair it? (y/n) "))) {
+ if (query(cx, _("Attempt to repair it? (y/n) "))) {
if (dirent_repair(ip, bh, &d, dent, type,
first)) {
if (first) /* make a new sentinel */
@@ -455,7 +455,7 @@ static int check_entries(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct lgfs
"directory %"PRIu64" (0x%"PRIx64")!\n"),
bh->b_blocknr, bh->b_blocknr,
ip->i_num.in_addr, ip->i_num.in_addr);
- if (query(_("Attempt to remove it? (y/n) "))) {
+ if (query(cx, _("Attempt to remove it? (y/n) "))) {
dirblk_truncate(ip, prev, bh);
log_err(_("The corrupt directory "
"entry was removed.\n"));
@@ -604,7 +604,7 @@ int check_leaf(struct fsck_cx *cx, struct lgfs2_inode *ip, int lindex,
struct me
"number of entries found - is %u, found %u\n"),
*leaf_no, *leaf_no, ip->i_num.in_addr, ip->i_num.in_addr,
leaf->lf_entries, count);
- if (query( _("Update leaf entry count? (y/n) "))) {
+ if (query(cx, _("Update leaf entry count? (y/n) "))) {
leaf->lf_entries = count;
lgfs2_leaf_out(leaf, lbh->b_data);
lgfs2_bmodified(lbh);
@@ -1568,7 +1568,7 @@ undo_metalist:
"%"PRIu64" (0x%"PRIx64").\n"),
ip->i_num.in_addr, ip->i_num.in_addr, error_blk.metablk,
error_blk.metablk,
error_blk.metaoff, error_blk.metaoff, error_blk.errblk, error_blk.errblk);
- if (!query( _("Remove the invalid inode? (y/n) "))) {
+ if (!query(cx, _("Remove the invalid inode? (y/n) "))) {
free_metalist(ip, metalist);
log_err(_("Invalid inode not deleted.\n"));
return error;
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
index 6fabe278..deac85cf 100644
--- a/gfs2/fsck/pass1.c
+++ b/gfs2/fsck/pass1.c
@@ -102,7 +102,7 @@ static int p1_repair_leaf(struct fsck_cx *cx, struct lgfs2_inode *ip,
uint64_t *
log_err(_("Directory Inode %"PRIu64" (0x%"PRIx64") points to
leaf %"PRIu64" (0x%"PRIx64") %s.\n"),
ip->i_num.in_addr, ip->i_num.in_addr, *leaf_no, *leaf_no, msg);
- if (!query( _("Attempt to patch around it? (y/n) "))) {
+ if (!query(cx, _("Attempt to patch around it? (y/n) "))) {
log_err( _("Bad leaf left in place.\n"));
goto out;
}
@@ -303,7 +303,7 @@ static int p1_check_metalist(struct fsck_cx *cx, struct iptr iptr,
struct lgfs2_
"pointer %"PRIu64" (0x%"PRIx64") (points to
something "
"that is not %s).\n"),
ip->i_num.in_addr, ip->i_num.in_addr, block, block, blktypedesc);
- if (query(_("Zero the indirect block pointer? (y/n) "))){
+ if (query(cx, _("Zero the indirect block pointer? (y/n) "))){
*iptr_ptr(iptr) = 0;
lgfs2_bmodified(iptr.ipt_bh);
*is_valid = 1;
@@ -554,7 +554,7 @@ static int ask_remove_inode_eattr(struct fsck_cx *cx, struct
lgfs2_inode *ip,
return 0; /* eattr was removed prior to this call */
log_err(_("Inode %"PRIu64" (0x%"PRIx64") has unrecoverable
Extended Attribute errors.\n"),
ip->i_num.in_addr, ip->i_num.in_addr);
- if (query( _("Clear all Extended Attributes from the inode? (y/n) "))){
+ if (query(cx, _("Clear all Extended Attributes from the inode? (y/n) "))){
undo_reference(cx, ip, ip->i_eattr, 0, bc);
ip->i_eattr = 0;
bc->ea_count = 0;
@@ -683,7 +683,7 @@ static int p1_finish_eattr_indir(struct fsck_cx *cx, struct
lgfs2_inode *ip, int
return 0;
log_err(_("Inode %"PRIu64" (0x%"PRIx64") has recoverable
indirect extended attribute errors.\n"),
ip->i_num.in_addr, ip->i_num.in_addr);
- if (query( _("Okay to fix the block count for the inode? (y/n) "))) {
+ if (query(cx, _("Okay to fix the block count for the inode? (y/n) "))) {
ip->i_blocks = 1 + bc->indir_count + bc->data_count + bc->ea_count;
lgfs2_bmodified(ip->i_bh);
log_err(_("Block count fixed:
1+%"PRIu64"+%"PRIu64"+%"PRIu64" =
%"PRIu64".\n"),
@@ -791,7 +791,7 @@ static int p1_check_extended_leaf_eattr(struct fsck_cx *cx, struct
lgfs2_inode *
if (error) {
log_err(_("Bad extended attribute found at block %"PRIu64"
(0x%"PRIx64")"),
be64_to_cpu(*data_ptr), be64_to_cpu(*data_ptr));
- if (query( _("Repair the bad Extended Attribute? (y/n) "))) {
+ if (query(cx, _("Repair the bad Extended Attribute? (y/n) "))) {
ea_hdr->ea_num_ptrs = i;
ea_hdr->ea_data_len = cpu_to_be32(tot_ealen);
*data_ptr = 0;
@@ -834,7 +834,7 @@ static int ask_remove_eattr_entry(struct fsck_cx *cx,
struct gfs2_ea_header *prev,
int fix_curr, int fix_curr_len)
{
- if (!query( _("Remove the bad Extended Attribute entry? (y/n) "))) {
+ if (!query(cx, _("Remove the bad Extended Attribute entry? (y/n) "))) {
log_err( _("Bad Extended Attribute not removed.\n"));
return 0;
}
@@ -1281,10 +1281,8 @@ static int handle_ip(struct fsck_cx *cx, struct lgfs2_inode *ip)
error = check_inode_eattr(cx, ip, &pass1_fxns);
if (error) {
- if (!query(_("Clear the bad Extended Attributes? "
- "(y/n) "))) {
- log_err( _("The bad Extended Attributes were "
- "not fixed.\n"));
+ if (!query(cx, _("Clear the bad Extended Attributes? (y/n) "))) {
+ log_err(_("The bad Extended Attributes were not fixed.\n"));
return 0;
}
log_err(_("Clearing the bad Extended Attributes in "
@@ -1305,7 +1303,7 @@ static int handle_ip(struct fsck_cx *cx, struct lgfs2_inode *ip)
log_info(_("inode has: %"PRIu64", but fsck counts: Dinode:1 + "
"indir:%"PRIu64" + data: %"PRIu64" + ea:
%"PRIu64"\n"),
ip->i_blocks, bc.indir_count, bc.data_count, bc.ea_count);
- if (query( _("Fix ondisk block count? (y/n) "))) {
+ if (query(cx, _("Fix ondisk block count? (y/n) "))) {
ip->i_blocks = 1 + bc.indir_count + bc.data_count + bc.ea_count;
lgfs2_bmodified(ip->i_bh);
log_err(_("Block count for #%"PRIu64" (0x%"PRIx64")
fixed\n"),
@@ -1331,7 +1329,7 @@ static void check_i_goal(struct fsck_cx *cx, struct lgfs2_inode
*ip)
log_err(_("Inode #%"PRIu64" (0x%"PRIx64"): Bad allocation goal
block "
"found: %"PRIu64" (0x%"PRIx64")\n"),
ip->i_num.in_addr, ip->i_num.in_addr, ip->i_goal_meta,
ip->i_goal_meta);
- if (query(_("Fix goal block in inode #%"PRIu64" (0x%"PRIx64")?
(y/n) "),
+ if (query(cx, _("Fix goal block in inode #%"PRIu64"
(0x%"PRIx64")? (y/n) "),
ip->i_num.in_addr, ip->i_num.in_addr)) {
ip->i_goal_meta = ip->i_num.in_addr;
lgfs2_bmodified(ip->i_bh);
@@ -1359,7 +1357,7 @@ static int handle_di(struct fsck_cx *cx, struct lgfs2_rgrp_tree
*rgd,
log_err(_("Inode #%"PRIu64" (0x%"PRIx64"): Bad inode address
found: %"PRIu64
" (0x%"PRIx64")\n"),
block, block, ip->i_num.in_addr, ip->i_num.in_addr);
- if (query(_("Fix address in inode at block #%"PRIu64"
(0x%"PRIx64")? (y/n) "),
+ if (query(cx, _("Fix address in inode at block #%"PRIu64"
(0x%"PRIx64")? (y/n) "),
block, block)) {
ip->i_num.in_addr = ip->i_num.in_formal_ino = block;
lgfs2_bmodified(ip->i_bh);
@@ -1371,7 +1369,7 @@ static int handle_di(struct fsck_cx *cx, struct lgfs2_rgrp_tree
*rgd,
log_err(_("Inode #%"PRIu64" (0x%"PRIx64"): GFS1 formal inode
number "
"mismatch: was %"PRIu64" (0x%"PRIx64")\n"),
block, block, ip->i_num.in_formal_ino, ip->i_num.in_formal_ino);
- if (query(_("Fix formal inode number in inode #%"PRIu64"
(0x%"PRIx64")? (y/n) "),
+ if (query(cx, _("Fix formal inode number in inode #%"PRIu64"
(0x%"PRIx64")? (y/n) "),
block, block)) {
ip->i_num.in_formal_ino = block;
lgfs2_bmodified(ip->i_bh);
@@ -1437,7 +1435,7 @@ static int check_system_inode(struct fsck_cx *cx,
!((*sysinode)->i_flags & GFS2_DIF_SYSTEM)) {
log_err( _("System inode %s is missing the 'system' "
"flag. It should be rebuilt.\n"), filename);
- if (sysdir && query(_("Delete the corrupt %s system "
+ if (sysdir && query(cx, _("Delete the corrupt %s system "
"inode? (y/n) "), filename)) {
lgfs2_inode_put(sysinode);
lgfs2_dirent_del(sysdir, filename,
@@ -1462,7 +1460,7 @@ static int check_system_inode(struct fsck_cx *cx,
"should be '%s').\n"), filename,
block_type_string(ds.q),
block_type_string(GFS2_BLKST_DINODE));
- if (query(_("Create new %s system inode? (y/n) "), filename)) {
+ if (query(cx, _("Create new %s system inode? (y/n) "), filename)) {
log_err( _("Rebuilding system file \"%s\"\n"),
filename);
error = builder(cx->sdp);
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index b3fe1b4f..5ccbf412 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -103,7 +103,7 @@ static void clone_data_block(struct fsck_cx *cx, struct duptree *dt,
struct lgfs2_buffer_head *bh;
__be64 *ptr;
- if (!(query(_("Okay to clone data block %"PRIu64" (0x%"PRIx64")
for inode %"PRIu64" (0x%"PRIx64")? (y/n) "),
+ if (!(query(cx, _("Okay to clone data block %"PRIu64"
(0x%"PRIx64") for inode %"PRIu64" (0x%"PRIx64")? (y/n)
"),
dt->block, dt->block, id->block_no, id->block_no))) {
log_warn(_("The duplicate reference was not cloned.\n"));
return;
@@ -248,7 +248,7 @@ static void resolve_dup_references(struct fsck_cx *cx, struct duptree
*dt,
id->name, id->block_no, id->block_no, dt->block, dt->block,
reftypes[this_ref], reftypes[acceptable_ref]);
if (this_ref == REF_AS_EA) {
- if (!(query(_("Okay to remove extended attributes "
+ if (!(query(cx, _("Okay to remove extended attributes "
"from %s inode %"PRIu64" (0x%"PRIx64")? (y/n)
"),
(inval ? _("invalidated") : ""),
id->block_no, id->block_no))) {
@@ -269,7 +269,7 @@ static void resolve_dup_references(struct fsck_cx *cx, struct duptree
*dt,
dup_listent_delete(dt, id);
revise_dup_handler(cx, dt->block, dh);
continue;
- } else if (!(query(_("Okay to delete %s inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
+ } else if (!(query(cx, _("Okay to delete %s inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
(inval ? _("invalidated") : ""),
id->block_no, id->block_no))) {
log_warn( _("The bad inode was not cleared."));
@@ -409,7 +409,7 @@ static int clone_data(struct fsck_cx *cx, struct lgfs2_inode *ip,
uint64_t metab
log_err(_("Error: Inode %"PRIu64" (0x%"PRIx64")'s reference
to block %"PRIu64
" (0x%"PRIx64") should be replaced with a clone.\n"),
ip->i_num.in_addr, ip->i_num.in_addr, block, block);
- if (query( _("Okay to clone the duplicated reference? (y/n) "))) {
+ if (query(cx, _("Okay to clone the duplicated reference? (y/n) "))) {
error = lgfs2_meta_alloc(ip, &cloneblock);
if (!error) {
clone_bh = lgfs2_bread(ip->i_sbd, clonet->dup_block);
@@ -430,7 +430,7 @@ static int clone_data(struct fsck_cx *cx, struct lgfs2_inode *ip,
uint64_t metab
}
}
log_err(_("Error: Unable to allocate a new data block.\n"));
- if (!query("Should I zero the reference instead? (y/n)")) {
+ if (!query(cx, _("Zero the reference instead? (y/n)"))) {
log_err(_("Duplicate reference to block %"PRIu64
" (0x%"PRIx64") was not fixed.\n"),
block, block);
@@ -573,7 +573,7 @@ static void resolve_last_reference(struct fsck_cx *cx, struct duptree
*dt,
"in inode %"PRIu64" (0x%"PRIx64") but the block is "
"not an extended attribute block.\n"),
dt->block, dt->block, id->block_no, id->block_no);
- if (query(_("Okay to remove the bad extended "
+ if (query(cx, _("Okay to remove the bad extended "
"attribute from inode %"PRIu64" (0x%"PRIx64")? "
"(y/n) "),
id->block_no, id->block_no)) {
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 9d5f2489..a0681ba8 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -197,7 +197,7 @@ static int bad_formal_ino(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs
entry.in_formal_ino, entry.in_formal_ino,
inum.in_formal_ino, inum.in_formal_ino);
if (q != GFS2_BLKST_DINODE || !strcmp("..", tmp_name)) {
- if (query( _("Remove the corrupt directory entry? (y/n) ")))
+ if (query(cx, _("Remove the corrupt directory entry? (y/n) ")))
return 1;
log_err( _("Corrupt directory entry not removed.\n"));
return 0;
@@ -210,7 +210,7 @@ static int bad_formal_ino(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs
if (!error && childs_dotdot.in_addr == ip->i_num.in_addr) {
log_err( _("The entry points to another directory with intact "
"linkage.\n"));
- if (query( _("Fix the bad directory entry? (y/n) "))) {
+ if (query(cx, _("Fix the bad directory entry? (y/n) "))) {
log_err( _("Fixing the corrupt directory entry.\n"));
entry.in_formal_ino = inum.in_formal_ino;
d->dr_inum.in_formal_ino = entry.in_formal_ino;
@@ -222,7 +222,7 @@ static int bad_formal_ino(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs
log_err( _("Directory entry not fixed.\n"));
}
} else {
- if (query( _("Remove the corrupt directory entry? (y/n) "))) {
+ if (query(cx, _("Remove the corrupt directory entry? (y/n) "))) {
lgfs2_inode_put(&child_ip);
return 1;
}
@@ -274,7 +274,7 @@ static int check_leaf_depth(struct fsck_cx *cx, struct lgfs2_inode
*ip, uint64_t
"wrong depth: is %d (length %d), should be %d (length %d).\n"),
leaf_no, leaf_no, ip->i_num.in_addr, ip->i_num.in_addr,
cur_depth, ref_count, correct_depth, exp_count);
- if (!query( _("Fix the leaf block? (y/n)"))) {
+ if (!query(cx, _("Fix the leaf block? (y/n)"))) {
log_err( _("The leaf block was not fixed.\n"));
return 0;
}
@@ -308,8 +308,7 @@ static int wrong_leaf(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct lgfs2_i
tmp_name, entry->in_addr, entry->in_addr);
log_err(_("Leaf index is: 0x%x. The range for this leaf block is "
"0x%x - 0x%x\n"), hash_index, *lindex, lindex_max);
- if (!query( _("Move the misplaced directory entry to "
- "a valid leaf block? (y/n) "))) {
+ if (!query(cx, _("Move the misplaced directory entry to a valid leaf block? (y/n)
"))) {
log_err( _("Misplaced directory entry not moved.\n"));
return 0;
}
@@ -439,7 +438,7 @@ static int basic_dentry_checks(struct fsck_cx *cx, struct lgfs2_inode
*ip, struc
log_err(_("Block # referenced by directory entry %s in inode %"PRIu64
" (0x%"PRIx64") is invalid\n"),
tmp_name, ip->i_num.in_addr, ip->i_num.in_addr);
- if (query( _("Clear directory entry to out of range block? (y/n) "))) {
+ if (query(cx, _("Clear directory entry to out of range block? (y/n) "))) {
return 1;
} else {
log_err( _("Directory entry to out of range block remains\n"));
@@ -456,7 +455,7 @@ static int basic_dentry_checks(struct fsck_cx *cx, struct lgfs2_inode
*ip, struc
log_err( _("Dir entry with bad record or name length\n"
"\tRecord length = %u\n\tName length = %u\n"),
d->dr_rec_len, d->dr_name_len);
- if (!query( _("Clear the directory entry? (y/n) "))) {
+ if (!query(cx, _("Clear the directory entry? (y/n) "))) {
log_err( _("Directory entry not fixed.\n"));
return 0;
}
@@ -479,7 +478,7 @@ static int basic_dentry_checks(struct fsck_cx *cx, struct lgfs2_inode
*ip, struc
log_err( _("\tName length found = %u\n"
"\tHash expected = %u (0x%x)\n"),
d->dr_name_len, calculated_hash, calculated_hash);
- if (!query( _("Fix directory hash for %s? (y/n) "),
+ if (!query(cx, _("Fix directory hash for %s? (y/n) "),
tmp_name)) {
log_err( _("Directory entry hash for %s not "
"fixed.\n"), tmp_name);
@@ -514,7 +513,7 @@ static int basic_dentry_checks(struct fsck_cx *cx, struct lgfs2_inode
*ip, struc
_("was previously marked invalid") :
_("was deleted or is not an inode"));
- if (!query(_("Clear directory entry to non-inode block? (y/n) "))) {
+ if (!query(cx, _("Clear directory entry to non-inode block? (y/n) "))) {
log_err( _("Directory entry to non-inode block remains\n"));
return 0;
}
@@ -554,7 +553,7 @@ static int basic_dentry_checks(struct fsck_cx *cx, struct lgfs2_inode
*ip, struc
de_type_string(d->dr_type), tmp_name,
entry->in_addr, entry->in_addr,
block_type_string(*q));
- if (!query( _("Clear stale directory entry? (y/n) "))) {
+ if (!query(cx, _("Clear stale directory entry? (y/n) "))) {
log_err( _("Stale directory entry remains\n"));
return 0;
}
@@ -650,7 +649,7 @@ static int dirref_find(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_d
" (0x%"PRIx64") but the correct value is: %"PRIu64"
(0x%"PRIx64")\n"),
fn, de->dr_inum.in_formal_ino, de->dr_inum.in_formal_ino,
entry->in_formal_ino, entry->in_formal_ino);
- if (!query(_("Delete the bad directory entry? (y/n) "))) {
+ if (!query(cx, _("Delete the bad directory entry? (y/n) "))) {
log_err(_("The corrupt directory entry was not fixed.\n"));
goto out;
}
@@ -758,7 +757,7 @@ static int check_dentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_
if (ds->dotdir) {
log_err(_("Already found '.' entry in directory %"PRIu64"
(0x%"PRIx64")\n"),
ip->i_num.in_addr, ip->i_num.in_addr);
- if (!query( _("Clear duplicate '.' entry? (y/n) "))) {
+ if (!query(cx, _("Clear duplicate '.' entry? (y/n) "))) {
log_err( _("Duplicate '.' entry remains\n"));
/* FIXME: Should we continue on here
* and check the rest of the '.' entry? */
@@ -784,7 +783,7 @@ static int check_dentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_
" (0x%"PRIx64").\n"),
entry.in_addr, entry.in_addr, entry.in_addr, entry.in_addr,
ip->i_num.in_addr, ip->i_num.in_addr);
- if (!query( _("Remove '.' reference? (y/n) "))) {
+ if (!query(cx, _("Remove '.' reference? (y/n) "))) {
log_err( _("Invalid '.' reference remains\n"));
/* Not setting ds->dotdir here since
* this '.' entry is invalid */
@@ -809,7 +808,7 @@ static int check_dentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_
if (ds->dotdotdir) {
log_err(_("Already had a '..' entry in directory %"PRIu64"
(0x%"PRIx64")\n"),
ip->i_num.in_addr, ip->i_num.in_addr);
- if (!query( _("Clear duplicate '..' entry? (y/n) "))) {
+ if (!query(cx, _("Clear duplicate '..' entry? (y/n) "))) {
log_err( _("Duplicate '..' entry remains\n"));
/* FIXME: Should we continue on here
* and check the rest of the '..'
@@ -831,7 +830,7 @@ static int check_dentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_
log_err(_("Found '..' entry in directory %"PRIu64"
(0x%"PRIx64") "
"pointing to something that's not a directory"),
ip->i_num.in_addr, ip->i_num.in_addr);
- if (!query( _("Clear bad '..' directory entry? (y/n) "))) {
+ if (!query(cx, _("Clear bad '..' directory entry? (y/n) "))) {
log_err( _("Bad '..' directory entry remains\n"));
goto dentry_is_valid;
}
@@ -887,7 +886,7 @@ static int check_dentry(struct fsck_cx *cx, struct lgfs2_inode *ip,
struct gfs2_
log_err(_("%s: Hard link to block %"PRIu64" (0x%"PRIx64")
detected.\n"),
tmp_name, entry.in_addr, entry.in_addr);
- if (query( _("Clear hard link to directory? (y/n) ")))
+ if (query(cx, _("Clear hard link to directory? (y/n) ")))
goto nuke_dentry;
else {
log_err( _("Hard link to directory remains\n"));
@@ -1082,7 +1081,7 @@ static int lost_leaf(struct fsck_cx *cx, struct lgfs2_inode *ip,
__be64 *tbl, ui
log_err(_("Leaf block %"PRIu64" (0x%"PRIx64") seems to be out
of place and its "
"contents need to be moved to lost+found.\n"),
leafno, leafno);
- if (!query( _("Attempt to fix it? (y/n) "))) {
+ if (!query(cx, _("Attempt to fix it? (y/n) "))) {
log_err( _("Directory leaf was not fixed.\n"));
return 0;
}
@@ -1216,7 +1215,7 @@ static int pass2_repair_leaf(struct fsck_cx *cx, struct lgfs2_inode
*ip, uint64_
log_err(_("Directory Inode %"PRIu64" (0x%"PRIx64") points to
leaf %"PRIu64" (0x%"PRIx64") %s.\n"),
ip->i_num.in_addr, ip->i_num.in_addr, *leaf_no, *leaf_no, msg);
- if (!query( _("Attempt to patch around it? (y/n) "))) {
+ if (!query(cx, _("Attempt to patch around it? (y/n) "))) {
log_err( _("Bad leaf left in place.\n"));
goto out;
}
@@ -1303,7 +1302,7 @@ static int fix_hashtable(struct fsck_cx *cx, struct lgfs2_inode *ip,
__be64 *tbl
log_err(_("Dinode %"PRIu64" (0x%"PRIx64") has a hash table
error at index "
"0x%x, length 0x%x: leaf block %"PRIu64"
(0x%"PRIx64")\n"),
ip->i_num.in_addr, ip->i_num.in_addr, lindex, len, leafblk, leafblk);
- if (!query( _("Fix the hash table? (y/n) "))) {
+ if (!query(cx, _("Fix the hash table? (y/n) "))) {
log_err(_("Hash table not fixed.\n"));
return 0;
}
@@ -1516,7 +1515,7 @@ static int check_hash_tbl_dups(struct fsck_cx *cx, struct
lgfs2_inode *ip, __be6
log_err(_("This leaf block has hash index %d, which "
"is out of bounds for lindex (%d - %d)\n"),
hash_index, l, l + len2);
- if (!query( _("Fix the hash table? (y/n) "))) {
+ if (!query(cx, _("Fix the hash table? (y/n) "))) {
log_err(_("Hash table not fixed.\n"));
return 0;
}
@@ -1539,7 +1538,7 @@ static int check_hash_tbl_dups(struct fsck_cx *cx, struct
lgfs2_inode *ip, __be6
log_err(_("This leaf block has hash index %d, which "
"is out of bounds for lindex (%d - %d).\n"),
hash_index, lindex, lindex + len);
- if (!query( _("Fix the hash table? (y/n) "))) {
+ if (!query(cx, _("Fix the hash table? (y/n) "))) {
log_err(_("Hash table not fixed.\n"));
return 0;
}
@@ -1633,7 +1632,7 @@ static int check_hash_tbl(struct fsck_cx *cx, struct lgfs2_inode
*ip, __be64 *tb
log_err(_("Dinode %"PRIu64" (0x%"PRIx64") has bad leaf
pointers "
"at offset %d for %d\n"),
ip->i_num.in_addr, ip->i_num.in_addr, lindex, len);
- if (!query( _("Fix the hash table? (y/n) "))) {
+ if (!query(cx, _("Fix the hash table? (y/n) "))) {
log_err(_("Hash table not fixed.\n"));
lindex += len;
continue;
@@ -1715,7 +1714,7 @@ static int check_hash_tbl(struct fsck_cx *cx, struct lgfs2_inode
*ip, __be64 *tb
"inconsistency at index %d (0x%x) for %d\n"),
ip->i_num.in_addr, ip->i_num.in_addr,
i, i, len);
- if (!query( _("Fix the hash table? (y/n) "))) {
+ if (!query(cx, _("Fix the hash table? (y/n) "))) {
log_err(_("Hash table not fixed.\n"));
continue;
}
@@ -1825,7 +1824,7 @@ static int check_pernode_for(struct fsck_cx *cx, int x, struct
lgfs2_inode *pern
error = lgfs2_lookupi(pernode, fn, strlen(fn), &ip);
if (error) {
log_err(_("System file %s is missing.\n"), fn);
- if (!query( _("Rebuild the system file? (y/n) ")))
+ if (!query(cx, _("Rebuild the system file? (y/n) ")))
return 0;
goto build_it;
}
@@ -1838,7 +1837,7 @@ static int check_pernode_for(struct fsck_cx *cx, int x, struct
lgfs2_inode *pern
if (!valid_size) {
log_err(_("System file %s has an invalid size. Is %"PRIu64", should be
%zu.\n"),
fn, ip->i_size, filelen);
- if (!query( _("Rebuild the system file? (y/n) ")))
+ if (!query(cx, _("Rebuild the system file? (y/n) ")))
goto out_good;
fsck_inode_put(&ip);
goto build_it;
@@ -1848,7 +1847,7 @@ static int check_pernode_for(struct fsck_cx *cx, int x, struct
lgfs2_inode *pern
if (!error)
goto out_good;
log_err(_("System file %s has bad contents.\n"), fn);
- if (!query( _("Delete and rebuild the system file? (y/n) ")))
+ if (!query(cx, _("Delete and rebuild the system file? (y/n) ")))
goto out_good;
check_metatree(cx, ip, &pass2_fxns_delete);
fsck_inode_put(&ip);
@@ -1949,7 +1948,7 @@ static int check_system_dir(struct fsck_cx *cx, struct lgfs2_inode
*sysinode, co
}
if (!ds.dotdir) {
log_err( _("No '.' entry found for %s directory.\n"), dirname);
- if (query( _("Is it okay to add '.' entry? (y/n) "))) {
+ if (query(cx, _("Is it okay to add '.' entry? (y/n) "))) {
struct lgfs2_inum no = sysinode->i_num;
log_warn( _("Adding '.' entry\n"));
error = lgfs2_dir_add(sysinode, ".", 1, &no,
@@ -1969,7 +1968,7 @@ static int check_system_dir(struct fsck_cx *cx, struct lgfs2_inode
*sysinode, co
log_err(_("%s inode %"PRIu64" (0x%"PRIx64"): Entries is %d -
should be %d\n"),
dirname, sysinode->i_num.in_addr, sysinode->i_num.in_addr,
sysinode->i_entries,
ds.entry_count);
- if (query( _("Fix entries for %s inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
+ if (query(cx, _("Fix entries for %s inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
dirname, sysinode->i_num.in_addr, sysinode->i_num.in_addr)) {
sysinode->i_entries = ds.entry_count;
lgfs2_bmodified(sysinode->i_bh);
@@ -2039,7 +2038,7 @@ static int pass2_check_dir(struct fsck_cx *cx, struct lgfs2_inode
*ip)
stack;
return FSCK_ERROR;
}
- if (query(_("Remove directory entry for bad inode %"PRIu64"
(0x%"PRIx64") in %"PRIu64" (0x%"PRIx64")? (y/n)"),
+ if (query(cx, _("Remove directory entry for bad inode %"PRIu64"
(0x%"PRIx64") in %"PRIu64" (0x%"PRIx64")? (y/n)"),
dirblk, dirblk, di->treewalk_parent, di->treewalk_parent)) {
error = remove_dentry_from_dir(cx, di->treewalk_parent, dirblk);
if (error < 0) {
@@ -2063,7 +2062,7 @@ static int pass2_check_dir(struct fsck_cx *cx, struct lgfs2_inode
*ip)
log_err(_("No '.' entry found for directory inode at block
%"PRIu64" (0x%"PRIx64")\n"),
dirblk, dirblk);
- if (query( _("Is it okay to add '.' entry? (y/n) "))) {
+ if (query(cx, _("Is it okay to add '.' entry? (y/n) "))) {
struct lgfs2_inum no = ip->i_num;
error = lgfs2_dir_add(ip, ".", 1, &no,
(cx->sdp->gfs1 ? GFS_FILE_DIR : DT_DIR));
@@ -2084,7 +2083,7 @@ static int pass2_check_dir(struct fsck_cx *cx, struct lgfs2_inode
*ip)
if (!fsck_abort && ip->i_entries != ds.entry_count) {
log_err(_("Entries is %d - should be %d for inode block %"PRIu64"
(0x%"PRIx64")\n"),
ip->i_entries, ds.entry_count, ip->i_num.in_addr, ip->i_num.in_addr);
- if (query(_("Fix the entry count? (y/n) "))) {
+ if (query(cx, _("Fix the entry count? (y/n) "))) {
ip->i_entries = ds.entry_count;
lgfs2_bmodified(ip->i_bh);
} else {
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index 293a66a8..64f309b9 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -122,7 +122,7 @@ static struct dir_info *mark_and_return_parent(struct fsck_cx *cx,
struct dir_in
/* FIXME: add a dinode for this entry instead? */
- if (!query(_("Remove directory entry for bad inode %"PRIu64"
(0x%"PRIx64") "
+ if (!query(cx, _("Remove directory entry for bad inode %"PRIu64"
(0x%"PRIx64") "
"in %"PRIu64" (0x%"PRIx64")? (y/n)"),
di->dinode.in_addr, di->dinode.in_addr,
di->treewalk_parent, di->treewalk_parent)) {
@@ -232,7 +232,7 @@ int pass3(struct fsck_cx *cx)
"containing bad block at block %"PRIu64
" (0x%"PRIx64")\n"),
di->dinode.in_addr, di->dinode.in_addr);
- if (query(_("Clear unlinked directory "
+ if (query(cx, _("Clear unlinked directory "
"with bad blocks? (y/n) "))) {
log_warn(_("inode %"PRIu64" (0x%"PRIx64") is "
"now marked as free\n"),
@@ -249,8 +249,7 @@ int pass3(struct fsck_cx *cx)
if (q != GFS2_BLKST_DINODE) {
log_err( _("Unlinked block marked as an inode "
"is not an inode\n"));
- if (!query(_("Clear the unlinked block?"
- " (y/n) "))) {
+ if (!query(cx, _("Clear the unlinked block? (y/n) "))) {
log_err( _("The block was not "
"cleared\n"));
fsck_inode_put(&ip);
@@ -273,7 +272,7 @@ int pass3(struct fsck_cx *cx)
if (!ip->i_size && !ip->i_eattr){
log_err( _("Unlinked directory has zero "
"size.\n"));
- if (query( _("Remove zero-size unlinked "
+ if (query(cx, _("Remove zero-size unlinked "
"directory? (y/n) "))) {
fsck_bitmap_set(cx, ip, di->dinode.in_addr,
_("zero-sized unlinked inode"),
@@ -285,7 +284,7 @@ int pass3(struct fsck_cx *cx)
"directory remains\n"));
}
}
- if (query( _("Add unlinked directory to "
+ if (query(cx, _("Add unlinked directory to "
"lost+found? (y/n) "))) {
if (add_inode_to_lf(cx, ip)) {
fsck_inode_put(&ip);
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index f63f4ff6..021cdf92 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -62,7 +62,7 @@ static int handle_unlinked(struct fsck_cx *cx, uint64_t no_addr,
if (q == GFS2_BLKST_FREE) {
log_err(_("Unlinked inode %"PRIu64" (0x%"PRIx64") contains bad
blocks\n"),
no_addr, no_addr);
- if (query(_("Delete unlinked inode with bad blocks? (y/n) "))) {
+ if (query(cx, _("Delete unlinked inode with bad blocks? (y/n) "))) {
ip = fsck_load_inode(sdp, no_addr);
check_inode_eattr(cx, ip, &pass4_fxns_delete);
check_metatree(cx, ip, &pass4_fxns_delete);
@@ -78,7 +78,7 @@ static int handle_unlinked(struct fsck_cx *cx, uint64_t no_addr,
log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") marked as
inode is not an inode (%d)\n"),
no_addr, no_addr, q);
ip = fsck_load_inode(sdp, no_addr);
- if (query(_("Delete unlinked inode? (y/n) "))) {
+ if (query(cx, _("Delete unlinked inode? (y/n) "))) {
check_inode_eattr(cx, ip, &pass4_fxns_delete);
check_metatree(cx, ip, &pass4_fxns_delete);
fsck_bitmap_set(cx, ip, no_addr, _("invalid unlinked"),
@@ -97,14 +97,14 @@ static int handle_unlinked(struct fsck_cx *cx, uint64_t no_addr,
relevent info in them. */
if (!ip->i_size && !ip->i_eattr){
log_err( _("Unlinked inode has zero size\n"));
- if (query(_("Clear zero-size unlinked inode? (y/n) "))) {
+ if (query(cx, _("Clear zero-size unlinked inode? (y/n) "))) {
fsck_bitmap_set(cx, ip, no_addr, _("unlinked zero-length"),
GFS2_BLKST_FREE);
fsck_inode_put(&ip);
return 1;
}
}
- if (query( _("Add unlinked inode to lost+found? (y/n)"))) {
+ if (query(cx, _("Add unlinked inode to lost+found? (y/n)"))) {
if (add_inode_to_lf(cx, ip)) {
stack;
fsck_inode_put(&ip);
@@ -125,7 +125,7 @@ static void handle_inconsist(struct fsck_cx *cx, uint64_t no_addr,
log_err(_("Link count inconsistent for inode %"PRIu64"
(0x%"PRIx64") has %u but fsck found %u.\n"),
no_addr, no_addr, *di_nlink, counted_links);
/* Read in the inode, adjust the link count, and write it back out */
- if (query(_("Update link count for inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
+ if (query(cx, _("Update link count for inode %"PRIu64"
(0x%"PRIx64")? (y/n) "),
no_addr, no_addr)) {
struct lgfs2_inode *ip;
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index 5de3d57c..6024f4a2 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -67,8 +67,7 @@ static int check_block_status(struct fsck_cx *cx, struct bmap *bl,
if (q == GFS2_BLKST_UNLINKED) {
log_err(_("Unlinked inode found at block %"PRIu64"
(0x%"PRIx64").\n"),
block, block);
- if (query(_("Do you want to reclaim the block? "
- "(y/n) "))) {
+ if (query(cx, _("Do you want to reclaim the block? (y/n) "))) {
lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
if (lgfs2_set_bitmap(rg, block, GFS2_BLKST_FREE))
log_err(_("Unlinked block %"PRIu64" (0x%"PRIx64") bitmap
not fixed.\n"),
@@ -92,7 +91,7 @@ static int check_block_status(struct fsck_cx *cx, struct bmap *bl,
log_err( _("Metadata type is %u (%s)\n"), q,
block_type_string(q));
- if (query(_("Fix bitmap for block %"PRIu64" (0x%"PRIx64")?
(y/n) "),
+ if (query(cx, _("Fix bitmap for block %"PRIu64"
(0x%"PRIx64")? (y/n) "),
block, block)) {
lgfs2_rgrp_t rg = lgfs2_blk2rgrpd(sdp, block);
if (lgfs2_set_bitmap(rg, block, q))
@@ -177,7 +176,7 @@ static void update_rgrp(struct fsck_cx *cx, struct lgfs2_rgrp_tree
*rgp,
exit(FSCK_ERROR);
}
if (update) {
- if (query( _("Update resource group counts? (y/n) "))) {
+ if (query(cx, _("Update resource group counts? (y/n) "))) {
log_warn( _("Resource group counts updated\n"));
/* write out the rgrp */
if (sdp->gfs1)
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
index 5f3503c4..7c98bec6 100644
--- a/gfs2/fsck/rgrepair.c
+++ b/gfs2/fsck/rgrepair.c
@@ -857,7 +857,7 @@ static int rewrite_rg_block(struct fsck_cx *cx, struct lgfs2_rgrp_tree
*rg,
log_err(_("Block #%"PRIu64" (0x%"PRIx64") (%d of
%"PRIu32") is not %s.\n"),
rg->rt_addr + x, rg->rt_addr + x, x+1, rg->rt_length, typedesc);
- if (!query( _("Fix the resource group? (y/n)")))
+ if (!query(cx, _("Fix the resource group? (y/n)")))
return 1;
log_err(_("Attempting to repair the resource group.\n"));
@@ -1005,7 +1005,7 @@ int rindex_repair(struct fsck_cx *cx, int trust_lvl, int *ok)
lgfs2_rindex_read(sdp, &sdp->rgrps, ok);
if (sdp->md.riinode->i_size % sizeof(struct gfs2_rindex)) {
log_warn( _("WARNING: rindex file has an invalid size.\n"));
- if (!query( _("Truncate the rindex size? (y/n)"))) {
+ if (!query(cx, _("Truncate the rindex size? (y/n)"))) {
log_err(_("The rindex was not repaired.\n"));
lgfs2_rgrp_free(sdp, &rgcalc);
lgfs2_rgrp_free(sdp, &sdp->rgtree);
@@ -1030,7 +1030,7 @@ int rindex_repair(struct fsck_cx *cx, int trust_lvl, int *ok)
number, don't trust it. Complain about the discrepancy,
then try again with a little more DISTRUST. */
if ((trust_lvl < DISTRUST) ||
- !query( _("Attempt to use what rgrps we can? (y/n)"))) {
+ !query(cx, _("Attempt to use what rgrps we can? (y/n)"))) {
lgfs2_rgrp_free(sdp, &rgcalc);
lgfs2_rgrp_free(sdp, &sdp->rgtree);
log_err(_("The rindex was not repaired.\n"));
@@ -1144,7 +1144,7 @@ int rindex_repair(struct fsck_cx *cx, int trust_lvl, int *ok)
}
/* If we modified the index, write it back to disk. */
if (rindex_modified) {
- if (query( _("Fix the index? (y/n)"))) {
+ if (query(cx, _("Fix the index? (y/n)"))) {
lgfs2_rindex_out(expected, (char *)&buf);
lgfs2_writei(sdp->md.riinode, (char *)&buf,
rg * sizeof(struct gfs2_rindex),
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
index 8ff07d0e..47b86077 100644
--- a/gfs2/fsck/util.c
+++ b/gfs2/fsck/util.c
@@ -160,7 +160,7 @@ char generic_interrupt(const char *caller, const char *where,
/* fsck_query: Same as gfs2_query except it adjusts errors_found and
errors_corrected. */
-int fsck_query(const char *format, ...)
+int fsck_query(struct fsck_cx *cx, const char *format, ...)
{
va_list args;
char response;
@@ -168,11 +168,11 @@ int fsck_query(const char *format, ...)
errors_found++;
fsck_abort = 0;
- if (opts.yes) {
+ if (cx->opts->yes) {
errors_corrected++;
return 1;
}
- if (opts.no)
+ if (cx->opts->no)
return 0;
while (1) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.