]> andersk Git - moira.git/blame - afssync/ubik.c
line buffer output; don't do it all in one transaction; trap
[moira.git] / afssync / ubik.c
CommitLineData
1c2c987d 1/* $Id$ */
e1f001e5 2
3#include <sys/types.h>
1c2c987d 4#include <netinet/in.h>
5
e1f001e5 6#include <lock.h>
7#define UBIK_INTERNALS
8#include <ubik.h>
9#include <rx/xdr.h>
10#include "print.h"
11#include "prserver.h"
12
1c2c987d 13extern int dbase_fd;
e1f001e5 14struct ubik_dbase *dbase;
15
dba0cf81 16int ubik_ServerInit()
17{
18 return(0);
19}
20
21int ubik_BeginTrans()
22{
1c2c987d 23 static int init=0;
24 struct ubik_hdr thdr;
25
26 if (!init) {
27 thdr.version.epoch = htonl(0);
28 thdr.version.counter = htonl(0);
29 thdr.magic = htonl(UBIK_MAGIC);
30 thdr.size = htonl(HDRSIZE);
31 lseek(dbase_fd, 0, 0);
32 write(dbase_fd, &thdr, sizeof(thdr));
33 fsync(dbase_fd);
34 init = 1;
35 }
dba0cf81 36 return(0);
37}
38
39int ubik_BeginTransReadAny()
40{
41 return(0);
42}
43
44int ubik_AbortTrans()
45{
46 return(0);
47}
48
49int ubik_EndTrans()
50{
51 return(0);
52}
53
54int ubik_Tell()
55{
56 return(0);
57}
58
59int ubik_Truncate()
e1f001e5 60{
61 return(0);
62}
63
64long ubik_SetLock()
65{
66 return(0);
67}
68
dba0cf81 69int ubik_WaitVersion()
e1f001e5 70{
71 return(0);
72}
73
dba0cf81 74int ubik_CacheUpdate()
e1f001e5 75{
e1f001e5 76 return(0);
77}
78
dba0cf81 79int panic(a, b, c, d)
80char *a, *b, *c, *d;
e1f001e5 81{
dba0cf81 82 printf(a, b, c, d);
83 abort();
84 printf("BACK FROM ABORT\n"); /* shouldn't come back from floating pt exception */
85 exit(1); /* never know, though */
86}
87
88int ubik_GetVersion(dummy, ver)
89int dummy;
90struct ubik_version *ver;
91{
92 bzero(ver, sizeof(struct ubik_version));
e1f001e5 93 return(0);
94}
95
96
dba0cf81 97int ubik_Seek(tt, afd, pos)
e1f001e5 98struct ubik_trans *tt;
99long afd;
100long pos;
101{
102 if (lseek(dbase_fd, pos+HDRSIZE, 0) < 0) {
103 perror("ubik_Seek");
104 return(-1);
105 }
106 return(0);
107}
108
dba0cf81 109int ubik_Write(tt, buf, len)
e1f001e5 110struct ubik_trans *tt;
111char *buf;
112long len;
113{
114 int status;
115
116 status = write(dbase_fd, buf, len);
117 if (status < len) {
118 perror("ubik_Write");
119 return(1);
120 }
121 return(0);
122}
123
dba0cf81 124int ubik_Read(tt, buf, len)
e1f001e5 125struct ubik_trans *tt;
126char *buf;
127long len;
128{
129 int status;
130
131 status = read(dbase_fd, buf, len);
132 if (status < 0) {
133 perror("ubik_Read");
134 return(1);
135 }
136 if (status < len)
137 bzero(&buf[status], len - status);
138 return(0);
139}
140
141
dba0cf81 142/* Global declarations from ubik.c */
143long ubik_quorum=0;
144struct ubik_dbase *ubik_dbase=0;
145struct ubik_stats ubik_stats;
146long ubik_host;
147long ubik_epochTime = 0;
148long urecovery_state = 0;
149
150struct rx_securityClass *ubik_sc[3];
151
152
153/* Other declarations */
e1f001e5 154
155afsconf_GetNoAuthFlag()
156{
157 return(1);
158}
159
160
dba0cf81 161char *prdir = "/dev/null";
e1f001e5 162struct prheader cheader;
dba0cf81 163int pr_realmNameLen;
164char *pr_realmName;
This page took 0.089869 seconds and 5 git commands to generate.