ref: b8b6185f57dca0a64535fd495b436dfb293e9fb3
parent: 6a371792659d530b9ff9e9ff6eb684b2b5d28c92
author: Ori Bernstein <[email protected]>
date: Sun Jul 21 23:40:21 EDT 2024
don't run if gefs is mounted
--- a/fns.h
+++ b/fns.h
@@ -17,6 +17,7 @@
extern int noneid;
extern int nogroupid;
extern int admid;
+extern int force;
#define UNPACK8(p) (((uchar*)(p))[0])
#define UNPACK16(p) ((((uchar*)(p))[0]<<8)|(((uchar*)(p))[1]))
--- a/fs.c
+++ b/fs.c
@@ -2757,6 +2757,8 @@
Kvp kv;
Key k;
+ if(!force && access("/srv/gefs", AEXIST) == 0)
+ sysfatal("/srv/gefs already exists: is your fs mounted?");
fprint(2, "getting adm mount...\n");
if((mnt = getmount("adm")) == nil){
sysfatal("failed to get adm mount");
--- a/main.c
+++ b/main.c
@@ -10,7 +10,7 @@
Gefs *fs;
-int ream;
+int force;
int grow;
int debug;
int stdio;
@@ -280,7 +280,7 @@
static void
usage(void)
{
- fprint(2, "usage: %s [-SA] [-r user] [-m mem] [-n srv] [-a net]... -f dev\n", argv0);
+ fprint(2, "usage: %s [-F] -f dev\n", argv0);
exits("usage");
}
@@ -296,6 +296,9 @@
break;
case 'f':
dev = EARGF(usage());
+ break;
+ case 'F':
+ force++;
break;
default:
usage();