summaryrefslogtreecommitdiff
path: root/e2fsck
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1998-02-27 05:03:48 +0000
committerTheodore Ts'o <tytso@mit.edu>1998-02-27 05:03:48 +0000
commit2df1f6aa071e09527d1767e0d5178f29b4e9a73c (patch)
treedec0cb5455811de9275fcdc9604d9d7915434d64 /e2fsck
parent6b57f0163ebab63da2d22a27f27aba4f46ca9418 (diff)
downloade2fsprogs-2df1f6aa071e09527d1767e0d5178f29b4e9a73c.tar.gz
ChangeLog, e2fsck.c, e2fsck.h, pass1.c:
e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't include EXT2_FLAG_RESTART anymore, we need to adjust this routine so that it *does* return in the case of it seeing EXT2_FLAG_RESTART. pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group done callback function, which may set context abort flags. So we need to test the context abort flags after we call ext2_get_next_inode(). (process_inodes): If we abort due out of process_inodes, do a clean exit by breaking out of the for loop instead of just returning. e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be considered a SIGNAL mask (i.e., requiring an immediate abort of processing to restart). FLAG_RESTART just means that we want to restart once pass 1 is complete.
Diffstat (limited to 'e2fsck')
-rw-r--r--e2fsck/ChangeLog20
-rw-r--r--e2fsck/e2fsck.c10
-rw-r--r--e2fsck/e2fsck.h2
-rw-r--r--e2fsck/pass1.c5
4 files changed, 30 insertions, 7 deletions
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 36dc54a8..95cf80d3 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,23 @@
+Fri Feb 27 00:01:39 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * e2fsck.c (e2fsck_run): Since E2F_FLAG_SIGNAL_MASK doesn't
+ include EXT2_FLAG_RESTART anymore, we need to adjust this
+ routine so that it *does* return in the case of it seeing
+ EXT2_FLAG_RESTART.
+
+ * pass1.c (e2fsck_pass1): ext2_get_next_inode() may call the group
+ done callback function, which may set context abort
+ flags. So we need to test the context abort flags after
+ we call ext2_get_next_inode().
+ (process_inodes): If we abort due out of process_inodes,
+ do a clean exit by breaking out of the for loop instead of
+ just returning.
+
+ * e2fsck.h (E2F_FLAG_SIGNAL_MASK): EXT2_FLAG_RESTART shouldn't be
+ considered a SIGNAL mask (i.e., requiring an immediate
+ abort of processing to restart). FLAG_RESTART just means
+ that we want to restart once pass 1 is complete.
+
Tue Feb 24 15:19:40 1998 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Change the progress function to return an integer; if returns 1,
diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c
index 7d094063..56437d5b 100644
--- a/e2fsck/e2fsck.c
+++ b/e2fsck/e2fsck.c
@@ -135,6 +135,8 @@ pass_t e2fsck_passes[] = {
e2fsck_pass1, e2fsck_pass2, e2fsck_pass3, e2fsck_pass4,
e2fsck_pass5, 0 };
+#define E2F_FLAG_RUN_RETURN (E2F_FLAG_SIGNAL_MASK|E2F_FLAG_RESTART)
+
int e2fsck_run(e2fsck_t ctx)
{
int i;
@@ -142,19 +144,19 @@ int e2fsck_run(e2fsck_t ctx)
#ifdef HAVE_SETJMP_H
if (setjmp(ctx->abort_loc))
- return (ctx->flags & E2F_FLAG_SIGNAL_MASK);
+ return (ctx->flags & E2F_FLAG_RUN_RETURN);
ctx->flags |= E2F_FLAG_SETJMP_OK;
#endif
for (i=0; (e2fsck_pass = e2fsck_passes[i]); i++) {
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+ if (ctx->flags & E2F_FLAG_RUN_RETURN)
break;
e2fsck_pass(ctx);
}
ctx->flags &= ~E2F_FLAG_SETJMP_OK;
- if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- return (ctx->flags & E2F_FLAG_SIGNAL_MASK);
+ if (ctx->flags & E2F_FLAG_RUN_RETURN)
+ return (ctx->flags & E2F_FLAG_RUN_RETURN);
return 0;
}
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index ca08fe39..b8ac30ce 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -95,8 +95,8 @@ struct resource_track {
*/
#define E2F_FLAG_ABORT 0x0001 /* Abort signaled */
#define E2F_FLAG_CANCEL 0x0002 /* Cancel signaled */
+#define E2F_FLAG_SIGNAL_MASK 0x0003
#define E2F_FLAG_RESTART 0x0004 /* Restart signaled */
-#define E2F_FLAG_SIGNAL_MASK 0x000F
#define E2F_FLAG_SETJMP_OK 0x0010 /* Setjmp valid for abort */
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 4832f697..e2a35f03 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -442,6 +442,8 @@ void e2fsck_pass1(e2fsck_t ctx)
}
next:
pctx.errcode = ext2fs_get_next_inode(scan, &ino, &inode);
+ if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
+ return;
if (pctx.errcode == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) {
if (!ctx->inode_bb_map)
alloc_bb_map(ctx);
@@ -545,9 +547,8 @@ static void process_inodes(e2fsck_t ctx, char *block_buf)
sprintf(buf, "reading indirect blocks of inode %lu", pctx.ino);
ehandler_operation(buf);
check_blocks(ctx, &pctx, block_buf);
-
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
- return;
+ break;
}
ctx->stashed_inode = old_stashed_inode;
ctx->stashed_ino = old_stashed_ino;