mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-27 11:52:03 +00:00
add -r for readonly
This commit is contained in:
parent
786ce2cf5c
commit
0e26338762
1 changed files with 11 additions and 3 deletions
|
@ -18,7 +18,8 @@ static void ventiserver(void*);
|
|||
void
|
||||
usage(void)
|
||||
{
|
||||
fprint(2, "usage: venti [-dsw] [-a ventiaddress] [-h httpaddress] [-c config] [-C cachesize] [-I icachesize] [-B blockcachesize]\n");
|
||||
fprint(2, "usage: venti [-Ldrs] [-a ventiaddr] [-c config] "
|
||||
"[-h httpaddr] [-B blockcachesize] [-C cachesize] [-I icachesize] [-W webroot]\n");
|
||||
threadexitsall("usage");
|
||||
}
|
||||
void
|
||||
|
@ -66,6 +67,9 @@ threadmain(int argc, char *argv[])
|
|||
case 'L':
|
||||
ventilogging = 1;
|
||||
break;
|
||||
case 'r':
|
||||
readonly = 1;
|
||||
break;
|
||||
case 's':
|
||||
nofork = 1;
|
||||
break;
|
||||
|
@ -163,10 +167,10 @@ threadmain(int argc, char *argv[])
|
|||
startbloomproc(mainindex->bloom);
|
||||
|
||||
fprint(2, "sync...");
|
||||
if(syncindex(mainindex, 1, 0, 0) < 0)
|
||||
if(!readonly && syncindex(mainindex, 1, 0, 0) < 0)
|
||||
sysfatal("can't sync server: %r");
|
||||
|
||||
if(queuewrites){
|
||||
if(!readonly && queuewrites){
|
||||
fprint(2, "queue...");
|
||||
if(initlumpqueues(mainindex->nsects) < 0){
|
||||
fprint(2, "can't initialize lump queues,"
|
||||
|
@ -237,6 +241,10 @@ ventiserver(void *v)
|
|||
}
|
||||
break;
|
||||
case VtTwrite:
|
||||
if(readonly){
|
||||
vtrerror(r, "read only");
|
||||
break;
|
||||
}
|
||||
p = r->tx.data;
|
||||
r->tx.data = nil;
|
||||
addstat(StatRpcWriteBytes, packetsize(p));
|
||||
|
|
Loading…
Reference in a new issue