Coda Distributed File System
repcmds.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#ifndef _REPCMDS_H_
20#define _REPCMDS_H_
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#ifdef HAVE_CONFIG_H
27#include <config.h>
28#endif
29
30#include <ctype.h>
31#include <errno.h>
32#include <inodeops.h>
33#include <netinet/in.h>
34#include <parser.h>
35#include <rpc2/rpc2.h>
36#include <setjmp.h>
37#include <signal.h>
38#include <stdio.h>
39#include <stdlib.h>
40#include <sys/file.h>
41#include <sys/param.h>
42#include <sys/socket.h>
43#include <sys/stat.h>
44#include <sys/types.h>
45#include <unistd.h>
46#include <netdb.h>
47
48#include <auth2.h>
49#include <avenus.h>
50#include "coda_assert.h"
51#include "coda_string.h"
52#include <vice.h>
53
54#include <copyfile.h>
55
56#ifdef __cplusplus
57}
58#endif
59
60#include <inconsist.h>
61#include <repio.h>
62#include <resolve.h>
63#include <venusioctl.h>
64
65#define MAXVOLNAME 32
66#define MAXHOSTS 8 /* XXXX --- get the true definition for this */
67#define HOSTNAMLEN 64 /* XXXX -- get the true definition for this */
68/* MAXPATHLEN defined in <sys/param.h>, length in bytes of OUT path parameters */
69#define DEF_BUF 2048 /* XXXX -- temporary buffer size */
70
71#define LOCAL_GLOBAL 1
72#define SERVER_SERVER 2
73#define MIXED_CONFLICT 3
74
75/* Replicated filesystem object under repair */
76struct conflict {
77 ViceFid fid;
78 ViceVersionVector VV;
79 struct replica *head; /* Singly-linked list of volume replicas */
80 char rodir[MAXPATHLEN]; /* directory where replicas are mounted */
82 char local; /* a flag indicating whether this is a local volume entry
83 * 0: server/server conflict
84 * 1: local/global conflict
85 * 2: mixed lg/ss XXX This comment is all wrong*/
86 char dirconf; /* a flag indicating whether this is a directory conflict
87 * -- if true it's a directory conflict, else a file conflict */
88};
89
90/* Element in singly-linked list of volume replicas of a replicated volume */
91struct replica {
92 ViceFid fid; /* fid of this replica*/
93 ViceVersionVector VV;
94 char realmname[HOSTNAMLEN]; /* realm name of this object */
96 [HOSTNAMLEN]; /* XXX: name of server on which this replica is located? */
97 char compname[NAME_MAX]; /* component name corresponding to this rw id */
98 struct replica *next; /* next replica ptr */
99};
100
101/* Non-interactive repair calls */
102int BeginRepair(char *pathname, struct conflict **conf, char *msg, int msgsize);
103int ClearInc(struct conflict *conf, char *msg, int msgsize);
104int CompareDirs(struct conflict *conf, const char *fixfile, struct repinfo *inf,
105 char *msg, int msgsize);
106int DoRepair(struct conflict *conf, char *ufixpath, FILE *res, char *msg,
107 int msgsize);
108int EndRepair(struct conflict *conf, int commit, char *msg, int msgsize);
109int RemoveInc(struct conflict *conf, char *msg, int msgsize);
110
111/* Other utility functions */
112int dorep(struct conflict *conf, char *fixpath, char *buf, int len);
113int makedff(char *extfile, char *intfile, char *msg, int msgsize);
114
115/* Volume data structure manipulation routines -- rvol.cc */
116int repair_newrep(char *reppath, struct conflict **conf, char *msg,
117 int msgsize);
118int repair_mountrw(struct conflict *conf, char *msg, int msgsize);
119void repair_finish(struct conflict *conf);
120
121/* Path processing routines -- path.cc */
122int repair_getfid(char *path, ViceFid *outfid, char *outrealm,
123 ViceVersionVector *outvv, char *msg, int msgsize);
124int repair_inconflict(char *name, ViceFid *conflictfid, char *conflictrealm);
125int repair_isleftmost(char *path, char *realpath, int len, char *msg,
126 int msgsize);
127
128#define freeif(pointer) \
129 do { \
130 if (pointer != NULL) { \
131 free(pointer); \
132 pointer = NULL; \
133 } \
134 } while (0)
135
136#define strerr(str, len, msg...) \
137 do { \
138 if (str != NULL) \
139 snprintf(str, len, ##msg); \
140 } while (0)
141
142#endif /* _REPCMDS_H_ */
#define MAXPATHLEN
name
Definition: pwdtopdbtool.py:40
void path(char *pathname, char *direc, char *file)
Definition: path.c:53
int CompareDirs(struct conflict *conf, const char *fixfile, struct repinfo *inf, char *msg, int msgsize)
Definition: repcmds.cc:203
int repair_inconflict(char *name, ViceFid *conflictfid, char *conflictrealm)
Definition: path.cc:217
int RemoveInc(struct conflict *conf, char *msg, int msgsize)
Definition: repcmds.cc:462
int dorep(struct conflict *conf, char *fixpath, char *buf, int len)
Definition: repcmds.cc:722
int BeginRepair(char *pathname, struct conflict **conf, char *msg, int msgsize)
Definition: repcmds.cc:39
int repair_newrep(char *reppath, struct conflict **conf, char *msg, int msgsize)
Definition: rvol.cc:37
#define HOSTNAMLEN
Definition: repcmds.h:67
int repair_isleftmost(char *path, char *realpath, int len, char *msg, int msgsize)
Definition: path.cc:40
void repair_finish(struct conflict *conf)
Definition: rvol.cc:140
int repair_getfid(char *path, ViceFid *outfid, char *outrealm, ViceVersionVector *outvv, char *msg, int msgsize)
Definition: path.cc:252
int EndRepair(struct conflict *conf, int commit, char *msg, int msgsize)
Definition: repcmds.cc:421
int repair_mountrw(struct conflict *conf, char *msg, int msgsize)
Definition: rvol.cc:68
int makedff(char *extfile, char *intfile, char *msg, int msgsize)
Definition: repcmds.cc:861
int ClearInc(struct conflict *conf, char *msg, int msgsize)
Definition: repcmds.cc:123
int DoRepair(struct conflict *conf, char *ufixpath, FILE *res, char *msg, int msgsize)
Definition: repcmds.cc:352
Definition: repcmds.h:76
char realm[HOSTNAMLEN]
Definition: repcmds.h:81
struct replica * head
Definition: repcmds.h:79
char local
Definition: repcmds.h:82
ViceFid fid
Definition: repcmds.h:77
char rodir[MAXPATHLEN]
Definition: repcmds.h:80
ViceVersionVector VV
Definition: repcmds.h:78
char dirconf
Definition: repcmds.h:86
Definition: resolve.h:54
Definition: repcmds.h:91
char realmname[HOSTNAMLEN]
Definition: repcmds.h:94
ViceFid fid
Definition: repcmds.h:92
ViceVersionVector VV
Definition: repcmds.h:93
struct replica * next
Definition: repcmds.h:98
char compname[NAME_MAX]
Definition: repcmds.h:97
char srvname[HOSTNAMLEN]
Definition: repcmds.h:96