]> andersk Git - moira.git/blob - afssync/ubik.c
Case-insensitive stuff.
[moira.git] / afssync / ubik.c
1 /* $Id$ */
2
3 #include <sys/types.h>
4 #include <netinet/in.h>
5
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
13 extern int dbase_fd;
14 struct ubik_dbase *dbase;
15
16 int ubik_ServerInit()
17 {
18     return(0);
19 }
20
21 int ubik_BeginTrans()
22 {
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     }
36     return(0);
37 }
38
39 int ubik_BeginTransReadAny()
40 {
41     return(0);
42 }
43
44 int ubik_AbortTrans()
45 {
46     return(0);
47 }
48
49 int ubik_EndTrans()
50 {
51     return(0);
52 }
53
54 int ubik_Tell()
55 {
56     return(0);
57 }
58
59 int ubik_Truncate()
60 {
61     return(0);
62 }
63
64 long ubik_SetLock()
65 {
66     return(0);
67 }
68
69 int ubik_WaitVersion()
70 {
71     return(0);
72 }
73
74 int ubik_CacheUpdate()
75 {
76     return(0);
77 }
78
79 int panic(a, b, c, d)
80 char *a, *b, *c, *d;
81 {
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
88 int ubik_GetVersion(dummy, ver)
89 int dummy;
90 struct ubik_version *ver;
91 {
92     bzero(ver, sizeof(struct ubik_version));
93     return(0);
94 }
95
96
97 int ubik_Seek(tt, afd, pos)
98 struct ubik_trans *tt;
99 long afd;
100 long pos;
101 {
102     if (lseek(dbase_fd, pos+HDRSIZE, 0) < 0) {
103         perror("ubik_Seek");
104         return(-1);
105     }
106     return(0);
107 }
108
109 int ubik_Write(tt, buf, len)
110 struct ubik_trans *tt;
111 char *buf;
112 long 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
124 int ubik_Read(tt, buf, len)
125 struct ubik_trans *tt;
126 char *buf;
127 long 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
142 /* Global declarations from ubik.c */
143 long ubik_quorum=0;
144 struct ubik_dbase *ubik_dbase=0;
145 struct ubik_stats ubik_stats;
146 long ubik_host;
147 long ubik_epochTime = 0;
148 long urecovery_state = 0;
149
150 struct rx_securityClass *ubik_sc[3];
151
152
153 /* Other declarations */
154
155 afsconf_GetNoAuthFlag()
156 {
157     return(1);
158 }
159
160
161 char *prdir = "/dev/null";
162 struct prheader cheader;
163 int pr_realmNameLen;
164 char *pr_realmName;
This page took 0.050549 seconds and 5 git commands to generate.