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