ref: 20446deff8dae32ae7a921adbd278a1da898b26c
parent: 01d3637ababa684f730a5ab2b60d4a45967ab6e5
author: 9ferno <gophone2015@gmail.com>
date: Thu Oct 13 08:42:07 EDT 2022
minor irritations corrected
--- a/9p.c
+++ b/9p.c
@@ -1,5 +1,7 @@
#include "all.h"
+int mpstarted = 0;
+
s32 readfile(u64 dblkno, u64 qpath, char *rbuf, s32 rbufsize, u64 offset);
s32 writefile(u64 dblkno, u64 qpath, s16 uid, char *wbuf, s32 wbufsize, u64 offset);
@@ -887,6 +889,7 @@
{
int i, a;
/* User *u, *v; */
+ char srvfilename[Namelen];
if(chatty9p)
dprint("shutdown\n");
@@ -919,6 +922,12 @@
u = v;
}
t->users = nil;*/
+
+ /* /srv/mafs_service file will not exist when mounted with -s */
+ if(mpstarted &&
+ sprint(srvfilename, "/srv/%s", service) > 5)
+ remove(srvfilename);
+
if(chatty9p)
dprint("shutdown: exiting\n");
exits(nil);
@@ -971,6 +980,7 @@
{
int i;
+ mpstarted=1;
initworks(&buf);
if(chatty9p)
dprint("parent pid: %d\n", getpid());
@@ -1033,8 +1043,12 @@
Srv mpsrv = {
.auth = auth9p,
.attach = fsattach,
+ .destroyfid = fsdestroyfid,
+ .msize = Maxspansize,
+
.walk1 = fswalk1,
.clone = fsclone,
+
.open = bfsopen,
.create = bfscreate,
.read = bfsread,
@@ -1042,10 +1056,9 @@
.stat = bfsstat,
.wstat = bfswstat,
.remove = bfsremove,
- .destroyfid = fsdestroyfid,
+
.start = fsstart,
.end = fshalt,
- .msize = Maxspansize,
};
/* usrv is a uni process server */
@@ -1052,8 +1065,12 @@
Srv usrv = {
.auth = auth9p,
.attach = fsattach,
+ .destroyfid = fsdestroyfid,
+ .msize = Maxspansize,
+
.walk1 = fswalk1,
.clone = fsclone,
+
.open = fsopen,
.create = fscreate,
.read = fsread,
@@ -1061,9 +1078,8 @@
.stat = fsstat,
.wstat = fswstat,
.remove = fsremove,
- .destroyfid = fsdestroyfid,
+
.end = fshalt,
- .msize = Maxspansize,
};
/*
--- a/TODO
+++ b/TODO
@@ -10,8 +10,10 @@
file system checker
fsck will be a different user space program
EXCL files - maintain a list of locks in the tree
-APPEND files - todo.
+APPEND files
+ORCLOSE
correct /adm/ctl operation:
echo df >> /adm/ctl
cat /adm/ctl
make docs/mafs.ms more interesting?
+test -A announce
--- a/dentry.c
+++ b/dentry.c
@@ -425,7 +425,9 @@
if(canaccess(uid, d, DMEXEC) == 0){
putbuf(*dbuf);
+ *dbuf = nil;
dprint("%s",errstring[Ephase]);
+ return nil;
}
/* using idx to not include zero'ed out slots in our search */
@@ -484,13 +486,7 @@
Nextdentry:
putbuf(*buf);
}
-
- if(*dbuf != nil)
- putbuf(*dbuf);
- if(*buf != nil)
- putbuf(*buf);
- *dbuf = *buf = nil;
- return nil;
+ /* should never be here */
}
void
freesearchstate(Iobuf **dbuf, Iobuf **buf)
binary files a/docs/mafs.pdf b/docs/mafs.pdf differ
--- a/mafs.c
+++ b/mafs.c
@@ -89,6 +89,8 @@
if((srvname = estrdup9p(argv[1])) == nil)
usage();
+ else
+ sprint(service, "mafs_%s", srvname);
if(chatty9p){
print("\nPlan 9 %d-bit file server with %d-deep indirect blocks\n",
@@ -101,11 +103,6 @@
formatinit();
- if(srvname != nil)
- sprint(service, "mafs_%s", srvname);
- else
- strcpy(service, "mafs");
-
tlocks = emalloc9p(NTLOCK * sizeof *tlocks);
iobufinit();
@@ -116,8 +113,7 @@
start9p(service, nets, stdio);
/*
- we have started the console proc to process /srv/mafs_service.cmd
- and another proc to process /srv/mafs_service
+ we have started another proc to process /srv/mafs_service
and it is my time to exit
*/
exits(nil);