Coda Distributed File System
vrdb.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 8
5
6 Copyright (c) 1987-2021 Carnegie Mellon University
7 Additional copyrights listed below
8
9This code is distributed "AS IS" without warranty of any kind under
10the terms of the GNU General Public Licence Version 2, as shown in the
11file LICENSE. The technical and financial contributors to Coda are
12listed in the file CREDITS.
13
14 Additional copyrights
15 none currently
16
17#*/
18
19#ifndef _VICE_VRDB_H_
20#define _VICE_VRDB_H_ 1
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#include <stdio.h>
27
28#include <vcrcommon.h>
29#include <vice.h>
30#ifdef __cplusplus
31}
32#endif
33
34#include <ohash.h>
35#include <inconsist.h>
36
37#include <vice_file.h>
38#include <deprecations.h>
39
40#define VRDB_PATH vice_config_path("db/VRDB")
41#define VRDB_TEMP vice_config_path("db/VRDB.new")
42#define VRLIST_PATH vice_config_path("db/VRList")
43
44#define VRTABHASHSIZE 128
45
46class vrtab_iterator;
47class vrent;
48
49class vrtab : public ohashtab {
50 friend void PrintVRDB();
51 char *name;
52 ohashtab namehtb;
53
54public:
55 vrtab(const char *name = "anonymous vrtab");
56 ~vrtab();
57 void add(vrent *);
58 void remove(vrent *);
59 vrent *find(VolumeId);
60 vrent *find(char *);
61 vrent *ReverseFind(VolumeId, int *);
62 void clear();
63 void print();
64 void print(FILE *);
65 void print(int);
66
67 int dump(int);
68};
69
70/* each vrent is in 2 hash tables; lookup by replicated id and by volume name */
71class vrent : public olink {
72public
73 : /* made public (temporarily?) to avoid multiple header include problems */
74 char key[33];
75 VolumeId volnum;
77 /*byte*/ unsigned char nServers;
78 VolumeId ServerVolnum[VSG_MEMBERS];
80
81 vrent();
82 vrent(vrent &);
83 int operator=(vrent &); /* not supported! */
84 ~vrent();
85
86 // public:
87 void GetHosts(unsigned long *) WARN_SINGLE_HOMING;
88 int index_by_hostaddr(unsigned long) WARN_SINGLE_HOMING;
89 int index_by_serverid(uint8_t serverid);
90 int index(void); /* get the replica index for this server */
91 void GetCheckVV(ViceVersionVector *);
92 int GetVolumeInfo(VolumeInfo *);
93 void hton();
94 void ntoh();
95 void print();
96 void print(FILE *);
97 void print(int);
98
99 int dump(int);
100};
101
102extern vrtab VRDB;
103extern void CheckVRDB();
104extern int DumpVRDB(int outfd);
105int XlateVid(VolumeId *, int * = NULL, int * = NULL, int *voltype = NULL);
106extern int ReverseXlateVid(VolumeId *, int * = NULL);
107
108#endif /* _VICE_VRDB_H_ */
Definition: ohash.h:45
Definition: vrdb.h:49
friend void PrintVRDB()
Definition: testvrdb.cc:41
void clear()
Definition: vrdb.cc:138
~vrtab()
Definition: vrdb.cc:71
void remove(vrent *)
Definition: vrdb.cc:83
void print()
Definition: vrdb.cc:153
vrent * find(VolumeId)
Definition: vrdb.cc:91
void add(vrent *)
Definition: vrdb.cc:77
vrent * ReverseFind(VolumeId, int *)
Definition: vrdb.cc:117
int dump(int)
Definition: vrdb.cc:176
vrtab(const char *name="anonymous vrtab")
Definition: vrdb.cc:64
unsigned int uint32_t
Definition: coda.h:105
unsigned char uint8_t
Definition: coda.h:101
bit32 HostAddress[] WARN_SINGLE_HOMING
Definition: printvrdb.cc:48
int dump(int)
Definition: vrdb.cc:424
VolumeId volnum
Definition: printvrdb.cc:52
olink namehtblink
Definition: vrdb.h:76
vrent()
Definition: vrdb.cc:287
~vrent()
Definition: vrdb.cc:309
int GetVolumeInfo(VolumeInfo *)
Definition: vrdb.cc:353
VolumeId ServerVolnum[VSG_MEMBERS]
Definition: printvrdb.cc:54
char key[33]
Definition: printvrdb.cc:51
void ntoh()
Definition: vrdb.cc:395
void GetHosts(unsigned long *) WARN_SINGLE_HOMING
Definition: vrdb.cc:311
void hton()
Definition: vrdb.cc:385
void GetCheckVV(ViceVersionVector *)
Definition: vrdb.cc:342
int index(void)
Definition: vrdb.cc:337
void print()
Definition: vrdb.cc:405
uint32_t unused
Definition: vrdb.h:79
int operator=(vrent &)
Definition: vrdb.cc:303
unsigned char nServers
Definition: printvrdb.cc:53
int index_by_hostaddr(unsigned long) WARN_SINGLE_HOMING
Definition: vrdb.cc:319
int index_by_serverid(uint8_t serverid)
Definition: vrdb.cc:328
#define NULL
Definition: voltypes.h:44
void CheckVRDB()
Definition: vrdb.cc:186
int XlateVid(VolumeId *, int *=NULL, int *=NULL, int *voltype=NULL)
Definition: vrdb.cc:236
int ReverseXlateVid(VolumeId *, int *=NULL)
Definition: vrdb.cc:277
int DumpVRDB(int outfd)
Definition: vrdb.cc:226
vrtab VRDB