tfossil: required p9p changes - 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 b32de4ae73509092107b116fefbc4003fefc35c3
 (DIR) parent 4b5766580559d101dd1c29cc575b3ffa9f51c2d7
 (HTM) Author: David du Colombier <0intro@gmail.com>
       Date:   Thu, 26 Sep 2013 20:12:45 +0200
       
       fossil: required p9p changes
       
       R=rsc
       https://codereview.appspot.com/13352057
       
       Diffstat:
         M src/cmd/fossil/9p.c                 |      13 +++++++++++++
         M src/cmd/fossil/9proc.c              |       3 ++-
         M src/cmd/fossil/9srv.c               |      12 ++++++++++++
         M src/cmd/fossil/9user.c              |       4 ++++
         M src/cmd/fossil/Ccmd.c               |      42 +++++++++++++++++++++----------
         M src/cmd/fossil/Ccons.c              |      12 +++++++++++-
         M src/cmd/fossil/check.c              |      20 ++++++++++++++++----
         M src/cmd/fossil/dat.h                |       2 +-
         M src/cmd/fossil/disk.c               |       2 ++
         M src/cmd/fossil/flchk.c              |      15 +++++++++++----
         M src/cmd/fossil/fossil.c             |       4 ++++
         M src/cmd/fossil/mkfile               |      24 +++++++++++++++---------
         M src/cmd/fossil/nobwatch.c           |       3 ++-
         M src/cmd/fossil/stdinc.h             |       7 +++----
         M src/cmd/fossil/view.c               |      60 ++++++++++++++++---------------
       
       15 files changed, 156 insertions(+), 67 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/fossil/9p.c b/src/cmd/fossil/9p.c
       t@@ -935,6 +935,7 @@ parseAname(char *aname, char **fsname, char **path)
                        *path = "";
        }
        
       +#ifndef PLAN9PORT
        /*
         * Check remote IP address against /mnt/ipok.
         * Sources.cs.bell-labs.com uses this to disallow
       t@@ -972,6 +973,7 @@ conIPCheck(Con* con)
                }
                return 1;
        }
       +#endif
        
        static int
        rTattach(Msg* m)
       t@@ -996,12 +998,14 @@ rTattach(Msg* m)
                else
                        fid->uname = vtstrdup(unamenone);
        
       +#ifndef PLAN9PORT
                if((fid->con->flags&ConIPCheck) && !conIPCheck(fid->con)){
                        consPrint("reject %s from %s: %r\n", fid->uname, fid->con->remote);
                        fidClunk(fid);
                        vtfree(fsname);
                        return 0;
                }
       +#endif
                if(fsysNoAuthCheck(fsys) || (m->con->flags&ConNoAuthCheck)){
                        if((fid->uid = uidByUname(fid->uname)) == nil)
                                fid->uid = vtstrdup(unamenone);
       t@@ -1032,7 +1036,9 @@ rTattach(Msg* m)
        static int
        rTauth(Msg* m)
        {
       +#ifndef PLAN9PORT
                int afd;
       +#endif
                Con *con;
                Fid *afid;
                Fsys *fsys;
       t@@ -1064,13 +1070,20 @@ rTauth(Msg* m)
                }
                afid->fsys = fsys;
        
       +#ifndef PLAN9PORT
                if((afd = open("/mnt/factotum/rpc", ORDWR)) < 0){
                        werrstr("can't open \"/mnt/factotum/rpc\"");
                        fidClunk(afid);
                        return 0;
                }
       +#endif
       +
       +#ifdef PLAN9PORT
       +        if((afid->rpc = auth_allocrpc()) == nil){
       +#else
                if((afid->rpc = auth_allocrpc(afd)) == nil){
                        close(afd);
       +#endif
                        werrstr("can't auth_allocrpc");
                        fidClunk(afid);
                        return 0;
 (DIR) diff --git a/src/cmd/fossil/9proc.c b/src/cmd/fossil/9proc.c
       t@@ -250,12 +250,13 @@ msgFlush(Msg* m)
        }
        
        static void
       -msgProc(void*)
       +msgProc(void* v)
        {
                Msg *m;
                char e[ERRMAX];
                Con *con;
        
       +        USED(v);
                threadsetname("msgProc");
        
                for(;;){
 (DIR) diff --git a/src/cmd/fossil/9srv.c b/src/cmd/fossil/9srv.c
       t@@ -20,6 +20,7 @@ static struct {
                Srv*        tail;
        } sbox;
        
       +#ifndef PLAN9PORT
        static int
        srvFd(char* name, int mode, int fd, char** mntpnt)
        {
       t@@ -54,6 +55,7 @@ srvFd(char* name, int mode, int fd, char** mntpnt)
        
                return srvfd;
        }
       +#endif
        
        static void
        srvFree(Srv* srv)
       t@@ -100,7 +102,12 @@ srvAlloc(char* service, int mode, int fd)
                        break;
                }
        
       +#ifdef PLAN9PORT
       +        mntpnt = nil;
       +        if((srvfd = post9pservice(fd, service, mntpnt)) < 0){
       +#else
                if((srvfd = srvFd(service, mode, fd, &mntpnt)) < 0){
       +#endif
                        wunlock(&sbox.lock);
                        return nil;
                }
       t@@ -203,6 +210,11 @@ cmdSrv(int argc, char* argv[])
                        return 1;
                }
        
       +#ifdef PLAN9PORT        /* fossilcons unsupported */
       +        if(pflag)
       +                return 1;
       +#endif
       +
                if(pipe(fd) < 0){
                        werrstr("srv pipe: %r");
                        return 0;
 (DIR) diff --git a/src/cmd/fossil/9user.c b/src/cmd/fossil/9user.c
       t@@ -338,7 +338,11 @@ int
        validUserName(char* name)
        {
                Rune *r;
       +#ifdef PLAN9PORT
       +        static Rune invalid[] = {'#', ':', ',', '(', ')', '\0'};
       +#else
                static Rune invalid[] = L"#:,()";
       +#endif
        
                for(r = invalid; *r != '\0'; r++){
                        if(utfrune(name, *r))
 (DIR) diff --git a/src/cmd/fossil/Ccmd.c b/src/cmd/fossil/Ccmd.c
       t@@ -27,19 +27,22 @@ cmd9pStrtoull(char* s)
        }
        
        static int
       -cmd9pTag(Fcall*, int, char **argv)
       +cmd9pTag(Fcall* f, int i, char **argv)
        {
       +        USED(f);
       +        USED(i);
                cbox.tag = strtoul(argv[0], 0, 0)-1;
        
                return 1;
        }
        
        static int
       -cmd9pTwstat(Fcall* f, int, char **argv)
       +cmd9pTwstat(Fcall* f, int i, char **argv)
        {
                Dir d;
                static uchar buf[DIRMAX];
        
       +        USED(i);
                memset(&d, 0, sizeof d);
                nulldir(&d);
                d.name = argv[1];
       t@@ -61,32 +64,36 @@ cmd9pTwstat(Fcall* f, int, char **argv)
        }
        
        static int
       -cmd9pTstat(Fcall* f, int, char** argv)
       +cmd9pTstat(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
        
                return 1;
        }
        
        static int
       -cmd9pTremove(Fcall* f, int, char** argv)
       +cmd9pTremove(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
        
                return 1;
        }
        
        static int
       -cmd9pTclunk(Fcall* f, int, char** argv)
       +cmd9pTclunk(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
        
                return 1;
        }
        
        static int
       -cmd9pTwrite(Fcall* f, int, char** argv)
       +cmd9pTwrite(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
                f->offset = strtoll(argv[1], 0, 0);
                f->data = argv[2];
       t@@ -96,8 +103,9 @@ cmd9pTwrite(Fcall* f, int, char** argv)
        }
        
        static int
       -cmd9pTread(Fcall* f, int, char** argv)
       +cmd9pTread(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
                f->offset = strtoll(argv[1], 0, 0);
                f->count = strtol(argv[2], 0, 0);
       t@@ -106,8 +114,9 @@ cmd9pTread(Fcall* f, int, char** argv)
        }
        
        static int
       -cmd9pTcreate(Fcall* f, int, char** argv)
       +cmd9pTcreate(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
                f->name = argv[1];
                f->perm = strtol(argv[2], 0, 8);
       t@@ -117,8 +126,9 @@ cmd9pTcreate(Fcall* f, int, char** argv)
        }
        
        static int
       -cmd9pTopen(Fcall* f, int, char** argv)
       +cmd9pTopen(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
                f->mode = strtol(argv[1], 0, 0);
        
       t@@ -148,16 +158,18 @@ cmd9pTwalk(Fcall* f, int argc, char** argv)
        }
        
        static int
       -cmd9pTflush(Fcall* f, int, char** argv)
       +cmd9pTflush(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->oldtag = strtol(argv[0], 0, 0);
        
                return 1;
        }
        
        static int
       -cmd9pTattach(Fcall* f, int, char** argv)
       +cmd9pTattach(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->fid = strtol(argv[0], 0, 0);
                f->afid = strtol(argv[1], 0, 0);
                f->uname = argv[2];
       t@@ -167,8 +179,9 @@ cmd9pTattach(Fcall* f, int, char** argv)
        }
        
        static int
       -cmd9pTauth(Fcall* f, int, char** argv)
       +cmd9pTauth(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->afid = strtol(argv[0], 0, 0);
                f->uname = argv[1];
                f->aname = argv[2];
       t@@ -177,8 +190,9 @@ cmd9pTauth(Fcall* f, int, char** argv)
        }
        
        static int
       -cmd9pTversion(Fcall* f, int, char** argv)
       +cmd9pTversion(Fcall* f, int i, char** argv)
        {
       +        USED(i);
                f->msize = strtoul(argv[0], 0, 0);
                if(f->msize > cbox.con->msize){
                        werrstr("msize too big");
       t@@ -420,6 +434,7 @@ cmdBind(int argc, char* argv[])
                if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
                        return cliError(usage);
        
       +#ifndef PLAN9PORT
                if(bind(argv[0], argv[1], flag) < 0){
                        /* try to give a less confusing error than the default */
                        if(access(argv[0], 0) < 0)
       t@@ -429,6 +444,7 @@ cmdBind(int argc, char* argv[])
                        else
                                return cliError("bind %s %s: %r", argv[0], argv[1]);
                }
       +#endif
                return 1;
        }
        
 (DIR) diff --git a/src/cmd/fossil/Ccons.c b/src/cmd/fossil/Ccons.c
       t@@ -221,8 +221,9 @@ qAlloc(void)
        }
        
        static void
       -consProc(void*)
       +consProc(void* v)
        {
       +        USED(v);
                Q *q;
                int argc, i, n, r;
                char *argv[20], buf[Nq], *lp, *wbuf;
       t@@ -345,13 +346,21 @@ consTTY(void)
        
                name = "/dev/cons";
                if((fd = open(name, ORDWR)) < 0){
       +#ifdef PLAN9PORT
       +                name = "/dev/tty";
       +#else
                        name = "#c/cons";
       +#endif
                        if((fd = open(name, ORDWR)) < 0){
                                werrstr("consTTY: open %s: %r", name);
                                return 0;
                        }
                }
        
       +#ifdef PLAN9PORT
       +        USED(p);
       +        ctl = 0;
       +#else
                p = smprint("%sctl", name);
                if((ctl = open(p, OWRITE)) < 0){
                        close(fd);
       t@@ -367,6 +376,7 @@ consTTY(void)
                        return 0;
                }
                free(p);
       +#endif
        
                if(consOpen(fd, fd, ctl) == 0){
                        close(ctl);
 (DIR) diff --git a/src/cmd/fossil/check.c b/src/cmd/fossil/check.c
       t@@ -778,22 +778,34 @@ warn(Fsck *chk, char *fmt, ...)
        }
        
        static void
       -clrenop(Fsck*, Block*, int)
       +clrenop(Fsck *chk, Block *b, int i)
        {
       +        USED(chk);
       +        USED(b);
       +        USED(i);
        }
        
        static void
       -closenop(Fsck*, Block*, u32int)
       +closenop(Fsck *chk, Block *b, u32int i)
        {
       +        USED(chk);
       +        USED(b);
       +        USED(i);
        }
        
        static void
       -clrinop(Fsck*, char*, MetaBlock*, int, Block*)
       +clrinop(Fsck *chk, char *c, MetaBlock *mb, int i, Block *b)
        {
       +        USED(chk);
       +        USED(c);
       +        USED(mb);
       +        USED(i);
       +        USED(b);
        }
        
        static int
       -printnop(char*, ...)
       +printnop(char *c, ...)
        {
       +        USED(c);
                return 0;
        }
 (DIR) diff --git a/src/cmd/fossil/dat.h b/src/cmd/fossil/dat.h
       t@@ -328,4 +328,4 @@ enum {
                PartVenti,        /* fake partition */
        };
        
       -extern vtType[BtMax];
       +extern int vtType[BtMax];
 (DIR) diff --git a/src/cmd/fossil/disk.c b/src/cmd/fossil/disk.c
       t@@ -288,8 +288,10 @@ disk2file(Disk *disk)
        {
                static char buf[256];
        
       +#ifndef PLAN9PORT
                if (fd2path(disk->fd, buf, sizeof buf) < 0)
                        strncpy(buf, "GOK", sizeof buf);
       +#endif
                return buf;
        }
        
 (DIR) diff --git a/src/cmd/fossil/flchk.c b/src/cmd/fossil/flchk.c
       t@@ -28,26 +28,33 @@ flprint(char *fmt, ...)
        }
        
        static void
       -flclre(Fsck*, Block *b, int o)
       +flclre(Fsck *chk, Block *b, int o)
        {
       +        USED(chk);
                Bprint(&bout, "# clre 0x%ux %d\n", b->addr, o);
        }
        
        static void
       -flclrp(Fsck*, Block *b, int o)
       +flclrp(Fsck *chk, Block *b, int o)
        {
       +        USED(chk);
                Bprint(&bout, "# clrp 0x%ux %d\n", b->addr, o);
        }
        
        static void
       -flclri(Fsck*, char *name, MetaBlock*, int, Block*)
       +flclri(Fsck *chk, char *name, MetaBlock *mb, int i, Block *b)
        {
       +        USED(chk);
       +        USED(mb);
       +        USED(i);
       +        USED(b);
                Bprint(&bout, "# clri %s\n", name);
        }
        
        static void
       -flclose(Fsck*, Block *b, u32int epoch)
       +flclose(Fsck *chk, Block *b, u32int epoch)
        {
       +        USED(chk);
                Bprint(&bout, "# bclose 0x%ux %ud\n", b->addr, epoch);
        }
        
 (DIR) diff --git a/src/cmd/fossil/fossil.c b/src/cmd/fossil/fossil.c
       t@@ -73,7 +73,11 @@ threadmain(int argc, char* argv[])
                /*
                 * Insulate from the invoker's environment.
                 */
       +#ifdef PLAN9PORT
       +        if(rfork(RFNAMEG) < 0)
       +#else
                if(rfork(RFREND|RFNOTEG|RFNAMEG) < 0)
       +#endif
                        sysfatal("rfork: %r");
        
                close(0);
 (DIR) diff --git a/src/cmd/fossil/mkfile b/src/cmd/fossil/mkfile
       t@@ -1,5 +1,6 @@
       -</$objtype/mkfile
       -BIN=/$objtype/bin/fossil
       +<$PLAN9/src/mkhdr
       +MKSHELL=$PLAN9/bin/rc
       +BIN=$BIN/fossil
        
        TARG=fossil flchk flfmt conf last view
        
       t@@ -34,10 +35,10 @@ LIBFILES=\
        
        LIBCFILES=${LIBFILES:%=%.c}
        LIBOFILES=${LIBFILES:%=%.$O}
       -LIB=libfs.a$O
       +LIB=libfs.a
        
        HFILES=\
       -        /sys/include/venti.h\
       +        $PLAN9/include/venti.h\
                stdinc.h\
                vac.h\
                dat.h\
       t@@ -98,12 +99,12 @@ test:V: all
        #        unmount /n/fossil
        #        rm /srv/fossil
        
       -</sys/src/cmd/mkmany
       +<$PLAN9/src/mkmany
        
        $LIB(%.$O):N: %.$O
        $LIB:        ${LIBOFILES:%=$LIB(%)}
       -        names = `{echo $newprereq |sed 's/ /\n/g' |sed -n 's/'$LIB'\(([^)]+)\)/\1/gp'}
       -        ar vu $LIB $names
       +        names = `{echo $newprereq |sed 's/ /\n/g' |9 sed -n 's/'$LIB'\(([^)]+)\)/\1/gp'}
       +        $AR rsc $LIB $names
        #        rm $names
        
        $O.flfmt: flfmt9660.$O
       t@@ -128,9 +129,14 @@ bundle:V:
        
        $O.conf:D: conf.rc
                {
       -                echo '#!/bin/rc'
       +                echo '#!/usr/local/plan9/bin/rc'
                        echo '# THIS FILE IS AUTOMATICALLY GENERATED'
       -                echo '# FROM /sys/src/cmd/fossil/conf.rc.  DO NOT EDIT.'
       +                echo '# FROM /usr/local/plan9/src/cmd/fossil/conf.rc.  DO NOT EDIT.'
                        echo 
                        sed 1d conf.rc
                } >$target && chmod +x $target
       +
       +clean:
       +        rm -f $LIB
       +
       +nuke: clean
 (DIR) diff --git a/src/cmd/fossil/nobwatch.c b/src/cmd/fossil/nobwatch.c
       t@@ -15,8 +15,9 @@ bwatchInit(void)
        }
        
        void
       -bwatchSetBlockSize(uint)
       +bwatchSetBlockSize(uint i)
        {
       +        USED(i);
        }
        
        void
 (DIR) diff --git a/src/cmd/fossil/stdinc.h b/src/cmd/fossil/stdinc.h
       t@@ -2,10 +2,9 @@
        #include <libc.h>
        #include <libsec.h>
        #include <thread.h>
       -
       -typedef uvlong        u64int;
       -typedef        uchar        u8int;
       -typedef ushort        u16int;
       +#ifdef PLAN9PORT
       +#include <9pclient.h>
       +#endif
        
        #include "venti.h"
        #include "vac.h"
 (DIR) diff --git a/src/cmd/fossil/view.c b/src/cmd/fossil/view.c
       t@@ -463,7 +463,7 @@ initxlabel(Label l)
        typedef struct Xblock Xblock;
        struct Xblock
        {
       -        Tnode;
       +        Tnode *t;
                Block *b;
                int (*gen)(void*, Block*, int, Tnode**);
                void *arg;
       t@@ -478,57 +478,58 @@ xblockexpand(Tnode *tt)
                Xblock *t = (Xblock*)tt;
                Tnode *nn;
        
       -        if(t->nkid >= 0)
       +        if(t->t->nkid >= 0)
                        return;
        
                j = 0;
                if(t->printlabel){
       -                t->kid = mallocz(Q*sizeof(t->kid[0]), 1);
       -                t->kid[0] = initxlabel(t->b->l);
       +                t->t->kid = mallocz(Q*sizeof(t->t->kid[0]), 1);
       +                t->t->kid[0] = initxlabel(t->b->l);
                        j = 1;
                }
        
                for(i=0;; i++){
                        switch((*t->gen)(t->arg, t->b, i, &nn)){
                        case -1:
       -                        t->nkid = j;
       +                        t->t->nkid = j;
                                return;
                        case 0:
                                break;
                        case 1:
                                if(j%Q == 0)
       -                                t->kid = realloc(t->kid, (j+Q)*sizeof(t->kid[0]));
       -                        t->kid[j++] = nn;
       +                                t->t->kid = realloc(t->t->kid, (j+Q)*sizeof(t->t->kid[0]));
       +                        t->t->kid[j++] = nn;
                                break;
                        }
                }
        }
        
        int
       -nilgen(void*, Block*, int, Tnode**)
       +nilgen(void *v, Block *b, int o, Tnode **tp)
        {
                return -1;
        }
        
        Tnode*
       -initxblock(Block *b, char *s, int (*gen)(void*, Block*, int, Tnode**), void *arg)
       +initxblock(Block *b, char *s, int (*gen)(void *v, Block *b, int o, Tnode **tp), void *arg)
        {
                Xblock *t;
        
                if(gen == nil)
                        gen = nilgen;
                t = mallocz(sizeof(Xblock), 1);
       +        t->t = mallocz(sizeof(Tnode), 1);
                t->b = b;
                t->gen = gen;
                t->arg = arg;
                if(b->addr == NilBlock)
       -                t->str = smprint("Block %V: %s", b->score, s);
       +                t->t->str = smprint("Block %V: %s", b->score, s);
                else
       -                t->str = smprint("Block %#ux: %s", b->addr, s);
       +                t->t->str = smprint("Block %#ux: %s", b->addr, s);
                t->printlabel = 1;
       -        t->nkid = -1;
       -        t->expand = xblockexpand;
       -        return t;
       +        t->t->nkid = -1;
       +        t->t->expand = xblockexpand;
       +        return t->t;
        }
        
        int
       t@@ -557,7 +558,7 @@ initxentryblock(Block *b, Entry *ed)
        typedef struct Xentry Xentry;
        struct Xentry 
        {
       -        Tnode;
       +        Tnode *t;
                Entry e;
        };
        
       t@@ -566,12 +567,12 @@ xentryexpand(Tnode *tt)
        {
                Xentry *t = (Xentry*)tt;
        
       -        if(t->nkid >= 0)
       +        if(t->t->nkid >= 0)
                        return;
        
       -        t->nkid = 1;
       -        t->kid = mallocz(sizeof(t->kid[0])*t->nkid, 1);
       -        t->kid[0] = initxsource(t->e, 1);
       +        t->t->nkid = 1;
       +        t->t->kid = mallocz(sizeof(t->t->kid[0])*t->t->nkid, 1);
       +        t->t->kid[0] = initxsource(t->e, 1);
        }
        
        Tnode*
       t@@ -580,14 +581,15 @@ initxentry(Entry e)
                Xentry *t;
        
                t = mallocz(sizeof *t, 1);
       -        t->nkid = -1;
       -        t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V",
       +        t->t = mallocz(sizeof(Tnode), 1);
       +        t->t->nkid = -1;
       +        t->t->str = smprint("Entry gen=%#ux psize=%d dsize=%d depth=%d flags=%#ux size=%lld score=%V",
                        e.gen, e.psize, e.dsize, e.depth, e.flags, e.size, e.score);
                if(e.flags & VtEntryLocal)
       -                t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->str, e.archive, e.snap, e.tag);
       -        t->expand = xentryexpand;
       +                t->t->str = smprint("%s archive=%d snap=%d tag=%#ux", t->t->str, e.archive, e.snap, e.tag);
       +        t->t->expand = xentryexpand;
                t->e = e;
       -        return t;        
       +        return t->t;        
        }
        
        int
       t@@ -659,7 +661,7 @@ initxsource(Entry e, int dowrap)
        }
        
        int
       -xlocalrootgen(void*, Block *b, int o, Tnode **tp)
       +xlocalrootgen(void *v, Block *b, int o, Tnode **tp)
        {
                Entry e;
        
       t@@ -684,7 +686,7 @@ initxlocalroot(char *name, u32int addr)
        }
        
        int
       -xvacrootgen(void*, Block *b, int o, Tnode **tp)
       +xvacrootgen(void *v, Block *b, int o, Tnode **tp)
        {
                Entry e;
        
       t@@ -734,7 +736,7 @@ initxdirentry(MetaEntry *me)
        }
        
        int
       -metaentrygen(void *v, Block*, int o, Tnode **tp)
       +metaentrygen(void *v, Block *b, int o, Tnode **tp)
        {
                Tnode *t;
                MetaBlock *mb;
       t@@ -765,11 +767,11 @@ metablockgen(void *v, Block *b, int o, Tnode **tp)
                /* hack: reuse initxblock as a generic iterator */
                mb = v;
                t = (Xblock*)initxblock(b, "", metaentrygen, mb);
       -        t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s",
       +        t->t->str = smprint("MetaBlock %d/%d space used, %d add'l free %d/%d table used%s",
                        mb->size, mb->maxsize, mb->free, mb->nindex, mb->maxindex,
                        mb->botch ? " [BOTCH]" : "");
                t->printlabel = 0;
       -        *tp = t;
       +        *tp = t->t;
                return 1;
        }