From 7a4ee46d253e291044bba2d0c54b818b67ac013c Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 23 Nov 2003 17:54:58 +0000 Subject: Initial stab at Venti. --- src/cmd/venti/xml.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 src/cmd/venti/xml.c (limited to 'src/cmd/venti/xml.c') diff --git a/src/cmd/venti/xml.c b/src/cmd/venti/xml.c new file mode 100644 index 00000000..d50d5bc9 --- /dev/null +++ b/src/cmd/venti/xml.c @@ -0,0 +1,69 @@ +#include "stdinc.h" +#include "dat.h" +#include "fns.h" +#include "httpd.h" +#include "xml.h" + +void xmlarena(Hio *hout, Arena *s, char *tag, int indent){ + xmlindent(hout, indent); + hprint(hout, "<%s", tag); + xmlaname(hout, s->name, "name"); + xmlu32int(hout, s->version, "version"); + xmlaname(hout, s->part->name, "partition"); + xmlu32int(hout, s->blocksize, "blocksize"); + xmlu64int(hout, s->base, "start"); + xmlu64int(hout, s->base+2*s->blocksize, "stop"); + xmlu32int(hout, s->ctime, "created"); + xmlu32int(hout, s->wtime, "modified"); + xmlsealed(hout, s->sealed, "sealed"); + xmlscore(hout, s->score, "score"); + xmlu32int(hout, s->clumps, "clumps"); + xmlu32int(hout, s->cclumps, "compressedclumps"); + xmlu64int(hout, s->uncsize, "data"); + xmlu64int(hout, s->used - s->clumps * ClumpSize, "compresseddata"); + xmlu64int(hout, s->used + s->clumps * ClumpInfoSize, "storage"); + hprint(hout, "/>\n"); +} + +void xmlindex(Hio *hout, Index *s, char *tag, int indent){ + int i; + xmlindent(hout, indent); + hprint(hout, "<%s", tag); + xmlaname(hout, s->name, "name"); + xmlu32int(hout, s->version, "version"); + xmlu32int(hout, s->blocksize, "blocksize"); + xmlu32int(hout, s->tabsize, "tabsize"); + xmlu32int(hout, s->buckets, "buckets"); + xmlu32int(hout, s->div, "buckdiv"); + hprint(hout, ">\n"); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + for(i = 0; i < s->nsects; i++) + xmlamap(hout, &s->smap[i], "sect", indent + 2); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + for(i = 0; i < s->narenas; i++) + xmlamap(hout, &s->amap[i], "amap", indent + 2); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + for(i = 0; i < s->narenas; i++) + xmlarena(hout, s->arenas[i], "arena", indent + 2); + xmlindent(hout, indent + 1); + hprint(hout, "\n"); + xmlindent(hout, indent); + hprint(hout, "\n", tag); +} + +void xmlamap(Hio *hout, AMap *s, char *tag, int indent){ + xmlindent(hout, indent); + hprint(hout, "<%s", tag); + xmlaname(hout, s->name, "name"); + xmlu64int(hout, s->start, "start"); + xmlu64int(hout, s->stop, "stop"); + hprint(hout, "/>\n"); +} + -- cgit v1.2.3