shithub: gefs

Download patch

ref: 18e0d62947b311ee6b5067272503befa4c479d19
parent: 1a88ade6f51bd413390f6f4b8ece7c96828105c8
author: Ori Bernstein <[email protected]>
date: Mon Feb 26 19:09:36 EST 2024

main: add '-c' for check and exit command

this facilitates automated testing

--- a/main.c
+++ b/main.c
@@ -18,6 +18,7 @@
 int	nproc;
 int	permissive;
 int	usereserve;
+int	checkonly;
 char	*reamuser;
 char	*dev;
 vlong	tracesz		= 16*MiB;
@@ -290,6 +291,9 @@
 		ream = 1;
 		reamuser = EARGF(usage());
 		break;
+	case 'c':
+		checkonly = 1;
+		break;
 	case 'g':
 		grow = 1;
 		break;
@@ -379,6 +383,12 @@
 	}
 	if(grow){
 		growfs(dev);
+		exits(nil);
+	}
+	if(checkonly){
+		loadfs(dev);
+		if(!checkfs(2))
+			sysfatal("broken fs: %r");
 		exits(nil);
 	}