tadd -r for readonly - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0e263387626a2f16fcfa4d24dd72e2b5a9f01ad9
 (DIR) parent 786ce2cf5c62149e7abfd28c37d27d0df7f8aeac
 (HTM) Author: rsc <devnull@localhost>
       Date:   Thu,  3 May 2007 03:14:43 +0000
       
       add -r for readonly
       
       Diffstat:
         M src/cmd/venti/srv/venti.c           |      14 +++++++++++---
       
       1 file changed, 11 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/venti/srv/venti.c b/src/cmd/venti/srv/venti.c
       t@@ -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
       t@@ -66,6 +67,9 @@ threadmain(int argc, char *argv[])
                case 'L':
                        ventilogging = 1;
                        break;
       +        case 'r':
       +                readonly = 1;
       +                break;
                case 's':
                        nofork = 1;
                        break;
       t@@ -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,"
       t@@ -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));