Coda Distributed File System
vlist.h
Go to the documentation of this file.
1/* BLURB gpl
2
3 Coda File System
4 Release 6
5
6 Copyright (c) 1987-2003 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 * Vlist.h -- Created October 1989
21 * Author Puneet Kumar
22 */
23
24#ifndef _VICE_VLIST_H_
25#define _VICE_VLIST_H_ 1
26
27struct vle;
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
33#include <unistd.h>
34#include <stdlib.h>
35#include <util.h>
36#include <codadir.h>
37#ifdef __cplusplus
38}
39#endif
40#include <srv.h>
41#include <olist.h>
42#include <dlist.h>
43#include <vice.h>
44#include "cvnode.h"
45
46extern int VLECmp(vle *, vle *);
47extern vle *FindVLE(dlist &, ViceFid *);
48extern vle *AddVLE(dlist &, ViceFid *);
49
50#define f_sid u.file.sid
51#define f_sinode u.file.sinode
52#define f_finode u.file.finode
53#define f_tinode u.file.tinode
54#define f_tlength u.file.tlength
55#define d_inodemod u.dir.inodemod
56#define d_cinode u.dir.cinode
57#define d_needsres u.dir.needsres
58#define d_needslogpurge u.dir.purgelog
59#define d_needslogtrunc u.dir.trunclog
60#define d_reintupdate u.dir.rupdate
61#define d_reintstale u.dir.rstale
62
63/* The data structure we want here is a binary search tree, but we use a list instead. -JJK */
64struct vle : public dlink {
65 ViceFid fid;
67 olist sl; /* list of spooled log records - for res logs in vm only */
68 olist rsl; /* list of spooled log records - for res logs in rvm */
69 union {
70 struct {
71 ViceStoreId sid; /* sid of LAST data
72 store (used to avoid multiple bulk transfers) */
73 Inode sinode; /* inode to dec on success */
74 Inode finode; /* inode to dec on failure */
75 Inode tinode; /* inode to trunc on success */
76 unsigned tlength; /* length to trunc t_inode
77 to (on success) */
79 struct {
80 PDirInode cinode; /* cloned inode (in RVM) */
81 int inodemod; /* inode or pages modified */
82 int needsres; /* does directory need to
83 be resolved at end of reintegration? */
84 int purgelog; /* should directory log be purged */
85 int trunclog; /* should log be truncated */
86 unsigned rupdate : 1; /* was directory
87 updated during
88 reintegration */
89 unsigned rstale : 1; /* reintegration: is
90 client's directory version info stale? */
91 } dir;
92 } u;
93
94 vle(ViceFid *Fid)
95 {
96 fid = *Fid;
97 vptr = 0;
98
99 if (!ISDIR(fid)) {
100 f_sid = NullSid;
101 f_sinode = 0;
102 f_finode = 0;
103 f_tinode = 0;
104 f_tlength = 0;
105 } else {
106 d_cinode = 0;
107 d_inodemod = 0;
108 d_needsres = 0;
109 d_needslogpurge = 0;
110 d_needslogtrunc = 0;
111 d_reintupdate = 0;
112 d_reintstale = 0;
113 }
114 };
115
116 ~vle() { CODA_ASSERT(vptr == 0); };
117};
118
119#endif /* _VICE_VLIST_H_ */
Definition: dlist.h:50
Definition: olist.h:47
#define CODA_ASSERT(pred)
Definition: coda_assert.h:22
#define ISDIR(fid)
Definition: codadir.h:113
const ViceStoreId NullSid
Definition: inconsist.cc:46
Definition: codadir.h:173
Definition: cvnode.h:155
Definition: vlist.h:64
Inode finode
Definition: vlist.h:74
unsigned rstale
Definition: vlist.h:89
unsigned tlength
Definition: vlist.h:76
union vle::@34 u
Inode tinode
Definition: vlist.h:75
ViceStoreId sid
Definition: vlist.h:71
vle(ViceFid *Fid)
Definition: vlist.h:94
Inode sinode
Definition: vlist.h:73
olist sl
Definition: vlist.h:67
int purgelog
Definition: vlist.h:84
int needsres
Definition: vlist.h:82
PDirInode cinode
Definition: vlist.h:80
olist rsl
Definition: vlist.h:68
~vle()
Definition: vlist.h:116
int inodemod
Definition: vlist.h:81
struct vle::@34::@35 file
struct vle::@34::@36 dir
Vnode * vptr
Definition: vlist.h:66
int trunclog
Definition: vlist.h:85
unsigned rupdate
Definition: vlist.h:86
ViceFid fid
Definition: vlist.h:65
#define f_finode
Definition: vlist.h:52
int VLECmp(vle *, vle *)
Definition: vlist.cc:34
vle * FindVLE(dlist &, ViceFid *)
Definition: vlist.cc:40
#define d_needslogpurge
Definition: vlist.h:58
#define f_sid
Definition: vlist.h:50
#define f_tlength
Definition: vlist.h:54
#define d_reintstale
Definition: vlist.h:61
vle * AddVLE(dlist &, ViceFid *)
Definition: vlist.cc:50
#define d_cinode
Definition: vlist.h:56
#define d_reintupdate
Definition: vlist.h:60
#define f_sinode
Definition: vlist.h:51
#define d_needslogtrunc
Definition: vlist.h:59
#define d_needsres
Definition: vlist.h:57
#define d_inodemod
Definition: vlist.h:55
#define f_tinode
Definition: vlist.h:53
bit32 Inode
Definition: voltypes.h:61