fossil: required p9p changes
R=rsc https://codereview.appspot.com/13352057
This commit is contained in:
parent
4b57665805
commit
b32de4ae73
15 changed files with 156 additions and 67 deletions
|
|
@ -935,6 +935,7 @@ parseAname(char *aname, char **fsname, char **path)
|
||||||
*path = "";
|
*path = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
/*
|
/*
|
||||||
* Check remote IP address against /mnt/ipok.
|
* Check remote IP address against /mnt/ipok.
|
||||||
* Sources.cs.bell-labs.com uses this to disallow
|
* Sources.cs.bell-labs.com uses this to disallow
|
||||||
|
|
@ -972,6 +973,7 @@ conIPCheck(Con* con)
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rTattach(Msg* m)
|
rTattach(Msg* m)
|
||||||
|
|
@ -996,12 +998,14 @@ rTattach(Msg* m)
|
||||||
else
|
else
|
||||||
fid->uname = vtstrdup(unamenone);
|
fid->uname = vtstrdup(unamenone);
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
if((fid->con->flags&ConIPCheck) && !conIPCheck(fid->con)){
|
if((fid->con->flags&ConIPCheck) && !conIPCheck(fid->con)){
|
||||||
consPrint("reject %s from %s: %r\n", fid->uname, fid->con->remote);
|
consPrint("reject %s from %s: %r\n", fid->uname, fid->con->remote);
|
||||||
fidClunk(fid);
|
fidClunk(fid);
|
||||||
vtfree(fsname);
|
vtfree(fsname);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(fsysNoAuthCheck(fsys) || (m->con->flags&ConNoAuthCheck)){
|
if(fsysNoAuthCheck(fsys) || (m->con->flags&ConNoAuthCheck)){
|
||||||
if((fid->uid = uidByUname(fid->uname)) == nil)
|
if((fid->uid = uidByUname(fid->uname)) == nil)
|
||||||
fid->uid = vtstrdup(unamenone);
|
fid->uid = vtstrdup(unamenone);
|
||||||
|
|
@ -1032,7 +1036,9 @@ rTattach(Msg* m)
|
||||||
static int
|
static int
|
||||||
rTauth(Msg* m)
|
rTauth(Msg* m)
|
||||||
{
|
{
|
||||||
|
#ifndef PLAN9PORT
|
||||||
int afd;
|
int afd;
|
||||||
|
#endif
|
||||||
Con *con;
|
Con *con;
|
||||||
Fid *afid;
|
Fid *afid;
|
||||||
Fsys *fsys;
|
Fsys *fsys;
|
||||||
|
|
@ -1064,13 +1070,20 @@ rTauth(Msg* m)
|
||||||
}
|
}
|
||||||
afid->fsys = fsys;
|
afid->fsys = fsys;
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
if((afd = open("/mnt/factotum/rpc", ORDWR)) < 0){
|
if((afd = open("/mnt/factotum/rpc", ORDWR)) < 0){
|
||||||
werrstr("can't open \"/mnt/factotum/rpc\"");
|
werrstr("can't open \"/mnt/factotum/rpc\"");
|
||||||
fidClunk(afid);
|
fidClunk(afid);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
if((afid->rpc = auth_allocrpc()) == nil){
|
||||||
|
#else
|
||||||
if((afid->rpc = auth_allocrpc(afd)) == nil){
|
if((afid->rpc = auth_allocrpc(afd)) == nil){
|
||||||
close(afd);
|
close(afd);
|
||||||
|
#endif
|
||||||
werrstr("can't auth_allocrpc");
|
werrstr("can't auth_allocrpc");
|
||||||
fidClunk(afid);
|
fidClunk(afid);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -250,12 +250,13 @@ msgFlush(Msg* m)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
msgProc(void*)
|
msgProc(void* v)
|
||||||
{
|
{
|
||||||
Msg *m;
|
Msg *m;
|
||||||
char e[ERRMAX];
|
char e[ERRMAX];
|
||||||
Con *con;
|
Con *con;
|
||||||
|
|
||||||
|
USED(v);
|
||||||
threadsetname("msgProc");
|
threadsetname("msgProc");
|
||||||
|
|
||||||
for(;;){
|
for(;;){
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ static struct {
|
||||||
Srv* tail;
|
Srv* tail;
|
||||||
} sbox;
|
} sbox;
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
static int
|
static int
|
||||||
srvFd(char* name, int mode, int fd, char** mntpnt)
|
srvFd(char* name, int mode, int fd, char** mntpnt)
|
||||||
{
|
{
|
||||||
|
|
@ -54,6 +55,7 @@ srvFd(char* name, int mode, int fd, char** mntpnt)
|
||||||
|
|
||||||
return srvfd;
|
return srvfd;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
srvFree(Srv* srv)
|
srvFree(Srv* srv)
|
||||||
|
|
@ -100,7 +102,12 @@ srvAlloc(char* service, int mode, int fd)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
mntpnt = nil;
|
||||||
|
if((srvfd = post9pservice(fd, service, mntpnt)) < 0){
|
||||||
|
#else
|
||||||
if((srvfd = srvFd(service, mode, fd, &mntpnt)) < 0){
|
if((srvfd = srvFd(service, mode, fd, &mntpnt)) < 0){
|
||||||
|
#endif
|
||||||
wunlock(&sbox.lock);
|
wunlock(&sbox.lock);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
@ -203,6 +210,11 @@ cmdSrv(int argc, char* argv[])
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PLAN9PORT /* fossilcons unsupported */
|
||||||
|
if(pflag)
|
||||||
|
return 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
if(pipe(fd) < 0){
|
if(pipe(fd) < 0){
|
||||||
werrstr("srv pipe: %r");
|
werrstr("srv pipe: %r");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -338,7 +338,11 @@ int
|
||||||
validUserName(char* name)
|
validUserName(char* name)
|
||||||
{
|
{
|
||||||
Rune *r;
|
Rune *r;
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
static Rune invalid[] = {'#', ':', ',', '(', ')', '\0'};
|
||||||
|
#else
|
||||||
static Rune invalid[] = L"#:,()";
|
static Rune invalid[] = L"#:,()";
|
||||||
|
#endif
|
||||||
|
|
||||||
for(r = invalid; *r != '\0'; r++){
|
for(r = invalid; *r != '\0'; r++){
|
||||||
if(utfrune(name, *r))
|
if(utfrune(name, *r))
|
||||||
|
|
|
||||||
|
|
@ -27,19 +27,22 @@ cmd9pStrtoull(char* s)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTag(Fcall*, int, char **argv)
|
cmd9pTag(Fcall* f, int i, char **argv)
|
||||||
{
|
{
|
||||||
|
USED(f);
|
||||||
|
USED(i);
|
||||||
cbox.tag = strtoul(argv[0], 0, 0)-1;
|
cbox.tag = strtoul(argv[0], 0, 0)-1;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTwstat(Fcall* f, int, char **argv)
|
cmd9pTwstat(Fcall* f, int i, char **argv)
|
||||||
{
|
{
|
||||||
Dir d;
|
Dir d;
|
||||||
static uchar buf[DIRMAX];
|
static uchar buf[DIRMAX];
|
||||||
|
|
||||||
|
USED(i);
|
||||||
memset(&d, 0, sizeof d);
|
memset(&d, 0, sizeof d);
|
||||||
nulldir(&d);
|
nulldir(&d);
|
||||||
d.name = argv[1];
|
d.name = argv[1];
|
||||||
|
|
@ -61,32 +64,36 @@ cmd9pTwstat(Fcall* f, int, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTstat(Fcall* f, int, char** argv)
|
cmd9pTstat(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTremove(Fcall* f, int, char** argv)
|
cmd9pTremove(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTclunk(Fcall* f, int, char** argv)
|
cmd9pTclunk(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTwrite(Fcall* f, int, char** argv)
|
cmd9pTwrite(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
f->offset = strtoll(argv[1], 0, 0);
|
f->offset = strtoll(argv[1], 0, 0);
|
||||||
f->data = argv[2];
|
f->data = argv[2];
|
||||||
|
|
@ -96,8 +103,9 @@ cmd9pTwrite(Fcall* f, int, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTread(Fcall* f, int, char** argv)
|
cmd9pTread(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
f->offset = strtoll(argv[1], 0, 0);
|
f->offset = strtoll(argv[1], 0, 0);
|
||||||
f->count = strtol(argv[2], 0, 0);
|
f->count = strtol(argv[2], 0, 0);
|
||||||
|
|
@ -106,8 +114,9 @@ cmd9pTread(Fcall* f, int, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTcreate(Fcall* f, int, char** argv)
|
cmd9pTcreate(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
f->name = argv[1];
|
f->name = argv[1];
|
||||||
f->perm = strtol(argv[2], 0, 8);
|
f->perm = strtol(argv[2], 0, 8);
|
||||||
|
|
@ -117,8 +126,9 @@ cmd9pTcreate(Fcall* f, int, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTopen(Fcall* f, int, char** argv)
|
cmd9pTopen(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
f->mode = strtol(argv[1], 0, 0);
|
f->mode = strtol(argv[1], 0, 0);
|
||||||
|
|
||||||
|
|
@ -148,16 +158,18 @@ cmd9pTwalk(Fcall* f, int argc, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTflush(Fcall* f, int, char** argv)
|
cmd9pTflush(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->oldtag = strtol(argv[0], 0, 0);
|
f->oldtag = strtol(argv[0], 0, 0);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTattach(Fcall* f, int, char** argv)
|
cmd9pTattach(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->fid = strtol(argv[0], 0, 0);
|
f->fid = strtol(argv[0], 0, 0);
|
||||||
f->afid = strtol(argv[1], 0, 0);
|
f->afid = strtol(argv[1], 0, 0);
|
||||||
f->uname = argv[2];
|
f->uname = argv[2];
|
||||||
|
|
@ -167,8 +179,9 @@ cmd9pTattach(Fcall* f, int, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTauth(Fcall* f, int, char** argv)
|
cmd9pTauth(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->afid = strtol(argv[0], 0, 0);
|
f->afid = strtol(argv[0], 0, 0);
|
||||||
f->uname = argv[1];
|
f->uname = argv[1];
|
||||||
f->aname = argv[2];
|
f->aname = argv[2];
|
||||||
|
|
@ -177,8 +190,9 @@ cmd9pTauth(Fcall* f, int, char** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
cmd9pTversion(Fcall* f, int, char** argv)
|
cmd9pTversion(Fcall* f, int i, char** argv)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
f->msize = strtoul(argv[0], 0, 0);
|
f->msize = strtoul(argv[0], 0, 0);
|
||||||
if(f->msize > cbox.con->msize){
|
if(f->msize > cbox.con->msize){
|
||||||
werrstr("msize too big");
|
werrstr("msize too big");
|
||||||
|
|
@ -420,6 +434,7 @@ cmdBind(int argc, char* argv[])
|
||||||
if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
|
if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
|
||||||
return cliError(usage);
|
return cliError(usage);
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
if(bind(argv[0], argv[1], flag) < 0){
|
if(bind(argv[0], argv[1], flag) < 0){
|
||||||
/* try to give a less confusing error than the default */
|
/* try to give a less confusing error than the default */
|
||||||
if(access(argv[0], 0) < 0)
|
if(access(argv[0], 0) < 0)
|
||||||
|
|
@ -429,6 +444,7 @@ cmdBind(int argc, char* argv[])
|
||||||
else
|
else
|
||||||
return cliError("bind %s %s: %r", argv[0], argv[1]);
|
return cliError("bind %s %s: %r", argv[0], argv[1]);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -221,8 +221,9 @@ qAlloc(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
consProc(void*)
|
consProc(void* v)
|
||||||
{
|
{
|
||||||
|
USED(v);
|
||||||
Q *q;
|
Q *q;
|
||||||
int argc, i, n, r;
|
int argc, i, n, r;
|
||||||
char *argv[20], buf[Nq], *lp, *wbuf;
|
char *argv[20], buf[Nq], *lp, *wbuf;
|
||||||
|
|
@ -345,13 +346,21 @@ consTTY(void)
|
||||||
|
|
||||||
name = "/dev/cons";
|
name = "/dev/cons";
|
||||||
if((fd = open(name, ORDWR)) < 0){
|
if((fd = open(name, ORDWR)) < 0){
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
name = "/dev/tty";
|
||||||
|
#else
|
||||||
name = "#c/cons";
|
name = "#c/cons";
|
||||||
|
#endif
|
||||||
if((fd = open(name, ORDWR)) < 0){
|
if((fd = open(name, ORDWR)) < 0){
|
||||||
werrstr("consTTY: open %s: %r", name);
|
werrstr("consTTY: open %s: %r", name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
USED(p);
|
||||||
|
ctl = 0;
|
||||||
|
#else
|
||||||
p = smprint("%sctl", name);
|
p = smprint("%sctl", name);
|
||||||
if((ctl = open(p, OWRITE)) < 0){
|
if((ctl = open(p, OWRITE)) < 0){
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
@ -367,6 +376,7 @@ consTTY(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(consOpen(fd, fd, ctl) == 0){
|
if(consOpen(fd, fd, ctl) == 0){
|
||||||
close(ctl);
|
close(ctl);
|
||||||
|
|
|
||||||
|
|
@ -778,22 +778,34 @@ warn(Fsck *chk, char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clrenop(Fsck*, Block*, int)
|
clrenop(Fsck *chk, Block *b, int i)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
|
USED(b);
|
||||||
|
USED(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
closenop(Fsck*, Block*, u32int)
|
closenop(Fsck *chk, Block *b, u32int i)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
|
USED(b);
|
||||||
|
USED(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clrinop(Fsck*, char*, MetaBlock*, int, Block*)
|
clrinop(Fsck *chk, char *c, MetaBlock *mb, int i, Block *b)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
|
USED(c);
|
||||||
|
USED(mb);
|
||||||
|
USED(i);
|
||||||
|
USED(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
printnop(char*, ...)
|
printnop(char *c, ...)
|
||||||
{
|
{
|
||||||
|
USED(c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -328,4 +328,4 @@ enum {
|
||||||
PartVenti, /* fake partition */
|
PartVenti, /* fake partition */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern vtType[BtMax];
|
extern int vtType[BtMax];
|
||||||
|
|
|
||||||
|
|
@ -288,8 +288,10 @@ disk2file(Disk *disk)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
|
|
||||||
|
#ifndef PLAN9PORT
|
||||||
if (fd2path(disk->fd, buf, sizeof buf) < 0)
|
if (fd2path(disk->fd, buf, sizeof buf) < 0)
|
||||||
strncpy(buf, "GOK", sizeof buf);
|
strncpy(buf, "GOK", sizeof buf);
|
||||||
|
#endif
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,26 +28,33 @@ flprint(char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flclre(Fsck*, Block *b, int o)
|
flclre(Fsck *chk, Block *b, int o)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
Bprint(&bout, "# clre 0x%ux %d\n", b->addr, o);
|
Bprint(&bout, "# clre 0x%ux %d\n", b->addr, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flclrp(Fsck*, Block *b, int o)
|
flclrp(Fsck *chk, Block *b, int o)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
Bprint(&bout, "# clrp 0x%ux %d\n", b->addr, o);
|
Bprint(&bout, "# clrp 0x%ux %d\n", b->addr, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flclri(Fsck*, char *name, MetaBlock*, int, Block*)
|
flclri(Fsck *chk, char *name, MetaBlock *mb, int i, Block *b)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
|
USED(mb);
|
||||||
|
USED(i);
|
||||||
|
USED(b);
|
||||||
Bprint(&bout, "# clri %s\n", name);
|
Bprint(&bout, "# clri %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
flclose(Fsck*, Block *b, u32int epoch)
|
flclose(Fsck *chk, Block *b, u32int epoch)
|
||||||
{
|
{
|
||||||
|
USED(chk);
|
||||||
Bprint(&bout, "# bclose 0x%ux %ud\n", b->addr, epoch);
|
Bprint(&bout, "# bclose 0x%ux %ud\n", b->addr, epoch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,11 @@ threadmain(int argc, char* argv[])
|
||||||
/*
|
/*
|
||||||
* Insulate from the invoker's environment.
|
* Insulate from the invoker's environment.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PLAN9PORT
|
||||||
|
if(rfork(RFNAMEG) < 0)
|
||||||
|
#else
|
||||||
if(rfork(RFREND|RFNOTEG|RFNAMEG) < 0)
|
if(rfork(RFREND|RFNOTEG|RFNAMEG) < 0)
|
||||||
|
#endif
|
||||||
sysfatal("rfork: %r");
|
sysfatal("rfork: %r");
|
||||||
|
|
||||||
close(0);
|
close(0);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
</$objtype/mkfile
|
<$PLAN9/src/mkhdr
|
||||||
BIN=/$objtype/bin/fossil
|
MKSHELL=$PLAN9/bin/rc
|
||||||
|
BIN=$BIN/fossil
|
||||||
|
|
||||||
TARG=fossil flchk flfmt conf last view
|
TARG=fossil flchk flfmt conf last view
|
||||||
|
|
||||||
|
|
@ -34,10 +35,10 @@ LIBFILES=\
|
||||||
|
|
||||||
LIBCFILES=${LIBFILES:%=%.c}
|
LIBCFILES=${LIBFILES:%=%.c}
|
||||||
LIBOFILES=${LIBFILES:%=%.$O}
|
LIBOFILES=${LIBFILES:%=%.$O}
|
||||||
LIB=libfs.a$O
|
LIB=libfs.a
|
||||||
|
|
||||||
HFILES=\
|
HFILES=\
|
||||||
/sys/include/venti.h\
|
$PLAN9/include/venti.h\
|
||||||
stdinc.h\
|
stdinc.h\
|
||||||
vac.h\
|
vac.h\
|
||||||
dat.h\
|
dat.h\
|
||||||
|
|
@ -98,12 +99,12 @@ test:V: all
|
||||||
# unmount /n/fossil
|
# unmount /n/fossil
|
||||||
# rm /srv/fossil
|
# rm /srv/fossil
|
||||||
|
|
||||||
</sys/src/cmd/mkmany
|
<$PLAN9/src/mkmany
|
||||||
|
|
||||||
$LIB(%.$O):N: %.$O
|
$LIB(%.$O):N: %.$O
|
||||||
$LIB: ${LIBOFILES:%=$LIB(%)}
|
$LIB: ${LIBOFILES:%=$LIB(%)}
|
||||||
names = `{echo $newprereq |sed 's/ /\n/g' |sed -n 's/'$LIB'\(([^)]+)\)/\1/gp'}
|
names = `{echo $newprereq |sed 's/ /\n/g' |9 sed -n 's/'$LIB'\(([^)]+)\)/\1/gp'}
|
||||||
ar vu $LIB $names
|
$AR rsc $LIB $names
|
||||||
# rm $names
|
# rm $names
|
||||||
|
|
||||||
$O.flfmt: flfmt9660.$O
|
$O.flfmt: flfmt9660.$O
|
||||||
|
|
@ -128,9 +129,14 @@ bundle:V:
|
||||||
|
|
||||||
$O.conf:D: conf.rc
|
$O.conf:D: conf.rc
|
||||||
{
|
{
|
||||||
echo '#!/bin/rc'
|
echo '#!/usr/local/plan9/bin/rc'
|
||||||
echo '# THIS FILE IS AUTOMATICALLY GENERATED'
|
echo '# THIS FILE IS AUTOMATICALLY GENERATED'
|
||||||
echo '# FROM /sys/src/cmd/fossil/conf.rc. DO NOT EDIT.'
|
echo '# FROM /usr/local/plan9/src/cmd/fossil/conf.rc. DO NOT EDIT.'
|
||||||
echo
|
echo
|
||||||
sed 1d conf.rc
|
sed 1d conf.rc
|
||||||
} >$target && chmod +x $target
|
} >$target && chmod +x $target
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $LIB
|
||||||
|
|
||||||
|
nuke: clean
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ bwatchInit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
bwatchSetBlockSize(uint)
|
bwatchSetBlockSize(uint i)
|
||||||
{
|
{
|
||||||
|
USED(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
#include <libc.h>
|
#include <libc.h>
|
||||||
#include <libsec.h>
|
#include <libsec.h>
|
||||||
#include <thread.h>
|
#include <thread.h>
|
||||||
|
#ifdef PLAN9PORT
|
||||||
typedef uvlong u64int;
|
#include <9pclient.h>
|
||||||
typedef uchar u8int;
|
#endif
|
||||||
typedef ushort u16int;
|
|
||||||
|
|
||||||
#include "venti.h"
|
#include "venti.h"
|
||||||
#include "vac.h"
|
#include "vac.h"
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@ initxlabel(Label l)
|
||||||
typedef struct Xblock Xblock;
|
typedef struct Xblock Xblock;
|
||||||
struct Xblock
|
struct Xblock
|
||||||
{
|
{
|
||||||
Tnode;
|
Tnode *t;
|
||||||
Block *b;
|
Block *b;
|
||||||
int (*gen)(void*, Block*, int, Tnode**);
|
int (*gen)(void*, Block*, int, Tnode**);
|
||||||
void *arg;
|
void *arg;
|
||||||
|
|
@ -478,57 +478,58 @@ xblockexpand(Tnode *tt)
|
||||||
Xblock *t = (Xblock*)tt;
|
Xblock *t = (Xblock*)tt;
|
||||||
Tnode *nn;
|
Tnode *nn;
|
||||||
|
|
||||||
if(t->nkid >= 0)
|
if(t->t->nkid >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
if(t->printlabel){
|
if(t->printlabel){
|
||||||
t->kid = mallocz(Q*sizeof(t->kid[0]), 1);
|
t->t->kid = mallocz(Q*sizeof(t->t->kid[0]), 1);
|
||||||
t->kid[0] = initxlabel(t->b->l);
|
t->t->kid[0] = initxlabel(t->b->l);
|
||||||
j = 1;
|
j = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=0;; i++){
|
for(i=0;; i++){
|
||||||
switch((*t->gen)(t->arg, t->b, i, &nn)){
|
switch((*t->gen)(t->arg, t->b, i, &nn)){
|
||||||
case -1:
|
case -1:
|
||||||
t->nkid = j;
|
t->t->nkid = j;
|
||||||
return;
|
return;
|
||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if(j%Q == 0)
|
if(j%Q == 0)
|
||||||
t->kid = realloc(t->kid, (j+Q)*sizeof(t->kid[0]));
|
t->t->kid = realloc(t->t->kid, (j+Q)*sizeof(t->t->kid[0]));
|
||||||
t->kid[j++] = nn;
|
t->t->kid[j++] = nn;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nilgen(void*, Block*, int, Tnode**)
|
nilgen(void *v, Block *b, int o, Tnode **tp)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tnode*
|
Tnode*
|
||||||
initxblock(Block *b, char *s, int (*gen)(void*, Block*, int, Tnode**), void *arg)
|
initxblock(Block *b, char *s, int (*gen)(void *v, Block *b, int o, Tnode **tp), void *arg)
|
||||||
{
|
{
|
||||||
Xblock *t;
|
Xblock *t;
|
||||||
|
|
||||||
if(gen == nil)
|
if(gen == nil)
|
||||||
gen = nilgen;
|
gen = nilgen;
|
||||||
t = mallocz(sizeof(Xblock), 1);
|
t = mallocz(sizeof(Xblock), 1);
|
||||||
|
t->t = mallocz(sizeof(Tnode), 1);
|
||||||
t->b = b;
|
t->b = b;
|
||||||
t->gen = gen;
|
t->gen = gen;
|
||||||
t->arg = arg;
|
t->arg = arg;
|
||||||
if(b->addr == NilBlock)
|
if(b->addr == NilBlock)
|
||||||
t->str = smprint("Block %V: %s", b->score, s);
|
t->t->str = smprint("Block %V: %s", b->score, s);
|
||||||
else
|
else
|
||||||
t->str = smprint("Block %#ux: %s", b->addr, s);
|
t->t->str = smprint("Block %#ux: %s", b->addr, s);
|
||||||
t->printlabel = 1;
|
t->printlabel = 1;
|
||||||
t->nkid = -1;
|
t->t->nkid = -1;
|
||||||
t->expand = xblockexpand;
|
t->t->expand = xblockexpand;
|
||||||
return t;
|
return t->t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -557,7 +558,7 @@ initxentryblock(Block *b, Entry *ed)
|
||||||
typedef struct Xentry Xentry;
|
typedef struct Xentry Xentry;
|
||||||
struct Xentry
|
struct Xentry
|
||||||
{
|
{
|
||||||
Tnode;
|
Tnode *t;
|
||||||
Entry e;
|
Entry e;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -566,12 +567,12 @@ xentryexpand(Tnode *tt)
|
||||||
{
|
{
|
||||||
Xentry *t = (Xentry*)tt;
|
Xentry *t = (Xentry*)tt;
|
||||||
|
|
||||||
if(t->nkid >= 0)
|
if(t->t->nkid >= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
t->nkid = 1;
|
t->t->nkid = 1;
|
||||||
t->kid = mallocz(sizeof(t->kid[0])*t->nkid, 1);
|
t->t->kid = mallocz(sizeof(t->t->kid[0])*t->t->nkid, 1);
|
||||||
t->kid[0] = initxsource(t->e, 1);
|
t->t->kid[0] = initxsource(t->e, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tnode*
|
Tnode*
|
||||||
|
|
@ -580,14 +581,15 @@ initxentry(Entry e)
|
||||||
Xentry *t;
|
Xentry *t;
|
||||||
|
|
||||||
t = mallocz(sizeof *t, 1);
|
t = mallocz(sizeof *t, 1);
|
||||||
t->nkid = -1;
|
t->t = mallocz(sizeof(Tnode), 1);
|
||||||
t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V",
|
t->t->nkid = -1;
|
||||||
|
t->t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V",
|
||||||
e.gen, e.psize, e.dsize, e.depth, e.flags, e.size, e.score);
|
e.gen, e.psize, e.dsize, e.depth, e.flags, e.size, e.score);
|
||||||
if(e.flags & VtEntryLocal)
|
if(e.flags & VtEntryLocal)
|
||||||
t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->str, e.archive, e.snap, e.tag);
|
t->t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->t->str, e.archive, e.snap, e.tag);
|
||||||
t->expand = xentryexpand;
|
t->t->expand = xentryexpand;
|
||||||
t->e = e;
|
t->e = e;
|
||||||
return t;
|
return t->t;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
@ -659,7 +661,7 @@ initxsource(Entry e, int dowrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xlocalrootgen(void*, Block *b, int o, Tnode **tp)
|
xlocalrootgen(void *v, Block *b, int o, Tnode **tp)
|
||||||
{
|
{
|
||||||
Entry e;
|
Entry e;
|
||||||
|
|
||||||
|
|
@ -684,7 +686,7 @@ initxlocalroot(char *name, u32int addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
xvacrootgen(void*, Block *b, int o, Tnode **tp)
|
xvacrootgen(void *v, Block *b, int o, Tnode **tp)
|
||||||
{
|
{
|
||||||
Entry e;
|
Entry e;
|
||||||
|
|
||||||
|
|
@ -734,7 +736,7 @@ initxdirentry(MetaEntry *me)
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
metaentrygen(void *v, Block*, int o, Tnode **tp)
|
metaentrygen(void *v, Block *b, int o, Tnode **tp)
|
||||||
{
|
{
|
||||||
Tnode *t;
|
Tnode *t;
|
||||||
MetaBlock *mb;
|
MetaBlock *mb;
|
||||||
|
|
@ -765,11 +767,11 @@ metablockgen(void *v, Block *b, int o, Tnode **tp)
|
||||||
/* hack: reuse initxblock as a generic iterator */
|
/* hack: reuse initxblock as a generic iterator */
|
||||||
mb = v;
|
mb = v;
|
||||||
t = (Xblock*)initxblock(b, "", metaentrygen, mb);
|
t = (Xblock*)initxblock(b, "", metaentrygen, mb);
|
||||||
t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s",
|
t->t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s",
|
||||||
mb->size, mb->maxsize, mb->free, mb->nindex, mb->maxindex,
|
mb->size, mb->maxsize, mb->free, mb->nindex, mb->maxindex,
|
||||||
mb->botch ? " [BOTCH]" : "");
|
mb->botch ? " [BOTCH]" : "");
|
||||||
t->printlabel = 0;
|
t->printlabel = 0;
|
||||||
*tp = t;
|
*tp = t->t;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue