set qid.vers (Erik Quanstrom)
This commit is contained in:
parent
adeb5ac9eb
commit
3d484b0d1a
7 changed files with 21 additions and 17 deletions
|
|
@ -64,7 +64,7 @@ disksize(int fd, int dev)
|
|||
return u64;
|
||||
#endif
|
||||
if(ioctl(fd, BLKGETSIZE, &l) >= 0)
|
||||
return (vlong)l*512;
|
||||
return l*512;
|
||||
if(ioctl(fd, HDIO_GETGEO, &geo) >= 0)
|
||||
return (vlong)geo.heads*geo.sectors*geo.cylinders*512;
|
||||
return 0;
|
||||
|
|
@ -173,6 +173,8 @@ _p9dir(struct stat *lst, struct stat *st, char *name, Dir *d, char **str, char *
|
|||
#ifdef _HAVESTGEN
|
||||
d->qid.vers = st->st_gen;
|
||||
#endif
|
||||
if(d->qid.vers == 0)
|
||||
d->qid.vers = st->st_mtime + st->st_ctime;
|
||||
d->mode = st->st_mode&0777;
|
||||
d->atime = st->st_atime;
|
||||
d->mtime = st->st_mtime;
|
||||
|
|
|
|||
|
|
@ -60,10 +60,6 @@ p9dial(char *addr, char *local, char *dummy2, int *dummy3)
|
|||
}
|
||||
free(buf);
|
||||
|
||||
memset(&sa, 0, sizeof sa);
|
||||
memmove(&sa.sin_addr, &host, 4);
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(port);
|
||||
if((s = socket(AF_INET, proto, 0)) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
@ -100,9 +96,15 @@ p9dial(char *addr, char *local, char *dummy2, int *dummy3)
|
|||
|
||||
n = 1;
|
||||
setsockopt(s, SOL_SOCKET, SO_BROADCAST, &n, sizeof n);
|
||||
if(connect(s, (struct sockaddr*)&sa, sizeof sa) < 0){
|
||||
close(s);
|
||||
return -1;
|
||||
if(host != 0){
|
||||
memset(&sa, 0, sizeof sa);
|
||||
memmove(&sa.sin_addr, &host, 4);
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(port);
|
||||
if(connect(s, (struct sockaddr*)&sa, sizeof sa) < 0){
|
||||
close(s);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if(proto == SOCK_STREAM){
|
||||
int one = 1;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ fmtfdinit(Fmt *f, int fd, char *buf, int size)
|
|||
f->to = buf;
|
||||
f->stop = buf + size;
|
||||
f->flush = __fmtFdFlush;
|
||||
f->farg = (void*)fd;
|
||||
f->farg = (void*)(uintptr_t)fd;
|
||||
f->nfmt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ __fmtFdFlush(Fmt *f)
|
|||
int n;
|
||||
|
||||
n = (char*)f->to - (char*)f->start;
|
||||
if(n && write((int)f->farg, f->start, n) != n)
|
||||
if(n && write((uintptr)f->farg, f->start, n) != n)
|
||||
return 0;
|
||||
f->to = f->start;
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ runeFmtStrFlush(Fmt *f)
|
|||
|
||||
if(f->start == nil)
|
||||
return 0;
|
||||
n = (int)f->farg;
|
||||
n = (uintptr)f->farg;
|
||||
n *= 2;
|
||||
s = (Rune*)f->start;
|
||||
f->start = realloc(s, sizeof(Rune)*n);
|
||||
|
|
@ -47,7 +47,7 @@ runeFmtStrFlush(Fmt *f)
|
|||
free(s);
|
||||
return 0;
|
||||
}
|
||||
f->farg = (void*)n;
|
||||
f->farg = (void*)(uintptr)n;
|
||||
f->to = (Rune*)f->start + ((Rune*)f->to - s);
|
||||
f->stop = (Rune*)f->start + n - 1;
|
||||
return 1;
|
||||
|
|
@ -67,7 +67,7 @@ runefmtstrinit(Fmt *f)
|
|||
f->to = f->start;
|
||||
f->stop = (Rune*)f->start + n - 1;
|
||||
f->flush = runeFmtStrFlush;
|
||||
f->farg = (void*)n;
|
||||
f->farg = (void*)(uintptr)n;
|
||||
f->nfmt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ sprint(char *buf, char *fmt, ...)
|
|||
* we must be sure not to overflow a 32-bit pointer.
|
||||
*/
|
||||
if(buf+len < buf)
|
||||
len = -(uint)buf-1;
|
||||
len = -(uintptr)buf-1;
|
||||
|
||||
va_start(args, fmt);
|
||||
n = vsnprint(buf, len, fmt, args);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ fmtStrFlush(Fmt *f)
|
|||
|
||||
if(f->start == nil)
|
||||
return 0;
|
||||
n = (int)f->farg;
|
||||
n = (uintptr)f->farg;
|
||||
n *= 2;
|
||||
s = (char*)f->start;
|
||||
f->start = realloc(s, n);
|
||||
|
|
@ -47,7 +47,7 @@ fmtStrFlush(Fmt *f)
|
|||
free(s);
|
||||
return 0;
|
||||
}
|
||||
f->farg = (void*)n;
|
||||
f->farg = (void*)(uintptr)n;
|
||||
f->to = (char*)f->start + ((char*)f->to - s);
|
||||
f->stop = (char*)f->start + n - 1;
|
||||
return 1;
|
||||
|
|
@ -67,7 +67,7 @@ fmtstrinit(Fmt *f)
|
|||
f->to = f->start;
|
||||
f->stop = (char*)f->start + n - 1;
|
||||
f->flush = fmtStrFlush;
|
||||
f->farg = (void*)n;
|
||||
f->farg = (void*)(uintptr)n;
|
||||
f->nfmt = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue