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
|
void
|
||||||
usage(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");
|
threadexitsall("usage");
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
|
@ -66,6 +67,9 @@ threadmain(int argc, char *argv[])
|
||||||
case 'L':
|
case 'L':
|
||||||
ventilogging = 1;
|
ventilogging = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'r':
|
||||||
|
readonly = 1;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
nofork = 1;
|
nofork = 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -163,10 +167,10 @@ threadmain(int argc, char *argv[])
|
||||||
startbloomproc(mainindex->bloom);
|
startbloomproc(mainindex->bloom);
|
||||||
|
|
||||||
fprint(2, "sync...");
|
fprint(2, "sync...");
|
||||||
if(syncindex(mainindex, 1, 0, 0) < 0)
|
if(!readonly && syncindex(mainindex, 1, 0, 0) < 0)
|
||||||
sysfatal("can't sync server: %r");
|
sysfatal("can't sync server: %r");
|
||||||
|
|
||||||
if(queuewrites){
|
if(!readonly && queuewrites){
|
||||||
fprint(2, "queue...");
|
fprint(2, "queue...");
|
||||||
if(initlumpqueues(mainindex->nsects) < 0){
|
if(initlumpqueues(mainindex->nsects) < 0){
|
||||||
fprint(2, "can't initialize lump queues,"
|
fprint(2, "can't initialize lump queues,"
|
||||||
|
|
@ -237,6 +241,10 @@ ventiserver(void *v)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VtTwrite:
|
case VtTwrite:
|
||||||
|
if(readonly){
|
||||||
|
vtrerror(r, "read only");
|
||||||
|
break;
|
||||||
|
}
|
||||||
p = r->tx.data;
|
p = r->tx.data;
|
||||||
r->tx.data = nil;
|
r->tx.data = nil;
|
||||||
addstat(StatRpcWriteBytes, packetsize(p));
|
addstat(StatRpcWriteBytes, packetsize(p));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue