Coda Distributed File System
repio.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/* Created:
20 M. Satyanarayanan
21 June 1989
22
23*/
24
25/* Directory repair data structures and routines
26
27 A directory repair involves a list of individual repair operations.
28 This list is constructed on the client and executed on the server.
29 (In automated resolution, gets constructed on server)
30 The repair is executed within a transaction at the server.
31 struct repair defines one step in the repair.
32 It should really be a union type but this is painful in C.
33*/
34
35#define REPAIR_MAX 5 /* Max no of integer parms for a repair entry */
36#ifndef MAXNAMELEN
37/* Max len of pathname component, should this be defined somewhere
38 * in /usr/include/sys? */
39#define MAXNAMELEN 255
40#endif
41
42/* Realm of localcache objects should be 0xffffffff */
43#ifndef IS_LOCAL
44#define IS_LOCAL(realm) (realm == 0xffffffff)
45//#define IS_LOCAL(realm) (!strcmp("localhost", realm))
46#endif
47
48struct repair {
49 unsigned opcode; /* values defined below */
50 char name[MAXNAMELEN]; /* overloaded; null-terminated */
51 char newname[MAXNAMELEN]; /* used only by rename */
52 unsigned parms[REPAIR_MAX]; /* overloaded */
53};
54
55/* Repair opcodes */
56
57#define REPAIR_OPBASE 174320 /* random */
58
59/* Creation:
60 repair.name specifies object name
61 repair.parms[0..2] specify FID to be associated with this name
62*/
63#define REPAIR_CREATEF REPAIR_OPBASE + 1 /* Create file */
64#define REPAIR_CREATED REPAIR_OPBASE + 2 /* Create directory */
65#define REPAIR_CREATES REPAIR_OPBASE + 3 /* Create sym link */
66#define REPAIR_CREATEL REPAIR_OPBASE + 4 /* Create (hard) link */
67
68/* Remove opcodes:
69 repair.name specifies object name
70 repair.parms ignored
71*/
72#define REPAIR_REMOVEFSL REPAIR_OPBASE + 5 /* Remove file or (hard) link */
73#define REPAIR_REMOVED REPAIR_OPBASE + 6 /* Remove dir */
74
75/* ACL mods:
76 repair.name gives name of user in acl
77 repair.parms[0] specifies rights
78*/
79/* REPAIR_DELACL is removed; repair.parms[0] = 0 means delete entry */
80#define REPAIR_SETACL REPAIR_OPBASE + 7 /* Set rights */
81#define REPAIR_SETNACL REPAIR_OPBASE + 8 /* Set negative rights */
82
83/* Status mods:
84 repair.name is ignored
85 repair.parms[0] gives new value
86*/
87#define REPAIR_SETMODE REPAIR_OPBASE + 9
88#define REPAIR_SETOWNER \
89 REPAIR_OPBASE + 10 /* Have to be a sys administrator for this */
90#define REPAIR_SETMTIME REPAIR_OPBASE + 11
91
92/* Next replica:
93 repair.name is the name of the server
94 repair.parms[0] is a hex number, giving read-write volid of this replica
95
96 Seen only in ASCII input files typed by users
97*/
98#define REPAIR_REPLICA REPAIR_OPBASE + 12
99
100#define REPAIR_RENAME REPAIR_OPBASE + 13 /* mv object */
101
102/* The structure below is the header for the repairs to be made to one replica.
103 An array of such structures can describe the repairs to all replicas.
104 The number of replicas cannot be static, since disconnected operation can
105 produce one conflicting replica per client.
106*/
107
108struct listhdr {
109 ViceFid replicaFid; /* unique fid of this replica */
110 unsigned int repairCount; /* number of entries in array repairList[] */
111 struct repair
112 *repairList; /* pointer to array of repair entries for this replica */
113};
114
115/* I/O routines */
116int repair_putdfile(char *fname, int replicaCount, struct listhdr *replicaList);
117int repair_getdfile(char *fname, int *replicaCount,
118 struct listhdr **replicaList);
119int repair_getdfile(int infd, int *replicaCount, struct listhdr **replicaList);
120int repair_parseline(char *line, struct repair *rs);
121int repair_parsefile(char *fname, int *hdcount, struct listhdr **hdarray);
122void repair_printline(struct repair *rs, FILE *ff);
123void repair_printfile(char *fname);
#define REPAIR_MAX
Definition: repio.h:35
void repair_printline(struct repair *rs, FILE *ff)
Definition: repio.cc:664
#define MAXNAMELEN
Definition: repio.h:39
int repair_parsefile(char *fname, int *hdcount, struct listhdr **hdarray)
Definition: repio.cc:513
int repair_putdfile(char *fname, int replicaCount, struct listhdr *replicaList)
Definition: repio.cc:103
int repair_getdfile(char *fname, int *replicaCount, struct listhdr **replicaList)
Definition: repio.cc:304
void repair_printfile(char *fname)
Definition: repio.cc:728
int repair_parseline(char *line, struct repair *rs)
Definition: repio.cc:314
Definition: repio.h:108
struct repair * repairList
Definition: repio.h:111
unsigned int repairCount
Definition: repio.h:110
ViceFid replicaFid
Definition: repio.h:109
Definition: repio.h:48
char name[MAXNAMELEN]
Definition: repio.h:50
unsigned opcode
Definition: repio.h:49
unsigned parms[REPAIR_MAX]
Definition: repio.h:52
char newname[MAXNAMELEN]
Definition: repio.h:51