code: mafs

Download patch

ref: 06bc3a358931f0e6182d636f418a8ad15731c29e
parent: d833a4b2307a4e4abc14e6ab5f4ea154b04f555b
author: 9ferno <gophone2015@gmail.com>
date: Mon Jan 2 12:25:29 EST 2023

installer needs noauth

--- a/9p.c
+++ b/9p.c
@@ -3,6 +3,7 @@
 Tlock	*tlockhead = nil, *tlocktail = nil;
 QLock	tlock;
 extern u32 mpsrvpid;
+extern u8 noauth;
 static u64 lastflushtime = 0;
 static RWLock flushlck;
 
@@ -34,12 +35,21 @@
 }
 
 static void
+fsauth(Req *req)
+{
+	if(noauth)
+		respond(req, "no authentication required");
+	else
+		auth9p(req);
+}
+
+static void
 fsattach(Req *req)
 {
 	short uid;
 	Iobuf *dbuf;
 
-	if(authattach(req) < 0){
+	if(noauth == 0 && authattach(req) < 0){
 		return;
 	}
 
@@ -1191,7 +1201,7 @@
 
 /* multi process server */
 Srv mpsrv = {
-	.auth = auth9p,
+	.auth = fsauth,
 	.attach = fsattach,
 	.destroyfid = fsdestroyfid,
 	.msize = Iounit,
@@ -1213,7 +1223,7 @@
 
 /* usrv is a uni process server */
 Srv usrv = {
-	.auth = auth9p,
+	.auth = fsauth,
 	.attach = fsattach,
 	.destroyfid = fsdestroyfid,
 	.msize = Iounit,
--- a/build_mafs_isos.rc
+++ b/build_mafs_isos.rc
@@ -5,15 +5,20 @@
 #	9front iso's including mafs
 #
 # git/clone git://git.9front.org/plan9front/plan9front ../../plan9front_mafs
+# cd ../../plan9front_mafs
+# git/import ../custom/mafs/*.patch
 #
 # to write to a usb disk sd6 from openbsd
 # dd if=9front_mafs-9589.ba66d8f69edd895682f2661524a1d07612cb9ba8.amd64.iso of=/dev/rsd6c bs=1M
+#
+# TODO
+# put the release files in contrib.9front.org /usr/9ferno/
 
 www=`{pwd}
 cd ../../plan9front_mafs
 
 #archs=(amd64 386 arm arm64)
-archs=(amd64 386)
+archs=(amd64)
 
 release=9front_mafs-`{git/log -s | wc -l}^.^`{git/query HEAD}
 echo release $release
@@ -128,3 +133,39 @@
 }
 
 cd $www
+
+iso=$www^/^$release^.amd64.iso
+fn mountiso {
+	9660srv -f $iso 9front_mafs.amd64
+	mount /srv/9front_mafs.amd64 /n/9front_mafs.amd64
+	cd /n/9front_mafs.amd64
+}
+
+fn unmountiso {
+	cd $www
+	unmount /srv/9front_mafs.amd64 /n/9front_mafs.amd64;
+	rm /srv/9front_mafs.amd64
+	rm -rf /n/9front_mafs.amd64;
+}
+
+fn start9t {
+	# ip/ipconfig -d # for networking from within vmx
+	font=/lib/font/bit/vga/unicode.font;
+	test -d '#X' && {
+		for(i in '#X/'*){ test -f $i/ctl && echo quit > $i/ctl };
+	}
+	test -f /srv/vmx && rm /srv/vmx
+	kill vmx|rc
+	vmx -D -M 2G -d $iso -d /mnt/term/home/j/local/plan9/custom/9front.disk -n ea:deadbeefcafe!ether0 -w text /mnt/term/home/j/local/plan9/plan9front_mafs/amd64/9pc64
+}
+
+fn start9 {
+	font=/lib/font/bit/vga/unicode.font
+	test -d '#X' && {
+		for(i in '#X/'*){ test -f $i/ctl && echo quit > $i/ctl };
+	}
+	test -f /srv/vmx && rm /srv/vmx
+	kill vmx|rc
+	vmx -M 4G -D -d $iso -d /mnt/term/home/j/local/plan9/custom/9front.disk -n ea:deadbeefcafe!ether0 -w '800x600' /mnt/term/home/j/local/plan9/plan9front_mafs/amd64/9pc64
+}
+echo 'iso='^$iso
--- a/dat.h
+++ b/dat.h
@@ -57,25 +57,25 @@
 	Nu64perblock= (Blocksize/sizeof(u64)),		/* number of u64's in a block */
 	Dpathidx	= (Blocksize/sizeof(u64) -1),	/* index of path in the last data block, last u64 */
 
-	Namelen = 128,	/* maximum length of a file name, calculated manually */
+	Namelen = 128,	/* aximum length of a file name, calculated anually */
 	Ndblock	= 32,	/* number of direct blocks in a Dentry */
-	Niblock	= 5,	/* maximum depth of indirect blocks, can increase it to 8 without issues */
+	Niblock	= 5,	/* aximum depth of indirect blocks, can increase it to 8 without issues */
 
 	/* global block numbers. The bkp contents locations are calculated by ream() */
 	Bdmagic	= 0,	/* block number of first block. Bmagic conflicts with bio.h */
-	Bdconfig= 1,	/* block number of /adm/config dentry and contents */
-	Bdsuper	= 2,	/* block number of /adm/super dentry and contents */
-	Bdadm	= 3,	/* block number of /adm directory */
-	Bdusers	= 4,	/* block number of /adm/users/ dentry */
+	Bdconfig= 1,	/* block number of /a/config dentry and contents */
+	Bdsuper	= 2,	/* block number of /a/super dentry and contents */
+	Bda		= 3,	/* block number of /a directory */
+	Bdusers	= 4,	/* block number of /a/users/ dentry */
 
 					/* contents of blocks below change on use */ 
-	Bdbkp	= 5,	/* block number of /adm/bkp directory */
-	Bdusersinuse = 6,	/* block number of /adm/users/inuse dentry and contents */
-	Bdfrees = 7,	/* block number of /adm/frees dentry, text file of free extents */
+	Bdbkp	= 5,	/* block number of /a/bkp directory */
+	Bdusersinuse = 6,	/* block number of /a/users/inuse dentry and contents */
+	Bdfrees = 7,	/* block number of /a/frees dentry, text file of free extents */
 
 					/* no user writes allowed on blocks below Bdctl */
-	Bdctl	= 8,	/* block number of /adm/ctl dentry, empty contents, virtual file */
-	Bdusersstaging = 9,/* block number of /adm/users/staging dentry */
+	Bdctl	= 8,	/* block number of /a/ctl dentry, empty contents, virtual file */
+	Bdusersstaging = 9,/* block number of /a/users/staging dentry */
 	Bdroot	= 10,	/* block number of root directory */
 
 	Nbused,	/* blocks used up by default */
--- a/mafs.c
+++ b/mafs.c
@@ -3,6 +3,8 @@
 
 char *devfile = nil;	/* device file path */
 char service[Namelen] = "\0";
+
+/* use a byte for all these flags as hjfs? */
 u8	noauth = 0;
 u8	readonly = 0;
 u8	shuttingdown = 0;
@@ -18,7 +20,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: mafs [-Ds] [-r service] [-n service] [-m nmemunits] file\n");
+	fprint(2, "usage: mafs [-ADs] [-r service] [-n service] [-m nmemunits] file\n");
 	exits("usage");
 }
 
@@ -49,6 +51,7 @@
 
 	ARGBEGIN{
 	default:	usage();
+	case 'A':	noauth++; break;
 	case 'D':	chatty9p++; break;
 	case 'f':	/* devfile = ARGF(); */ break; /* to work with bootfs of /sys/src/9/boot/local.rc */
 	case 'm':	nmemunits = atoll(EARGF(usage())); break;