Coda Distributed File System
mgrp.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 _MGRP_H_
19#define _MGRP_H_
20
21#include <rpc2/rpc2.h>
22#include <dllist.h>
23#include <inconsist.h>
24#include <vcrcommon.h>
25#include "refcounted.h"
26
28void Mgrp_Signal(void);
29
30class mgrpent;
31class fsobj;
32class repvol;
33class volent;
34class vsgent;
35class ClientModifyLog;
36class cmlent;
37
39 friend class mgrpent;
40 friend class fsobj;
41 friend class repvol;
42 friend class reintvol;
43 friend class volent;
44 friend class vsgent;
45 friend class ClientModifyLog;
46 friend class cmlent;
47
48 RPC2_Integer HowMany;
49 RPC2_Handle handles[VSG_MEMBERS];
50 struct in_addr hosts[VSG_MEMBERS];
51 RPC2_Integer retcodes[VSG_MEMBERS];
52 struct in_addr primaryhost;
53 RPC2_Multicast *MIp;
54 unsigned dying[VSG_MEMBERS];
55
56public:
58 RepOpCommCtxt(RepOpCommCtxt &) { abort(); } /* not supported! */
60 {
61 abort();
62 return (0);
63 } /* not supported! */
65
66 int AnyReturned(int code);
67
68 void print(FILE *f)
69 {
70 fprintf(f, "%p : HowMany = %d\n", this, (int)HowMany);
71 }
72 void print() { print(stdout); }
73};
74
75class mgrpent : private RefCountedObject {
76 friend void MallocPrint(int fd);
77 friend void CommInit();
78 friend void Mgrp_Wait();
79 friend void Mgrp_Signal();
80 friend class mgrp_iterator;
81 friend class fsobj;
82 friend class repvol;
83 friend class reintvol;
84 friend class volent;
85 friend class vsgent;
86 friend class ClientModifyLog;
87 friend class cmlent;
88
89 /* mgrp synchronization. */
90 static char mgrp_sync;
91
92 /* Static state; immutable after construction. */
93 vsgent *vsg;
94 struct dllist_head vsghandle;
95 uid_t uid; /* UID to validate with respect to. */
96 RPC2_Multicast McastInfo;
97 unsigned authenticated : 1;
98 unsigned disconnectfs : 1;
99
100 /* Dynamic state; varies with each call. */
101 RepOpCommCtxt rocc;
102
103#ifdef VENUSDEBUG
104 static int allocs;
105 static int deallocs;
106#endif /* VENUSDEBUG */
107
108 /* Constructors, destructors, and private utility routines. */
109 mgrpent(vsgent *, uid_t, RPC2_Handle, int);
110 ~mgrpent();
111
112public:
113 void Put(void);
114 void Kill(int tellservers);
115
116 /* the list_empty test protects us during initialization/destruction */
117 int InUse(void) { return (refcount > 1 || list_empty(&vsghandle)); }
118 int IsAuthenticated(void) { return authenticated; }
119
121 void KillMember(struct in_addr *, int);
123 void PutHostSet();
124
125 void CheckResult();
126 int CheckNonMutating(int);
127 int CheckCOP1(int, ViceVersionVector *, int = 1);
128 int CheckReintegrate(int, ViceVersionVector *);
129 int RVVCheck(ViceVersionVector **, int);
130 int DHCheck(ViceVersionVector **, int, int *, int = 0);
131 int PickDH(ViceVersionVector **RVVs);
132 struct in_addr *GetPrimaryHost(int *ph_ixp = NULL);
133
134 void print(FILE *f)
135 {
136 fprintf(f,
137 "%p : uid = %d, mid = %d, auth = %d, ref = %d, detached = %d\n",
138 this, uid, (int)McastInfo.Mgroup, authenticated, refcount,
139 list_empty(&vsghandle));
140 }
141};
142
143#endif /* _MGRP_H_ */
Definition: venusvol.h:145
Definition: refcounted.h:38
unsigned int refcount
Definition: refcounted.h:40
Definition: mgrp.h:38
int AnyReturned(int code)
Definition: mgrp.cc:149
RepOpCommCtxt(RepOpCommCtxt &)
Definition: mgrp.h:58
~RepOpCommCtxt()
Definition: mgrp.h:64
int operator=(RepOpCommCtxt &)
Definition: mgrp.h:59
RepOpCommCtxt()
Definition: mgrp.cc:134
void print(FILE *f)
Definition: mgrp.h:68
void print()
Definition: mgrp.h:72
Definition: venusvol.h:260
Definition: fso.h:343
Definition: mgrp.h:75
int DHCheck(ViceVersionVector **, int, int *, int=0)
Definition: mgrp.cc:700
int CheckReintegrate(int, ViceVersionVector *)
Definition: mgrp.cc:623
friend void CommInit()
Definition: comm.cc:109
int CheckNonMutating(int)
Definition: mgrp.cc:462
void print(FILE *f)
Definition: mgrp.h:134
int IsAuthenticated(void)
Definition: mgrp.h:118
int CheckCOP1(int, ViceVersionVector *, int=1)
Definition: mgrp.cc:542
friend void MallocPrint(int fd)
Definition: venusutil.cc:788
friend class mgrp_iterator
Definition: mgrp.h:80
void Put(void)
Definition: mgrp.cc:225
struct in_addr * GetPrimaryHost(int *ph_ixp=NULL)
Definition: mgrp.cc:723
void Kill(int tellservers)
Definition: mgrp.cc:244
int InUse(void)
Definition: mgrp.h:117
void CheckResult()
Definition: mgrp.cc:403
int PickDH(ViceVersionVector **RVVs)
Definition: mgrp.cc:671
int RVVCheck(ViceVersionVector **, int)
Definition: mgrp.cc:642
void PutHostSet()
Definition: mgrp.cc:392
friend void Mgrp_Wait()
Definition: mgrp.cc:45
int GetHostSet() EXCLUDES_TRANSACTION
Definition: mgrp.cc:347
friend void Mgrp_Signal()
Definition: mgrp.cc:56
int CreateMember(int idx) EXCLUDES_TRANSACTION
Definition: mgrp.cc:259
void KillMember(struct in_addr *, int)
Definition: mgrp.cc:301
Definition: venusvol.h:739
Definition: venusvol.h:931
Definition: venusvol.h:620
Definition: vsg.h:38
#define EXCLUDES_TRANSACTION
Definition: coda_tsa.h:108
#define list_empty(head)
Definition: dllist.h:54
void Mgrp_Signal(void)
Definition: mgrp.cc:56
void Mgrp_Wait(void) EXCLUDES_TRANSACTION
Definition: mgrp.cc:45
uid
Definition: pwdtopdbtool.py:40
stdout
Definition: volusage.py:12
int32_t RPC2_Integer
Definition: rpc2.h:297
RPC2_Integer RPC2_Handle
Definition: rpc2.h:345
@ f
Definition: rvm_private.h:416
fprintf(outFile, "Tag: SMARTFTP\n")
Definition: rpc2.h:601
RPC2_Handle Mgroup
Definition: rpc2.h:602
Definition: dllist.h:30
#define NULL
Definition: voltypes.h:44