summaryrefslogtreecommitdiffstats
path: root/src/cmd/venti/srv/xml.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-07-12 15:23:36 +0000
committerrsc <devnull@localhost>2005-07-12 15:23:36 +0000
commita0d146edd7a7de6236a0d60baafeeb59f8452aae (patch)
treeb55baa526d9f5adfc73246e6ee2fadf455e0b7a2 /src/cmd/venti/srv/xml.c
parent88bb285e3d87ec2508840af33f7e0af53ec3c13c (diff)
downloadplan9port-a0d146edd7a7de6236a0d60baafeeb59f8452aae.tar.gz
plan9port-a0d146edd7a7de6236a0d60baafeeb59f8452aae.zip
return of venti
Diffstat (limited to 'src/cmd/venti/srv/xml.c')
-rw-r--r--src/cmd/venti/srv/xml.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/cmd/venti/srv/xml.c b/src/cmd/venti/srv/xml.c
new file mode 100644
index 00000000..e91afa05
--- /dev/null
+++ b/src/cmd/venti/srv/xml.c
@@ -0,0 +1,68 @@
+#include "stdinc.h"
+#include "dat.h"
+#include "fns.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->memstats.sealed, "sealed");
+ xmlscore(hout, s->score, "score");
+ xmlu32int(hout, s->memstats.clumps, "clumps");
+ xmlu32int(hout, s->memstats.cclumps, "compressedclumps");
+ xmlu64int(hout, s->memstats.uncsize, "data");
+ xmlu64int(hout, s->memstats.used - s->memstats.clumps * ClumpSize, "compresseddata");
+ xmlu64int(hout, s->memstats.used + s->memstats.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, "<sects>\n");
+ for(i = 0; i < s->nsects; i++)
+ xmlamap(hout, &s->smap[i], "sect", indent + 2);
+ xmlindent(hout, indent + 1);
+ hprint(hout, "</sects>\n");
+ xmlindent(hout, indent + 1);
+ hprint(hout, "<amaps>\n");
+ for(i = 0; i < s->narenas; i++)
+ xmlamap(hout, &s->amap[i], "amap", indent + 2);
+ xmlindent(hout, indent + 1);
+ hprint(hout, "</amaps>\n");
+ xmlindent(hout, indent + 1);
+ hprint(hout, "<arenas>\n");
+ for(i = 0; i < s->narenas; i++)
+ xmlarena(hout, s->arenas[i], "arena", indent + 2);
+ xmlindent(hout, indent + 1);
+ hprint(hout, "</arenas>\n");
+ xmlindent(hout, indent);
+ hprint(hout, "</%s>\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");
+}
+