shithub: gefs

Download patch

ref: 7d85dc87bcb5ab2cc6c032bf0ae4eef3bdf14c21
parent: f5e421deff7f2278fd3a937241dc64aaf25a8a32
author: Ori Bernstein <[email protected]>
date: Sat May 27 20:52:42 EDT 2023

main: add option to check fs on startup

useful for test scripts

--- a/main.c
+++ b/main.c
@@ -132,11 +132,12 @@
 void
 main(int argc, char **argv)
 {
-	int i, srvfd, ctlfd, nann;
+	int i, srvfd, ctlfd, nann, check;
 	char *s, *ann[16];
 	Conn *c;
 
 	nann = 0;
+	check = 0;
 	ARGBEGIN{
 	case 'a':
 		if(nann == nelem(ann))
@@ -171,6 +172,9 @@
 	case 'f':
 		dev = EARGF(usage());
 		break;
+	case 'C':
+		check = 1;
+		break;
 	default:
 		usage();
 		break;
@@ -219,6 +223,8 @@
 
 	rfork(RFNOTEG);
 	loadfs(dev);
+	if(check && !checkfs(2))
+		sysfatal("fishy");
 	fs->wrchan = mkchan(32);
 	fs->nsyncers = nproc/2;
 	fs->nreaders = 1;