git: d059e44b800a - main - Add quitclean command to fsdb(8) to request a filesystem not be marked dirty.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 26 Jul 2023 02:44:10 UTC
The branch main has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=d059e44b800a308822ad920c28f948a1afcc0fa3 commit d059e44b800a308822ad920c28f948a1afcc0fa3 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2023-07-26 02:42:41 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2023-07-26 02:42:41 +0000 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 --- sbin/fsdb/fsdb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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())