Coda Distributed File System
vsg.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#ifndef _VSG_H_
19#define _VSG_H_
20
21#ifdef __cplusplus
22extern "C" {
23#endif /* __cplusplus */
24
25#include <stdio.h>
26
27#ifdef __cplusplus
28}
29#endif /* __cplusplus */
30
31#include <dllist.h>
32#include <vcrcommon.h>
33#include "refcounted.h"
34
35class vsgdb;
36class mgrpent;
37
38class vsgent : private RefCountedObject {
39 friend class vsgdb;
40 friend class mgrpent;
41 friend void Mgrp_Wait();
42
43private:
44 unsigned int nhosts; /* number of replica servers in this VSG */
45 unsigned int max_vsg; /* highest used index in the hosts array */
46 struct in_addr hosts[VSG_MEMBERS]; /* hosts in this VSG */
47 struct dllist_head mgrpents; /* list of mgroups for this VSG */
48 RealmId realmid;
49
50protected:
51 struct dllist_head vsgs; /* list of all vsgents */
52
53 vsgent(struct in_addr Hosts[VSG_MEMBERS], RealmId realmid);
54 ~vsgent(void);
55
56 int CmpHosts(struct in_addr Hosts[VSG_MEMBERS])
57 {
58 return (memcmp(hosts, Hosts, VSG_MEMBERS * sizeof(struct in_addr)) ==
59 0);
60 }
61
62public:
63#ifdef VENUSDEBUG
64 static unsigned int allocs;
65 static unsigned int deallocs;
66#endif
67 void Put(void) { PutRef(); }
68
69 int GetMgrp(mgrpent **m, uid_t uid, int auth = 1) EXCLUDES_TRANSACTION;
70 void KillMgrps(void);
71 void KillUserMgrps(uid_t uid);
72 void KillMgrpMember(struct in_addr *);
73
74 unsigned int NHosts(void) { return nhosts; }
75 unsigned int MaxVSG(void) { return max_vsg; }
76 void GetHosts(struct in_addr Hosts[VSG_MEMBERS])
77 {
78 memcpy(Hosts, hosts, VSG_MEMBERS * sizeof(struct in_addr));
79 }
80
81 void print(FILE *f);
82};
83
84class vsgdb {
85private:
86 struct dllist_head vsgents; /* list of VSGs */
87
88public:
89 vsgdb(void);
90 ~vsgdb(void);
91
92 vsgent *GetVSG(struct in_addr hosts[VSG_MEMBERS], RealmId realm);
93 void KillUserMgrps(uid_t uid);
94
95 void print(FILE *f);
96 void print() { print(stdout); }
97};
98
99extern vsgdb *VSGDB;
100
101void VSGDBInit(void);
102
103#endif /* _VSG_H_ */
Definition: refcounted.h:38
void PutRef(void)
Definition: refcounted.h:55
Definition: mgrp.h:75
Definition: vsg.h:84
~vsgdb(void)
Definition: vsg.cc:230
vsgdb(void)
Definition: vsg.cc:225
void KillUserMgrps(uid_t uid)
Definition: vsg.cc:262
void print()
Definition: vsg.h:96
vsgent * GetVSG(struct in_addr hosts[VSG_MEMBERS], RealmId realm)
Definition: vsg.cc:235
Definition: vsg.h:38
int GetMgrp(mgrpent **m, uid_t uid, int auth=1) EXCLUDES_TRANSACTION
Definition: vsg.cc:77
struct dllist_head vsgs
Definition: vsg.h:51
unsigned int NHosts(void)
Definition: vsg.h:74
void print(FILE *f)
Definition: vsg.cc:207
~vsgent(void)
Definition: vsg.cc:60
vsgent(struct in_addr Hosts[VSG_MEMBERS], RealmId realmid)
Definition: vsg.cc:32
void KillMgrps(void)
Definition: vsg.cc:167
void Put(void)
Definition: vsg.h:67
int CmpHosts(struct in_addr Hosts[VSG_MEMBERS])
Definition: vsg.h:56
void KillMgrpMember(struct in_addr *)
Definition: vsg.cc:195
friend void Mgrp_Wait()
Definition: mgrp.cc:45
void GetHosts(struct in_addr Hosts[VSG_MEMBERS])
Definition: vsg.h:76
void KillUserMgrps(uid_t uid)
Definition: vsg.cc:177
unsigned int MaxVSG(void)
Definition: vsg.h:75
#define EXCLUDES_TRANSACTION
Definition: coda_tsa.h:108
uid
Definition: pwdtopdbtool.py:40
stdout
Definition: volusage.py:12
@ f
Definition: rvm_private.h:416
Definition: dllist.h:30
void VSGDBInit(void)
Definition: vsg.cc:282
vsgdb * VSGDB
Definition: vsg.cc:25