X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/dba0cf81984c56e6f2b1486f247952a0358bb0b5..refs/heads/LOCKING:/afssync/ubik.c diff --git a/afssync/ubik.c b/afssync/ubik.c index 149a9bbe..f00891c4 100644 --- a/afssync/ubik.c +++ b/afssync/ubik.c @@ -1,6 +1,8 @@ -/* $Header$ */ +/* $Id$ */ #include +#include + #include #define UBIK_INTERNALS #include @@ -8,7 +10,7 @@ #include "print.h" #include "prserver.h" - +extern int dbase_fd; struct ubik_dbase *dbase; int ubik_ServerInit() @@ -18,6 +20,19 @@ int ubik_ServerInit() int ubik_BeginTrans() { + static int init=0; + struct ubik_hdr thdr; + + if (!init) { + thdr.version.epoch = htonl(0); + thdr.version.counter = htonl(0); + thdr.magic = htonl(UBIK_MAGIC); + thdr.size = htonl(HDRSIZE); + lseek(dbase_fd, 0, 0); + write(dbase_fd, &thdr, sizeof(thdr)); + fsync(dbase_fd); + init = 1; + } return(0); } @@ -79,8 +94,6 @@ struct ubik_version *ver; } -extern int dbase_fd; - int ubik_Seek(tt, afd, pos) struct ubik_trans *tt; long afd;