diff options
| author | rsc <devnull@localhost> | 2003-11-23 17:54:58 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2003-11-23 17:54:58 +0000 |
| commit | 7a4ee46d253e291044bba2d0c54b818b67ac013c (patch) | |
| tree | 7bdcaf69a15ecd24c057a697936b67bbde93e00b /src/cmd/venti/syncindex.c | |
| parent | 4fbfdd7acd4bf4fc71b1329230e05fc761907566 (diff) | |
| download | plan9port-7a4ee46d253e291044bba2d0c54b818b67ac013c.tar.gz plan9port-7a4ee46d253e291044bba2d0c54b818b67ac013c.zip | |
Initial stab at Venti.
Diffstat (limited to 'src/cmd/venti/syncindex.c')
| -rw-r--r-- | src/cmd/venti/syncindex.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/cmd/venti/syncindex.c b/src/cmd/venti/syncindex.c new file mode 100644 index 00000000..75bb0696 --- /dev/null +++ b/src/cmd/venti/syncindex.c @@ -0,0 +1,56 @@ +#include "stdinc.h" +#include "dat.h" +#include "fns.h" + +static int verbose; +void +usage(void) +{ + fprint(2, "usage: syncindex [-fv] [-B blockcachesize] config\n"); + threadexitsall("usage"); +} + +void +threadmain(int argc, char *argv[]) +{ + u32int bcmem; + int fix; + + fix = 0; + bcmem = 0; + ARGBEGIN{ + case 'B': + bcmem = unittoull(ARGF()); + break; + case 'f': + fix++; + break; + case 'v': + verbose++; + break; + default: + usage(); + break; + }ARGEND + + if(!fix) + readonly = 1; + + if(argc != 1) + usage(); + + if(initventi(argv[0]) < 0) + sysfatal("can't init venti: %r"); + + if(bcmem < maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16)) + bcmem = maxblocksize * (mainindex->narenas + mainindex->nsects * 4 + 16); + fprint(2, "initialize %d bytes of disk block cache\n", bcmem); + initdcache(bcmem); + + if(verbose) + printindex(2, mainindex); + if(syncindex(mainindex, fix) < 0) + sysfatal("failed to sync index=%s: %r\n", mainindex->name); + + threadexitsall(0); +} |
