1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1994-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CFSD_LOGELEM_H
#define _CFSD_LOGELEM_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Include file for the logelem class.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* typedefs for logelem type */
#define NO_OBJECT_TYPE 0
#define SETATTR_OBJECT_TYPE 1
#define SETSECATTR_OBJECT_TYPE 2
#define CREATE_OBJECT_TYPE 3
#define REMOVE_OBJECT_TYPE 4
#define RMDIR_OBJECT_TYPE 5
#define MKDIR_OBJECT_TYPE 6
#define LINK_OBJECT_TYPE 7
#define SYMLINK_OBJECT_TYPE 8
#define RENAME_OBJECT_TYPE 9
#define MODIFIED_OBJECT_TYPE 10
#define MAPFID_OBJECT_TYPE 11
#define CFSDMesgMax 4096
/* BEGIN CSTYLED */
/* defines for refrencing objects */
#define SETATTR_OBJECT(ptr) ptr->i_operation.i_setattr_object
#define SETATTR_OBJECT_PTR(ptr) &(ptr->i_operation.i_setattr_object)
#define SETSECATTR_OBJECT(ptr) ptr->i_operation.i_setsecattr_object
#define SETSECATTR_OBJECT_PTR(ptr) &(ptr->i_operation.i_setsecattr_object)
#define CREATE_OBJECT(ptr) ptr->i_operation.i_create_object
#define CREATE_OBJECT_PTR(ptr) &(ptr->i_operation.i_create_object)
#define REMOVE_OBJECT(ptr) ptr->i_operation.i_remove_object
#define REMOVE_OBJECT_PTR(ptr) &(ptr->i_operation.i_remove_object)
#define RMDIR_OBJECT(ptr) ptr->i_operation.i_rmdir_object
#define RMDIR_OBJECT_PTR(ptr) &(ptr->i_operation.i_rmdir_object)
#define MKDIR_OBJECT(ptr) ptr->i_operation.i_mkdir_object
#define MKDIR_OBJECT_PTR(ptr) &(ptr->i_operation.i_mkdir_object)
#define LINK_OBJECT(ptr) ptr->i_operation.i_link_object
#define LINK_OBJECT_PTR(ptr) &(ptr->i_operation.i_link_object)
#define SYMLINK_OBJECT(ptr) ptr->i_operation.i_symlink_object
#define SYMLINK_OBJECT_PTR(ptr) &(ptr->i_operation.i_symlink_object)
#define RENAME_OBJECT(ptr) ptr->i_operation.i_rename_object
#define RENAME_OBJECT_PTR(ptr) &(ptr->i_operation.i_rename_object)
#define MODIFIED_OBJECT(ptr) ptr->i_operation.i_modified_object
#define MODIFIED_OBJECT_PTR(ptr) &(ptr->i_operation.i_modified_object)
#define MAPFID_OBJECT(ptr) ptr->i_operation.i_mapfid_object
#define MAPFID_OBJECT_PTR(ptr) &(ptr->i_operation.i_mapfid_object)
/* END CSTYLED */
/* setattr */
typedef struct cfsd_logelem_setattr_object {
struct cfs_dlog_setattr *i_up;
} cfsd_logelem_setattr_object_t;
/* setsecattr */
typedef struct cfsd_logelem_setsecattr_oject {
struct cfs_dlog_setsecattr *i_up;
const aclent_t *i_acl;
} cfsd_logelem_setsecattr_object_t;
/* create */
typedef struct cfsd_logelem_create_object {
struct cfs_dlog_create *i_up;
const char *i_namep; /* name of file to create */
} cfsd_logelem_create_object_t;
/* remove */
typedef struct cfsd_logelem_remove_object {
struct cfs_dlog_remove *i_up;
const char *i_namep; /* name of file to remove */
} cfsd_logelem_remove_object_t;
/* rmdir */
typedef struct cfsd_logelem_rmdir_object {
struct cfs_dlog_rmdir *i_up;
const char *i_namep; /* name of dir to rmdir */
} cfsd_logelem_rmdir_object_t;
/* mkdir */
typedef struct cfsd_logelem_mkdir_object {
struct cfs_dlog_mkdir *i_up;
const char *i_namep; /* name of dir to mkdir */
} cfsd_logelem_mkdir_object_t;
/* link */
typedef struct cfsd_logelem_link_object {
struct cfs_dlog_link *i_up;
const char *i_namep; /* name of link */
} cfsd_logelem_link_object_t;
/* symlink */
typedef struct cfsd_logelem_symlink_object {
struct cfs_dlog_symlink *i_up;
const char *i_namep; /* name of symlink */
const char *i_contentsp; /* contents of symlink */
} cfsd_logelem_symlink_object_t;
/* rename */
typedef struct cfsd_logelem_rename_object {
struct cfs_dlog_rename *i_up;
const char *i_orignamep; /* original name */
const char *i_newnamep; /* new name */
} cfsd_logelem_rename_object_t;
/* modify */
typedef struct cfsd_logelem_modified_object {
struct cfs_dlog_modify *i_up;
} cfsd_logelem_modified_object_t;
/* mapfid */
typedef struct cfsd_logelem_mapfid_object {
struct cfs_dlog_mapfid *i_up;
} cfsd_logelem_mapfid_object_t;
/* Abstract base class used by the other logelem classes. */
#define LOGELM_FIDBUFLEN 1024
typedef struct cfsd_logelem_object {
cfsd_maptbl_object_t *i_maptbl_object_p;
cfsd_logfile_object_t *i_logfile_object_p;
cfsd_kmod_object_t *i_kmod_object_p;
char i_messagep[CFSDMesgMax]; /* message */
char i_fidbuf[LOGELM_FIDBUFLEN]; /* debugging */
cfs_dlog_entry_t *i_entp;
off_t i_offset;
int i_type;
union {
cfsd_logelem_setattr_object_t i_setattr_object;
cfsd_logelem_setsecattr_object_t i_setsecattr_object;
cfsd_logelem_create_object_t i_create_object;
cfsd_logelem_remove_object_t i_remove_object;
cfsd_logelem_rmdir_object_t i_rmdir_object;
cfsd_logelem_mkdir_object_t i_mkdir_object;
cfsd_logelem_link_object_t i_link_object;
cfsd_logelem_symlink_object_t i_symlink_object;
cfsd_logelem_rename_object_t i_rename_object;
cfsd_logelem_modified_object_t i_modified_object;
cfsd_logelem_mapfid_object_t i_mapfid_object;
}i_operation;
}cfsd_logelem_object_t;
cfsd_logelem_object_t *cfsd_logelem_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
void cfsd_logelem_destroy(cfsd_logelem_object_t *logelem_object_p);
void logelem_print_cred(dl_cred_t *credp);
void logelem_print_attr(vattr_t *vp);
void logelem_format_fid(cfsd_logelem_object_t *logelem_object_p, fid_t *fidp);
int logelem_lostfound(cfsd_logelem_object_t *logelem_object_p,
cfs_cid_t *cidp,
cfs_cid_t *pcidp,
const char *namep,
dl_cred_t *cred);
void logelem_problem(cfsd_logelem_object_t *logelem_object_p,
char *strp);
void logelem_resolution(cfsd_logelem_object_t *logelem_object_p,
char *strp);
void logelem_message_append(char *strp1, char *strp2);
void logelem_message(cfsd_logelem_object_t *logelem_object_p,
char *prefix, char *strp);
void logelem_log_opfailed(cfsd_logelem_object_t *logelem_object_p,
char *opp, char *info, const char *namep, int xx);
void logelem_log_opskipped(cfsd_logelem_object_t *logelem_object_p,
const char *namep);
void logelem_log_timelogmesg(cfsd_logelem_object_t *logelem_object_p,
char *opp, const char *namep, char *mesgp, int time_log);
cfsd_logelem_object_t *cfsd_logelem_setattr_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_setsecattr_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_create_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_remove_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_rmdir_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_mkdir_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_link_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_symlink_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_rename_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_modified_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
cfsd_logelem_object_t *cfsd_logelem_mapfid_create(
cfsd_maptbl_object_t *maptbl_object_p,
cfsd_logfile_object_t *logfile_object_p,
cfsd_kmod_object_t *kmod_object_p);
int logelem_roll(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_setattr(cfsd_logelem_object_t *logelem_object_p,
ulong_t *seqp);
int logelem_roll_setsecattr(cfsd_logelem_object_t *logelem_object_p,
ulong_t *seqp);
int logelem_roll_create(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_remove(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_rmdir(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_mkdir(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_link(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_symlink(cfsd_logelem_object_t *logelem_object_p,
ulong_t *seqp);
int logelem_roll_rename(cfsd_logelem_object_t *logelem_object_p, ulong_t *seqp);
int logelem_roll_modified(cfsd_logelem_object_t *logelem_object_p,
ulong_t *seqp);
int logelem_roll_mapfid(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_setattr(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_setsecattr(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_create(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_remove(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_rmdir(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_mkdir(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_link(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_symlink(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_rename(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_modified(cfsd_logelem_object_t *logelem_object_p);
void logelem_dump_mapfid(cfsd_logelem_object_t *logelem_object_p);
#ifdef __cplusplus
}
#endif
#endif /* _CFSD_LOGELEM_H */
|