Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
This commit is contained in:
parent
77a0a5b519
commit
fa325e9b42
1021 changed files with 5688 additions and 6193 deletions
|
|
@ -91,7 +91,7 @@ readconfigfile(char *name, VtCache *vcache)
|
|||
|
||||
if((dir = dirstat(name)) == nil)
|
||||
return nil;
|
||||
|
||||
|
||||
if((b = Bopen(name, OREAD)) == nil){
|
||||
free(dir);
|
||||
return nil;
|
||||
|
|
@ -142,7 +142,7 @@ readconfigfile(char *name, VtCache *vcache)
|
|||
freeconfig(c);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,4 +132,3 @@ fsreaddir(SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int cookie, uchar **d
|
|||
{
|
||||
return fsysreaddir(fsys, au, h, count, cookie, data, pcount, peof);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,4 +56,3 @@ mountnfs(int proto, struct sockaddr_in *sa, uchar *handle, int nhandle, char *mt
|
|||
if(mount("backup:/", mtpt, "nfs", mflag, &nfs) < 0)
|
||||
sysfatal("mount: %r");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,4 +9,3 @@ mountnfs(int proto, struct sockaddr_in *addr, uchar *handle, int hlen, char *mtp
|
|||
{
|
||||
sysfatal("mountnfs not implemented");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ rumnt(SunMsg *m)
|
|||
NfsMount3RUmnt rx;
|
||||
|
||||
/* ignore */
|
||||
|
||||
|
||||
memset(&rx, 0, sizeof rx);
|
||||
return sunmsgreply(m, &rx.call);
|
||||
}
|
||||
|
|
@ -359,7 +359,7 @@ rrofs(SunMsg *m)
|
|||
memset(buf, 0, sizeof buf);
|
||||
return senderror(m, (SunCall*)buf, Nfs3ErrRoFs);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
rnfs3(void *v)
|
||||
|
|
@ -429,4 +429,3 @@ nfs3proc(void *v)
|
|||
while((m = recvp(c)) != nil)
|
||||
threadcreate(rnfs3, m, SunStackSize);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,4 +15,3 @@ enum
|
|||
{
|
||||
MaxDataSize = 8192
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* -s print status updates
|
||||
* -v print debugging trace
|
||||
* -w write parallelism
|
||||
*
|
||||
*
|
||||
* If score is given on the command line, it should be the
|
||||
* score from a previous vbackup on this fspartition.
|
||||
* In this mode, only the new blocks are stored to Venti.
|
||||
|
|
@ -24,12 +24,12 @@
|
|||
* by buffered queues:
|
||||
*
|
||||
* fsysproc | cmpproc | ventiproc
|
||||
*
|
||||
*
|
||||
* Fsysproc reads the disk and queues the blocks.
|
||||
* Cmpproc compares the blocks against the SHA1 hashes
|
||||
* in the old image, if any. It discards the unchanged blocks
|
||||
* and queues the changed ones. Ventiproc writes blocks to Venti.
|
||||
*
|
||||
*
|
||||
* There is a fourth proc, statusproc, which prints status
|
||||
* updates about how the various procs are progressing.
|
||||
*/
|
||||
|
|
@ -259,14 +259,14 @@ threadmain(int argc, char **argv)
|
|||
tmpnam = smprint("%s/vbackup.XXXXXX", tmp);
|
||||
if(tmpnam == nil)
|
||||
sysfatal("smprint: %r");
|
||||
|
||||
|
||||
if((fd = opentemp(tmpnam, ORDWR|ORCLOSE)) < 0)
|
||||
sysfatal("opentemp %s: %r", tmpnam);
|
||||
if(statustime)
|
||||
print("# %T reading scores into %s\n", tmpnam);
|
||||
if(verbose)
|
||||
fprint(2, "read scores into %s...\n", tmpnam);
|
||||
|
||||
|
||||
Binit(&bscores, fd, OWRITE);
|
||||
for(i=0; i<fsys->nblock; i++){
|
||||
if(vtfileblockscore(vfile, i, score) < 0)
|
||||
|
|
@ -276,7 +276,7 @@ threadmain(int argc, char **argv)
|
|||
}
|
||||
Bterm(&bscores);
|
||||
vtfileunlock(vfile);
|
||||
|
||||
|
||||
/*
|
||||
* prep scores for rereading
|
||||
*/
|
||||
|
|
@ -285,7 +285,7 @@ threadmain(int argc, char **argv)
|
|||
}
|
||||
|
||||
/*
|
||||
* start the main processes
|
||||
* start the main processes
|
||||
*/
|
||||
if(statustime)
|
||||
print("# %T starting procs\n");
|
||||
|
|
@ -307,7 +307,7 @@ threadmain(int argc, char **argv)
|
|||
* wait for processes to finish
|
||||
*/
|
||||
wlock(&endlk);
|
||||
|
||||
|
||||
qfree(qcmp);
|
||||
qfree(qventi);
|
||||
|
||||
|
|
@ -358,7 +358,7 @@ threadmain(int argc, char **argv)
|
|||
if(mountplace == nil)
|
||||
mountplace = guessmountplace(argv[0]);
|
||||
print("mount /%s/%d/%02d%02d%s %s:%V %d/%02d%02d/%02d%02d\n",
|
||||
mountname, tm.year, tm.mon, tm.mday,
|
||||
mountname, tm.year, tm.mon, tm.mday,
|
||||
mountplace,
|
||||
root.type, b->score,
|
||||
tm.year, tm.mon, tm.mday, tm.hour, tm.min);
|
||||
|
|
@ -370,7 +370,7 @@ threadmain(int argc, char **argv)
|
|||
sysfatal("vtsync: %r");
|
||||
if(statustime)
|
||||
print("# %T synced\n");
|
||||
|
||||
|
||||
fsysclose(fsys);
|
||||
diskclose(disk);
|
||||
vtcachefree(zcache);
|
||||
|
|
@ -468,7 +468,7 @@ writethread(void *v)
|
|||
nrecv++;
|
||||
if(wr.p == nil)
|
||||
break;
|
||||
|
||||
|
||||
if(fastwrites && vtread(z, wr.score, wr.type, nil, 0) < 0){
|
||||
rerrstr(err, sizeof err);
|
||||
if(strstr(err, "read too small")){ /* already exists */
|
||||
|
|
@ -581,7 +581,7 @@ timefmt(Fmt *fmt)
|
|||
Tm tm;
|
||||
ns = nsec();
|
||||
tm = *localtime(time(0));
|
||||
return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d.%03d",
|
||||
return fmtprint(fmt, "%04d/%02d%02d %02d:%02d:%02d.%03d",
|
||||
tm.year+1900, tm.mon+1, tm.mday, tm.hour, tm.min, tm.sec,
|
||||
(int)(ns%1000000000)/1000000);
|
||||
}
|
||||
|
|
@ -592,7 +592,7 @@ guessmountplace(char *dev)
|
|||
char *cmd, *q;
|
||||
int p[2], fd[3], n;
|
||||
char buf[100];
|
||||
|
||||
|
||||
if(pipe(p) < 0)
|
||||
sysfatal("pipe: %r");
|
||||
|
||||
|
|
@ -617,4 +617,3 @@ guessmountplace(char *dev)
|
|||
*--q = 0;
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ struct Cmd
|
|||
char *help;
|
||||
};
|
||||
|
||||
Cmd cmdtab[] =
|
||||
Cmd cmdtab[] =
|
||||
{
|
||||
"cd", cmdcd, "cd dir - change directory",
|
||||
"ls", cmdls, "ls [-d] path... - list file",
|
||||
|
|
@ -49,7 +49,7 @@ char*
|
|||
ebuf(void)
|
||||
{
|
||||
static char buf[ERRMAX];
|
||||
|
||||
|
||||
rerrstr(buf, sizeof buf);
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ static char*
|
|||
estrdup(char *s)
|
||||
{
|
||||
char *t;
|
||||
|
||||
|
||||
t = emalloc(strlen(s)+1);
|
||||
strcpy(t, s);
|
||||
return t;
|
||||
|
|
@ -70,7 +70,7 @@ walk(char *path, Nfs3Handle *ph)
|
|||
char *p, *q;
|
||||
Nfs3Handle h;
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
path = estrdup(path); /* writable */
|
||||
if(path[0] == '/')
|
||||
h = root;
|
||||
|
|
@ -99,7 +99,7 @@ char*
|
|||
cmdhelp(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for(i=0; i<nelem(cmdtab); i++)
|
||||
print("%s\n", cmdtab[i].help);
|
||||
return nil;
|
||||
|
|
@ -112,10 +112,10 @@ cmdcd(int argc, char **argv)
|
|||
Nfs3Attr attr;
|
||||
Nfs3Status ok;
|
||||
Nfs3Handle h;
|
||||
|
||||
|
||||
if(argc != 2)
|
||||
return "usage: cd dir";
|
||||
|
||||
|
||||
if((err = walk(argv[1], &h)) != nil)
|
||||
return err;
|
||||
if((ok = fsysgetattr(fsys, auth, &h, &attr)) != Nfs3Ok){
|
||||
|
|
@ -152,7 +152,7 @@ void
|
|||
ls(char *dir, char *elem, Nfs3Attr *attr)
|
||||
{
|
||||
char c;
|
||||
|
||||
|
||||
c = ' '; /* use attr->type */
|
||||
Bprint(&bout, "%s%s%s", dir ? dir : "", dir && elem ? "/" : "", elem ? elem : "");
|
||||
Bprint(&bout, " %c%luo %1d %4d %4d", c, attr->mode, attr->nlink, attr->uid, attr->gid);
|
||||
|
|
@ -172,7 +172,7 @@ lsdir(char *dir, Nfs3Handle *h)
|
|||
u1int eof;
|
||||
Nfs3Status ok;
|
||||
u64int cookie;
|
||||
|
||||
|
||||
cookie = 0;
|
||||
for(;;){
|
||||
ok = fsysreaddir(fsys, auth, h, 8192, cookie, &data, &count, &eof);
|
||||
|
|
@ -201,7 +201,7 @@ fprint(2, "got %d\n", count);
|
|||
continue;
|
||||
}
|
||||
ls(dir, e.name, &attr);
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
if(eof)
|
||||
break;
|
||||
|
|
@ -217,7 +217,7 @@ cmdls(int argc, char **argv)
|
|||
Nfs3Handle h;
|
||||
Nfs3Attr attr;
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
dflag = 0;
|
||||
ARGBEGIN{
|
||||
case 'd':
|
||||
|
|
@ -232,7 +232,7 @@ cmdls(int argc, char **argv)
|
|||
Bflush(&bout);
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
for(i=0; i<argc; i++){
|
||||
if((e = walk(argv[i], &h)) != nil){
|
||||
fprint(2, "%s: %s\n", argv[i], e);
|
||||
|
|
@ -264,7 +264,7 @@ cmdget(int argc, char **argv)
|
|||
Nfs3Attr attr;
|
||||
Nfs3Status ok;
|
||||
vlong o;
|
||||
|
||||
|
||||
dflag = 0;
|
||||
ARGBEGIN{
|
||||
default:
|
||||
|
|
@ -274,7 +274,7 @@ cmdget(int argc, char **argv)
|
|||
|
||||
if(argc != 1 && argc != 2)
|
||||
goto usage;
|
||||
|
||||
|
||||
if((e = walk(argv[0], &h)) != nil){
|
||||
fprint(2, "%s: %s\n", argv[0], e);
|
||||
return nil;
|
||||
|
|
@ -319,12 +319,12 @@ cmdblock(int argc, char **argv)
|
|||
char *e;
|
||||
Nfs3Handle h;
|
||||
u64int bno;
|
||||
|
||||
|
||||
ARGBEGIN{
|
||||
default:
|
||||
return "usage: block path offset";
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc != 2)
|
||||
return "usage: block path offset";
|
||||
|
||||
|
|
@ -347,19 +347,19 @@ cmddisk(int argc, char **argv)
|
|||
int delta, count, i;
|
||||
u64int offset;
|
||||
uchar *p;
|
||||
|
||||
|
||||
ARGBEGIN{
|
||||
default:
|
||||
return "usage: disk offset count";
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc != 2)
|
||||
return "usage: disk offset count";
|
||||
|
||||
offset = strtoull(argv[0], 0, 0);
|
||||
count = atoi(argv[1]);
|
||||
delta = offset%fsys->blocksize;
|
||||
|
||||
|
||||
b = diskread(disk, fsys->blocksize, offset-delta);
|
||||
if(b == nil){
|
||||
fprint(2, "diskread: %r\n");
|
||||
|
|
@ -396,7 +396,7 @@ threadmain(int argc, char **argv)
|
|||
int i, nf;
|
||||
uchar score[VtScoreSize];
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
allowall = 1;
|
||||
ARGBEGIN{
|
||||
case 'V':
|
||||
|
|
@ -405,14 +405,14 @@ threadmain(int argc, char **argv)
|
|||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc != 1)
|
||||
usage();
|
||||
|
||||
fmtinstall('F', vtfcallfmt);
|
||||
fmtinstall('H', encodefmt);
|
||||
fmtinstall('V', vtscorefmt);
|
||||
|
||||
|
||||
if(access(argv[0], AEXIST) >= 0 || strchr(argv[0], '/')){
|
||||
if((disk = diskopenfile(argv[0])) == nil)
|
||||
sysfatal("diskopen: %r");
|
||||
|
|
@ -442,7 +442,7 @@ threadmain(int argc, char **argv)
|
|||
cwd = root;
|
||||
Binit(&bin, 0, OREAD);
|
||||
Binit(&bout, 1, OWRITE);
|
||||
|
||||
|
||||
while(fprint(2, "vftp> "), (p = Brdstr(&bin, '\n', 1)) != nil){
|
||||
if(p[0] == '#')
|
||||
continue;
|
||||
|
|
@ -461,4 +461,3 @@ threadmain(int argc, char **argv)
|
|||
}
|
||||
threadexitsall(nil);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ threadmain(int argc, char **argv)
|
|||
nfschan = chancreate(sizeof(SunMsg*), 0);
|
||||
mountchan = chancreate(sizeof(SunMsg*), 0);
|
||||
timerchan = chancreate(sizeof(void*), 0);
|
||||
|
||||
|
||||
if(sunsrvudp(srv, addr) < 0)
|
||||
sysfatal("starting server: %r");
|
||||
|
||||
|
|
@ -162,7 +162,7 @@ threadmain(int argc, char **argv)
|
|||
sunsrvthreadcreate(srv, mount3proc, mountchan);
|
||||
sunsrvthreadcreate(srv, timerthread, nil);
|
||||
proccreate(timerproc, nil, 32768);
|
||||
|
||||
|
||||
sunsrvprog(srv, &nfs3prog, nfschan);
|
||||
sunsrvprog(srv, &nfsmount3prog, mountchan);
|
||||
|
||||
|
|
@ -200,13 +200,13 @@ unittoull(char *s)
|
|||
|
||||
/*
|
||||
* Handles.
|
||||
*
|
||||
*
|
||||
* We store all the state about which file a client is accessing in
|
||||
* the handle, so that we don't have to maintain any per-client state
|
||||
* ourselves. In order to avoid leaking handles or letting clients
|
||||
* ourselves. In order to avoid leaking handles or letting clients
|
||||
* create arbitrary handles, we sign and encrypt each handle with
|
||||
* AES using a key selected randomly when the server starts.
|
||||
* Thus, handles cannot be used across sessions.
|
||||
* Thus, handles cannot be used across sessions.
|
||||
*
|
||||
* The decrypted handles begin with the following header:
|
||||
*
|
||||
|
|
@ -215,7 +215,7 @@ unittoull(char *s)
|
|||
*
|
||||
* If we're pressed for space in the rest of the handle, we could
|
||||
* probably reduce the amount of sessid bytes. Note that the sessid
|
||||
* bytes must be consistent during a run of vnfs, or else some
|
||||
* bytes must be consistent during a run of vnfs, or else some
|
||||
* clients (e.g., Linux 2.4) eventually notice that successive TLookups
|
||||
* return different handles, and they return "Stale NFS file handle"
|
||||
* errors to system calls in response (even though we never sent
|
||||
|
|
@ -231,9 +231,9 @@ unittoull(char *s)
|
|||
* and the handles need to be stable across changes in the config file
|
||||
* (though not across server restarts since encryption screws
|
||||
* that up nicely).
|
||||
*
|
||||
* We encode each of the first two as a 10-byte hash that is
|
||||
* the first half of a SHA1 hash.
|
||||
*
|
||||
* We encode each of the first two as a 10-byte hash that is
|
||||
* the first half of a SHA1 hash.
|
||||
*/
|
||||
|
||||
enum
|
||||
|
|
@ -291,7 +291,7 @@ static Nfs3Status
|
|||
hdecrypt(Nfs3Handle *h)
|
||||
{
|
||||
AESstate aes;
|
||||
|
||||
|
||||
if(h->len == 1 && h->h[0] == 0){ /* single 0 byte is root */
|
||||
*h = root;
|
||||
return Nfs3Ok;
|
||||
|
|
@ -323,7 +323,7 @@ cryptinit(void)
|
|||
uchar key[32], ivec[AESbsize];
|
||||
int i;
|
||||
u32int u32;
|
||||
|
||||
|
||||
u32 = truerand();
|
||||
memmove(sessid, &u32, 4);
|
||||
for(i=0; i<nelem(key); i+=4) {
|
||||
|
|
@ -371,12 +371,12 @@ struct Cnode
|
|||
Cnode *nextsib; /* in tree */
|
||||
Cnode *kidlist; /* in tree */
|
||||
Cnode *nexthash; /* in hash list */
|
||||
|
||||
|
||||
Nfs3Status (*read)(Cnode*, u32int, u64int, uchar**, u32int*, u1int*); /* synthesized read fn */
|
||||
|
||||
uchar handle[VtScoreSize]; /* sha1(path to here) */
|
||||
ulong mtime; /* mtime for this directory entry */
|
||||
|
||||
|
||||
/* fsys overlay on this node */
|
||||
Fsys *fsys; /* cache of memory structure */
|
||||
Nfs3Handle fsyshandle;
|
||||
|
|
@ -394,7 +394,7 @@ struct Cnode
|
|||
char *fsysimage; /* raw disk image */
|
||||
Fsys *mfsys; /* mounted file system (nil until walked) */
|
||||
Nfs3Handle mfsyshandle; /* handle to root of mounted fsys */
|
||||
|
||||
|
||||
int mark; /* gc */
|
||||
};
|
||||
|
||||
|
|
@ -409,7 +409,7 @@ mkcnode(Ctree *t, Cnode *parent, char *elem, uint elen, char *path, uint plen)
|
|||
{
|
||||
uint h;
|
||||
Cnode *n;
|
||||
|
||||
|
||||
n = emalloc(sizeof *n + elen+1);
|
||||
n->name = (char*)(n+1);
|
||||
memmove(n->name, elem, elen);
|
||||
|
|
@ -424,7 +424,7 @@ mkcnode(Ctree *t, Cnode *parent, char *elem, uint elen, char *path, uint plen)
|
|||
h = dumbhash(n->handle);
|
||||
n->nexthash = t->hash[h];
|
||||
t->hash[h] = n;
|
||||
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +446,7 @@ refreshdisk(void)
|
|||
int i;
|
||||
Cnode *n;
|
||||
Ctree *t;
|
||||
|
||||
|
||||
t = config.ctree;
|
||||
for(i=0; i<nelem(t->hash); i++)
|
||||
for(n=t->hash[i]; n; n=n->nexthash){
|
||||
|
|
@ -485,7 +485,7 @@ static Cnode*
|
|||
cnodewalk(Cnode *n, char *name, uint len, int markokay)
|
||||
{
|
||||
Cnode *nn;
|
||||
|
||||
|
||||
for(nn=n->kidlist; nn; nn=nn->nextsib)
|
||||
if(strncmp(nn->name, name, len) == 0 && nn->name[len] == 0)
|
||||
if(!nn->mark || markokay)
|
||||
|
|
@ -498,7 +498,7 @@ ctreewalkpath(Ctree *t, char *name, ulong createmtime)
|
|||
{
|
||||
Cnode *n, *nn;
|
||||
char *p, *nextp;
|
||||
|
||||
|
||||
n = t->root;
|
||||
p = name;
|
||||
for(; *p; p=nextp){
|
||||
|
|
@ -526,10 +526,10 @@ Ctree*
|
|||
mkctree(void)
|
||||
{
|
||||
Ctree *t;
|
||||
|
||||
|
||||
t = emalloc(sizeof *t);
|
||||
t->root = mkcnode(t, nil, "", 0, "", 0);
|
||||
|
||||
|
||||
ctreewalkpath(t, "/+log", time(0))->read = logread;
|
||||
ctreewalkpath(t, "/+refreshdisk", time(0))->read = refreshdiskread;
|
||||
ctreewalkpath(t, "/+refreshconfig", time(0))->read = refreshconfigread;
|
||||
|
|
@ -541,7 +541,7 @@ Cnode*
|
|||
ctreemountfsys(Ctree *t, char *path, ulong time, uchar *score, char *file)
|
||||
{
|
||||
Cnode *n;
|
||||
|
||||
|
||||
if(time == 0)
|
||||
time = 1;
|
||||
n = ctreewalkpath(t, path, time);
|
||||
|
|
@ -570,7 +570,7 @@ cnodebyhandle(Ctree *t, uchar *p)
|
|||
{
|
||||
int h;
|
||||
Cnode *n;
|
||||
|
||||
|
||||
h = dumbhash(p);
|
||||
for(n=t->hash[h]; n; n=n->nexthash)
|
||||
if(memcmp(n->handle, p, CnodeHandleSize) == 0)
|
||||
|
|
@ -582,7 +582,7 @@ static int
|
|||
parseipandmask(char *s, uchar *ip, uchar *mask)
|
||||
{
|
||||
char *p, *q;
|
||||
|
||||
|
||||
p = strchr(s, '/');
|
||||
if(p)
|
||||
*p++ = 0;
|
||||
|
|
@ -609,14 +609,14 @@ parsetime(char *s, ulong *time)
|
|||
char *p;
|
||||
int i;
|
||||
Tm tm;
|
||||
|
||||
|
||||
/* decimal integer is seconds since 1970 */
|
||||
x = strtoul(s, &p, 10);
|
||||
if(x > 0 && *p == 0){
|
||||
*time = x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* otherwise expect yyyy/mmdd/hhmm */
|
||||
if(strlen(s) != 14 || s[4] != '/' || s[9] != '/')
|
||||
return -1;
|
||||
|
|
@ -629,7 +629,7 @@ parsetime(char *s, ulong *time)
|
|||
return -1;
|
||||
tm.mon = (s[5]-'0')*10+s[6]-'0' - 1;
|
||||
if(tm.mon < 0 || tm.mon > 11)
|
||||
return -1;
|
||||
return -1;
|
||||
tm.mday = (s[7]-'0')*10+s[8]-'0';
|
||||
if(tm.mday < 0 || tm.mday > 31)
|
||||
return -1;
|
||||
|
|
@ -673,7 +673,7 @@ readconfigfile(Config *cp)
|
|||
free(dir);
|
||||
if((b = Bopen(name, OREAD)) == nil)
|
||||
return -1;
|
||||
|
||||
|
||||
/*
|
||||
* Reuse old tree, garbage collecting entries that
|
||||
* are not mentioned in the new config file.
|
||||
|
|
@ -684,7 +684,7 @@ readconfigfile(Config *cp)
|
|||
markctree(c.ctree);
|
||||
c.ok = nil;
|
||||
c.nok = 0;
|
||||
|
||||
|
||||
line = 0;
|
||||
for(; (p=Brdstr(b, '\n', 1)) != nil; free(p)){
|
||||
line++;
|
||||
|
|
@ -726,7 +726,7 @@ readconfigfile(Config *cp)
|
|||
}
|
||||
if(strcmp(f[0], "allow") == 0 || strcmp(f[0], "deny") == 0){
|
||||
if(nf != 2){
|
||||
werrstr("syntax error: allow|deny ip[/mask]");
|
||||
werrstr("syntax error: allow|deny ip[/mask]");
|
||||
goto badline;
|
||||
}
|
||||
c.ok = erealloc(c.ok, (c.nok+1)*sizeof(c.ok[0]));
|
||||
|
|
@ -755,8 +755,8 @@ ipokay(uchar *ip, ushort port)
|
|||
{
|
||||
int i;
|
||||
uchar ipx[IPaddrlen];
|
||||
Ipokay *ok;
|
||||
|
||||
Ipokay *ok;
|
||||
|
||||
for(i=0; i<config.nok; i++){
|
||||
ok = &config.ok[i];
|
||||
maskip(ip, ok->mask, ipx);
|
||||
|
|
@ -775,7 +775,7 @@ Nfs3Status
|
|||
cnodelookup(Ctree *t, Cnode **np, char *name)
|
||||
{
|
||||
Cnode *n, *nn;
|
||||
|
||||
|
||||
n = *np;
|
||||
if(n->isblackhole)
|
||||
return Nfs3Ok;
|
||||
|
|
@ -826,7 +826,7 @@ cnodereaddir(Cnode *n, u32int count, u64int cookie, uchar **pdata, u32int *pcoun
|
|||
u64int c;
|
||||
u64int u64;
|
||||
Nfs3Entry ne;
|
||||
|
||||
|
||||
n = n->kidlist;
|
||||
c = cookie;
|
||||
for(; c && n; c--)
|
||||
|
|
@ -837,7 +837,7 @@ cnodereaddir(Cnode *n, u32int count, u64int cookie, uchar **pdata, u32int *pcoun
|
|||
*peof = 1;
|
||||
return Nfs3Ok;
|
||||
}
|
||||
|
||||
|
||||
data = emalloc(count);
|
||||
p = data;
|
||||
ep = data+count;
|
||||
|
|
@ -882,7 +882,7 @@ timerthread(void *v)
|
|||
}
|
||||
|
||||
/*
|
||||
* Actually serve the NFS requests. Called from nfs3srv.c.
|
||||
* Actually serve the NFS requests. Called from nfs3srv.c.
|
||||
* Each request runs in its own thread (coroutine).
|
||||
*
|
||||
* Decrypted handles have the form:
|
||||
|
|
@ -891,7 +891,7 @@ timerthread(void *v)
|
|||
* glob[10] - SHA1 hash prefix identifying a glob state
|
||||
* fsyshandle[<=10] - disk file system handle (usually 4 bytes)
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* A fid represents a point in the file tree.
|
||||
* There are three components, all derived from the handle:
|
||||
|
|
@ -933,7 +933,7 @@ handletofid(Nfs3Handle *eh, Fid *fid, int mode)
|
|||
Fsys *fsys;
|
||||
Nfs3Status ok;
|
||||
Nfs3Handle h2, *h, *fh;
|
||||
|
||||
|
||||
memset(fid, 0, sizeof *fid);
|
||||
|
||||
domount = 1;
|
||||
|
|
@ -999,7 +999,7 @@ handletofid(Nfs3Handle *eh, Fid *fid, int mode)
|
|||
n->mfsys = fsys;
|
||||
fsysroot(fsys, &n->mfsyshandle);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Use inner handle.
|
||||
*/
|
||||
|
|
@ -1010,7 +1010,7 @@ handletofid(Nfs3Handle *eh, Fid *fid, int mode)
|
|||
* Use fsys handle from tree or from handle.
|
||||
* This assumes that fsyshandle was set by fidtohandle
|
||||
* earlier, so it's not okay to reuse handles (except the root)
|
||||
* across sessions. The encryption above makes and
|
||||
* across sessions. The encryption above makes and
|
||||
* enforces the same restriction, so this is okay.
|
||||
*/
|
||||
fid->fsys = n->fsys;
|
||||
|
|
@ -1035,7 +1035,7 @@ void
|
|||
_fidtohandle(Fid *fid, Nfs3Handle *h)
|
||||
{
|
||||
Cnode *n;
|
||||
|
||||
|
||||
n = fid->cnode;
|
||||
/*
|
||||
* Record fsys handle in n, don't bother sending it to client
|
||||
|
|
@ -1062,7 +1062,7 @@ void
|
|||
setrootfid(void)
|
||||
{
|
||||
Fid fid;
|
||||
|
||||
|
||||
memset(&fid, 0, sizeof fid);
|
||||
fid.cnode = config.ctree->root;
|
||||
_fidtohandle(&fid, &root);
|
||||
|
|
@ -1101,7 +1101,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
Nfs3Status ok;
|
||||
Nfs3Handle xh;
|
||||
int mode;
|
||||
|
||||
|
||||
trace("lookup %.*lH %s\n", h->len, h->h, name);
|
||||
|
||||
mode = HWalk;
|
||||
|
|
@ -1112,7 +1112,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
trace("lookup: handletofid %r\n");
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
if(strcmp(name, ".") == 0){
|
||||
fidtohandle(&fid, nh);
|
||||
return Nfs3Ok;
|
||||
|
|
@ -1122,7 +1122,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
* Walk down file system and cnode simultaneously.
|
||||
* If dotdot and file system doesn't move, need to walk
|
||||
* up cnode. Save the corresponding fsys handles in
|
||||
* the cnode as we walk down so that we'll have them
|
||||
* the cnode as we walk down so that we'll have them
|
||||
* for dotdotting back up.
|
||||
*/
|
||||
n = fid.cnode;
|
||||
|
|
@ -1143,7 +1143,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
return ok;
|
||||
}
|
||||
fid.fsyshandle = xh;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
/*
|
||||
* Walking dotdot. Ick.
|
||||
|
|
@ -1162,7 +1162,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
|
||||
/*
|
||||
* Usually just go to n->parent.
|
||||
*
|
||||
*
|
||||
* If we're in a subtree of the mounted file system that
|
||||
* isn't represented explicitly by the config tree (instead
|
||||
* the black hole node represents the entire file tree),
|
||||
|
|
@ -1176,7 +1176,7 @@ fslookup(SunAuthUnix *au, Nfs3Handle *h, char *name, Nfs3Handle *nh)
|
|||
n->parent->fsyshandle.len, n->parent->fsyshandle.h,
|
||||
xh.len, xh.h);
|
||||
}
|
||||
|
||||
|
||||
if(n->isblackhole){
|
||||
if(handlecmp(&n->parent->mfsyshandle, &xh) == 0)
|
||||
n = n->parent;
|
||||
|
|
@ -1205,7 +1205,7 @@ fsaccess(SunAuthUnix *au, Nfs3Handle *h, u32int want, u32int *got, Nfs3Attr *att
|
|||
{
|
||||
Fid fid;
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
trace("access %.*lH 0x%ux\n", h->len, h->h, want);
|
||||
if((ok = handletofid(h, &fid, HAccess)) != Nfs3Ok)
|
||||
return ok;
|
||||
|
|
@ -1220,7 +1220,7 @@ fsreadlink(SunAuthUnix *au, Nfs3Handle *h, char **link)
|
|||
{
|
||||
Fid fid;
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
trace("readlink %.*lH\n", h->len, h->h);
|
||||
if((ok = handletofid(h, &fid, HRead)) != Nfs3Ok)
|
||||
return ok;
|
||||
|
|
@ -1235,7 +1235,7 @@ fsreadfile(SunAuthUnix *au, Nfs3Handle *h, u32int count, u64int offset, uchar **
|
|||
{
|
||||
Fid fid;
|
||||
Nfs3Status ok;
|
||||
|
||||
|
||||
trace("readfile %.*lH\n", h->len, h->h);
|
||||
if((ok = handletofid(h, &fid, HRead)) != Nfs3Ok)
|
||||
return ok;
|
||||
|
|
@ -1252,7 +1252,7 @@ fsreaddir(SunAuthUnix *au, Nfs3Handle *h, u32int len, u64int cookie, uchar **pda
|
|||
Fid fid;
|
||||
Nfs3Status ok;
|
||||
|
||||
trace("readdir %.*lH\n", h->len, h->h);
|
||||
trace("readdir %.*lH\n", h->len, h->h);
|
||||
if((ok = handletofid(h, &fid, HRead)) != Nfs3Ok)
|
||||
return ok;
|
||||
if(fid.fsys)
|
||||
|
|
@ -1272,7 +1272,7 @@ Nfs3Status
|
|||
refreshdiskread(Cnode *n, u32int count, u64int offset, uchar **data, u32int *pcount, u1int *peof)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
|
||||
if(offset != 0){
|
||||
*pcount = 0;
|
||||
*peof = 1;
|
||||
|
|
@ -1293,7 +1293,7 @@ Nfs3Status
|
|||
refreshconfigread(Cnode *n, u32int count, u64int offset, uchar **data, u32int *pcount, u1int *peof)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
|
||||
if(offset != 0){
|
||||
*pcount = 0;
|
||||
*peof = 1;
|
||||
|
|
@ -1309,4 +1309,3 @@ refreshconfigread(Cnode *n, u32int count, u64int offset, uchar **data, u32int *p
|
|||
*peof = 1;
|
||||
return Nfs3Ok;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue