Coda Distributed File System
inconsist.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2016 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/*
20 *
21 * Headers for inconsistency handling in CODA.
22 *
23 */
24
25#ifndef _INCONSIST_H_
26#define _INCONSIST_H_
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#include <stdio.h>
33#include <vice.h>
34#include <vcrcommon.h>
35
36/* The possible results of a two-way version vector compare. */
37typedef enum
38{
39 VV_EQ = 0,
40 VV_DOM = 1,
41 VV_SUB = 2,
42 VV_INC = 3
44
45#define VV_INCON 0x01 /* mask for inconsistency flag */
46#define VV_LOCAL 0x02 /* mask for local flag */
47#define VV_BARREN \
48 0x04 /* mask for barren flag - small vnode without a valid inode */
49#define VV_COP2PENDING 0x08 /* mask for cop2 pending flag */
50
51#define IsIncon(vv) ((vv).Flags & VV_INCON)
52#define SetIncon(vv) ((vv).Flags |= VV_INCON)
53#define ClearIncon(vv) ((vv).Flags &= ~VV_INCON)
54#define IsLocal(vv) ((vv).Flags & VV_LOCAL)
55#define SetLocal(vv) ((vv).Flags |= VV_LOCAL)
56#define ClearLocal(vv) ((vv).Flags &= ~VV_LOCAL)
57#define IsBarren(vv) ((vv).Flags & VV_BARREN)
58#define SetBarren(vv) ((vv).Flags |= VV_BARREN)
59#define ClearBarren(vv) ((vv).Flags &= ~VV_BARREN)
60#define COP2Pending(vv) ((vv).Flags & VV_COP2PENDING)
61#define SetCOP2Pending(vv) ((vv).Flags |= VV_COP2PENDING)
62#define ClearCOP2Pending(vv) ((vv).Flags &= ~VV_COP2PENDING)
63
64#define SID_EQ(a, b) \
65 ((a).HostId == (b).HostId && (a).Uniquifier == (b).Uniquifier)
66
67extern const ViceStoreId NullSid;
68
69VV_Cmp_Result VV_Cmp(const ViceVersionVector *, const ViceVersionVector *);
70VV_Cmp_Result VV_Cmp_IgnoreInc(const ViceVersionVector *,
71 const ViceVersionVector *);
72int VV_Check(int *, ViceVersionVector **, int);
73int VV_Check_IgnoreInc(int *, ViceVersionVector **, int);
74int IsRunt(ViceVersionVector *);
75
76void AddVVs(ViceVersionVector *, ViceVersionVector *);
77void SubVVs(ViceVersionVector *, ViceVersionVector *);
78void InitVV(ViceVersionVector *);
79void InvalidateVV(ViceVersionVector *);
80void GetMaxVV(ViceVersionVector *, ViceVersionVector **, int);
81
82void SPrintVV(char *buf, size_t len, ViceVersionVector *);
83void FPrintVV(FILE *, ViceVersionVector *);
84
85#ifdef __cplusplus
86}
87#endif
88
89#endif /* _INCONSIST_H_ */
VV_Cmp_Result VV_Cmp(const ViceVersionVector *, const ViceVersionVector *)
Definition: inconsist.cc:80
VV_Cmp_Result VV_Cmp_IgnoreInc(const ViceVersionVector *, const ViceVersionVector *)
Definition: inconsist.cc:51
void AddVVs(ViceVersionVector *, ViceVersionVector *)
Definition: inconsist.cc:255
VV_Cmp_Result
Definition: inconsist.h:38
@ VV_INC
Definition: inconsist.h:42
@ VV_SUB
Definition: inconsist.h:41
@ VV_DOM
Definition: inconsist.h:40
@ VV_EQ
Definition: inconsist.h:39
void FPrintVV(FILE *, ViceVersionVector *)
Definition: inconsist.cc:351
int IsRunt(ViceVersionVector *)
Definition: inconsist.cc:278
void InitVV(ViceVersionVector *)
Definition: inconsist.cc:269
void SubVVs(ViceVersionVector *, ViceVersionVector *)
Definition: inconsist.cc:262
void SPrintVV(char *buf, size_t len, ViceVersionVector *)
Definition: inconsist.cc:336
const ViceStoreId NullSid
Definition: inconsist.cc:46
int VV_Check_IgnoreInc(int *, ViceVersionVector **, int)
Definition: inconsist.cc:92
int VV_Check(int *, ViceVersionVector **, int)
Definition: inconsist.cc:87
void GetMaxVV(ViceVersionVector *, ViceVersionVector **, int)
Definition: inconsist.cc:302
void InvalidateVV(ViceVersionVector *)
Definition: inconsist.cc:290