-/* $Header$ */
+/* $Id$ */
#include <sys/types.h>
+#include <netinet/in.h>
+
#include <lock.h>
#define UBIK_INTERNALS
-#include <ubik.h>
+#include <stds.h>
#include <rx/xdr.h>
#include "print.h"
#include "prserver.h"
+/* Stolen bits of ubik.h. */
+
+struct ubik_version {
+ afs_int32 epoch;
+ afs_int32 counter;
+};
+typedef struct ubik_version ubik_version;
+
+/* ubik header file structure */
+struct ubik_hdr {
+ afs_int32 magic; /* magic number */
+ short pad1; /* some 0-initd padding */
+ short size; /* header allocation size */
+ struct ubik_version version; /* the version for this file */
+};
+#define HDRSIZE 64 /* bytes of header per dbfile */
+#define UBIK_MAGIC 0x354545
+
+extern int dbase_fd;
struct ubik_dbase *dbase;
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);
}
int dummy;
struct ubik_version *ver;
{
- bzero(ver, sizeof(struct ubik_version));
+ memset(ver, 0, sizeof(struct ubik_version));
return(0);
}
-extern int dbase_fd;
-
int ubik_Seek(tt, afd, pos)
struct ubik_trans *tt;
long afd;
return(1);
}
if (status < len)
- bzero(&buf[status], len - status);
+ memset(&buf[status], 0, len - status);
return(0);
}
-
-/* Global declarations from ubik.c */
-long ubik_quorum=0;
-struct ubik_dbase *ubik_dbase=0;
-struct ubik_stats ubik_stats;
-long ubik_host;
-long ubik_epochTime = 0;
-long urecovery_state = 0;
-
struct rx_securityClass *ubik_sc[3];
-
/* Other declarations */
afsconf_GetNoAuthFlag()