shithub: ext4srv

Download patch

ref: 73faa8daef1b19a4023d143bbd8f25c5b54d18ee
parent: 3618c20c3cc2c8dc2cd0cafefec57806b72febbb
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Nov 15 16:57:54 EST 2020

add "halt" command

--- a/ext4srv.c
+++ b/ext4srv.c
@@ -859,7 +859,7 @@
 static void
 cmdsrv(void *)
 {
-	char s[32], *c, *a[16];
+	char s[32], *c, *a[4];
 	int f, p[2], n;
 	Biobuf b;
 
@@ -882,8 +882,16 @@
 	for(; (c = Brdstr(&b, '\n', 1)) != nil; free(c)){
 		if((n = tokenize(c, a, nelem(a))) < 1)
 			continue;
-		if(strcmp(a[0], "stats") == 0)
+		USED(n);
+		if(strcmp(a[0], "stats") == 0){
 			statallparts();
+		}else if(strcmp(a[0], "halt") == 0){
+			closeallparts();
+			close(0);
+			threadexitsall(nil);
+		}else{
+			print("unknown command: %s\n", a[0]);
+		}
 	}
 }