diff options
author | Kirk McKusick <mckusick@FreeBSD.org> | 2023-07-26 02:42:41 +0000 |
---|---|---|
committer | Kirk McKusick <mckusick@FreeBSD.org> | 2023-07-26 02:42:41 +0000 |
commit | d059e44b800a308822ad920c28f948a1afcc0fa3 (patch) | |
tree | 26b5c07f211059dac6534f2b584fbf1abd57c1fe /sbin/fsdb | |
parent | d51bdf327d9381807cbeffead1ed3cc466bdb87b (diff) | |
download | src-d059e44b800a308822ad920c28f948a1afcc0fa3.tar.gz src-d059e44b800a308822ad920c28f948a1afcc0fa3.zip |
Add quitclean command to fsdb(8) to request a filesystem not be marked dirty.
A new command, quitclean, is added to fsdb(8) to request that the
filesystem not be marked as needing a full fsck(8). This is useful
when creating deliberately bad filesystem images to be used to check
that fsck is properly able to clean them up.
MFC-after: 1 week
Sponsored-by: The FreeBSD Foundation
Diffstat (limited to 'sbin/fsdb')
-rw-r--r-- | sbin/fsdb/fsdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sbin/fsdb/fsdb.c b/sbin/fsdb/fsdb.c index ceb4a884e885..2d8c75cce5fe 100644 --- a/sbin/fsdb/fsdb.c +++ b/sbin/fsdb/fsdb.c @@ -163,6 +163,7 @@ CMDFUNC(uplink); /* incr link */ CMDFUNC(downlink); /* decr link */ CMDFUNC(linkcount); /* set link count */ CMDFUNC(quit); /* quit */ +CMDFUNC(quitclean); /* quit with filesystem marked clean */ CMDFUNC(findblk); /* find block */ CMDFUNC(ls); /* list directory */ CMDFUNC(rm); /* remove name */ @@ -217,6 +218,7 @@ struct cmdtable cmds[] = { { "ctime", "Change ctime of current inode to CTIME", 2, 2, FL_WR, chctime }, { "atime", "Change atime of current inode to ATIME", 2, 2, FL_WR, chatime }, { "chdb", "Change db pointer N of current inode to BLKNO", 3, 3, FL_CWR, chdb }, + { "quitclean", "Exit with filesystem marked clean", 1, 1, FL_RO, quitclean }, { "quit", "Exit", 1, 1, FL_RO, quit }, { "q", "Exit", 1, 1, FL_RO, quit }, { "exit", "Exit", 1, 1, FL_RO, quit }, @@ -402,6 +404,16 @@ CMDFUNCSTART(quit) return -1; } +CMDFUNCSTART(quitclean) +{ + if (fscritmodified) { + printf("Warning: modified filesystem marked clean\n"); + fscritmodified = 0; + sblock.fs_clean = 1; + } + return -1; +} + CMDFUNCSTART(uplink) { if (!checkactive()) |