summaryrefslogtreecommitdiffstats
path: root/rpc/xdr/src/glusterfs-fops.x
blob: 651f8def0ba7bb602dc40b40fcaada97fc8619bf (plain)
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
/*
 * Copyright (c) 2016 Red Hat, Inc. <http://www.redhat.com>
 * This file is part of GlusterFS.
 *
 * This file is licensed to you under your choice of the GNU Lesser
 * General Public License, version 3 or any later version (LGPLv3 or
 * later), or the GNU General Public License, version 2 (GPLv2), in all
 * cases as published by the Free Software Foundation.
 */

#ifdef RPC_XDR
%#include "rpc-pragmas.h"
#endif
%#include <glusterfs/compat.h>

/* NOTE: add members ONLY at the end (just before _MAXVALUE) */
/*
 * OTHER NOTE: fop_enum_to_str and fop_enum_to_pri_str (in common-utils.h) also
 * contain lists of fops, so if you update this list UPDATE THOSE TOO.
 */
enum glusterfs_fop_t {
        GF_FOP_NULL = 0,
        GF_FOP_STAT,
        GF_FOP_READLINK,
        GF_FOP_MKNOD,
        GF_FOP_MKDIR,
        GF_FOP_UNLINK,
        GF_FOP_RMDIR,
        GF_FOP_SYMLINK,
        GF_FOP_RENAME,
        GF_FOP_LINK,
        GF_FOP_TRUNCATE,
        GF_FOP_OPEN,
        GF_FOP_READ,
        GF_FOP_WRITE,
        GF_FOP_STATFS,
        GF_FOP_FLUSH,
        GF_FOP_FSYNC,      /* 16 */
        GF_FOP_SETXATTR,
        GF_FOP_GETXATTR,
        GF_FOP_REMOVEXATTR,
        GF_FOP_OPENDIR,
        GF_FOP_FSYNCDIR,
        GF_FOP_ACCESS,
        GF_FOP_CREATE,
        GF_FOP_FTRUNCATE,
        GF_FOP_FSTAT,      /* 25 */
        GF_FOP_LK,
        GF_FOP_LOOKUP,
        GF_FOP_READDIR,
        GF_FOP_INODELK,
        GF_FOP_FINODELK,
        GF_FOP_ENTRYLK,
        GF_FOP_FENTRYLK,
        GF_FOP_XATTROP,
        GF_FOP_FXATTROP,
        GF_FOP_FGETXATTR,
        GF_FOP_FSETXATTR,
        GF_FOP_RCHECKSUM,
        GF_FOP_SETATTR,
        GF_FOP_FSETATTR,
        GF_FOP_READDIRP,
        GF_FOP_FORGET,
        GF_FOP_RELEASE,
        GF_FOP_RELEASEDIR,
        GF_FOP_GETSPEC,
        GF_FOP_FREMOVEXATTR,
	GF_FOP_FALLOCATE,
	GF_FOP_DISCARD,
        GF_FOP_ZEROFILL,
        GF_FOP_IPC,
        GF_FOP_SEEK,
        GF_FOP_LEASE,
        GF_FOP_COMPOUND,
        GF_FOP_GETACTIVELK,
        GF_FOP_SETACTIVELK,
        GF_FOP_PUT,
        GF_FOP_ICREATE,
        GF_FOP_NAMELINK,
        GF_FOP_COPY_FILE_RANGE,
        GF_FOP_MAXVALUE
};

/* Note: Removed event GF_EVENT_CHILD_MODIFIED=8, hence
 *to preserve backward compatibiliy, GF_EVENT_CLEANUP = 9
 */
enum glusterfs_event_t {
        GF_EVENT_PARENT_UP = 1,
        GF_EVENT_POLLIN,
        GF_EVENT_POLLOUT,
        GF_EVENT_POLLERR,
        GF_EVENT_CHILD_UP,
        GF_EVENT_CHILD_DOWN,
        GF_EVENT_CHILD_CONNECTING,
        GF_EVENT_CLEANUP = 9,
        GF_EVENT_TRANSPORT_CONNECTED,
        GF_EVENT_VOLFILE_MODIFIED,
        GF_EVENT_GRAPH_NEW,
        GF_EVENT_TRANSLATOR_INFO,
        GF_EVENT_TRANSLATOR_OP,
        GF_EVENT_AUTH_FAILED,
        GF_EVENT_VOLUME_DEFRAG,
        GF_EVENT_PARENT_DOWN,
        GF_EVENT_VOLUME_BARRIER_OP,
        GF_EVENT_UPCALL,
        GF_EVENT_SCRUB_STATUS,
        GF_EVENT_SOME_DESCENDENT_DOWN,
        GF_EVENT_SCRUB_ONDEMAND,
        GF_EVENT_SOME_DESCENDENT_UP,
        GF_EVENT_CHILD_PING,
        GF_EVENT_MAXVAL
};

/* List of compound fops. Add fops at the end. */
enum glusterfs_compound_fop_t {
        GF_CFOP_NON_PREDEFINED = 0, /* needs single FOP inspection */
        GF_CFOP_XATTROP_WRITEV,
        GF_CFOP_XATTROP_UNLOCK,
        GF_CFOP_PUT, /* create+write+setxattr+fsync+close+rename */
        GF_CFOP_MAXVALUE
};

enum glusterfs_mgmt_t {
        GF_MGMT_NULL = 0,
        GF_MGMT_MAXVALUE
};

enum gf_op_type_t {
        GF_OP_TYPE_NULL = 0,
        GF_OP_TYPE_FOP,
        GF_OP_TYPE_MGMT,
        GF_OP_TYPE_MAX
};

/* NOTE: all the miscellaneous flags used by GlusterFS should be listed here */
enum glusterfs_lk_cmds_t {
        GF_LK_GETLK = 0,
        GF_LK_SETLK,
        GF_LK_SETLKW,
        GF_LK_RESLK_LCK,
        GF_LK_RESLK_LCKW,
        GF_LK_RESLK_UNLCK,
        GF_LK_GETLK_FD
};

enum glusterfs_lk_types_t {
        GF_LK_F_RDLCK = 0,
        GF_LK_F_WRLCK,
        GF_LK_F_UNLCK,
        GF_LK_EOL
};

/* Lease Types */
enum gf_lease_types_t {
        NONE        = 0,
        GF_RD_LEASE = 1,
        GF_RW_LEASE = 2,
        GF_LEASE_MAX_TYPE
};

/* Lease cmds */
enum gf_lease_cmds_t {
        GF_GET_LEASE = 1,
        GF_SET_LEASE = 2,
        GF_UNLK_LEASE = 3
};

%#define LEASE_ID_SIZE 16 /* 128bits */
struct gf_lease {
        gf_lease_cmds_t  cmd;
        gf_lease_types_t lease_type;
        char             lease_id[LEASE_ID_SIZE];
        unsigned int     lease_flags;
};

enum glusterfs_lk_recovery_cmds_t {
        F_RESLK_LCK = 200,
        F_RESLK_LCKW,
        F_RESLK_UNLCK,
        F_GETLK_FD
};

enum gf_lk_domain_t {
        GF_LOCK_POSIX,
        GF_LOCK_INTERNAL
};

enum entrylk_cmd {
        ENTRYLK_LOCK,
        ENTRYLK_UNLOCK,
        ENTRYLK_LOCK_NB
};

enum entrylk_type {
        ENTRYLK_RDLCK,
        ENTRYLK_WRLCK
};

%#define GF_MAX_LOCK_OWNER_LEN 1024 /* 1kB as per NLM */

/* 16strings-16strings-... */
%#define GF_LKOWNER_BUF_SIZE  ((GF_MAX_LOCK_OWNER_LEN * 2) + (GF_MAX_LOCK_OWNER_LEN / 8))

struct gf_lkowner_t {
        int  len;
        char data[GF_MAX_LOCK_OWNER_LEN];
};

enum gf_xattrop_flags_t {
        GF_XATTROP_ADD_ARRAY,
        GF_XATTROP_ADD_ARRAY64,
        GF_XATTROP_OR_ARRAY,
        GF_XATTROP_AND_ARRAY,
        GF_XATTROP_GET_AND_SET,
        GF_XATTROP_ADD_ARRAY_WITH_DEFAULT,
        GF_XATTROP_ADD_ARRAY64_WITH_DEFAULT
};

enum gf_seek_what_t {
        GF_SEEK_DATA,
        GF_SEEK_HOLE
};

enum gf_upcall_flags_t {
        GF_UPCALL_NULL,
        GF_UPCALL,
        GF_UPCALL_CI_STAT,
        GF_UPCALL_CI_XATTR,
        GF_UPCALL_CI_RENAME,
        GF_UPCALL_CI_NLINK,
        GF_UPCALL_CI_FORGET,
        GF_UPCALL_LEASE_RECALL,
        GF_UPCALL_FLAGS_MAXVALUE
};

enum gf_dict_data_type_t {
        GF_DATA_TYPE_UNKNOWN,
        GF_DATA_TYPE_STR_OLD, /* Will be set by volgen and dict-serialize
                                 and unserialize. Used to reduce warnings
                                 if one is using old protocol */
        GF_DATA_TYPE_INT,
        GF_DATA_TYPE_UINT,
        GF_DATA_TYPE_DOUBLE,
        GF_DATA_TYPE_STR,
        GF_DATA_TYPE_PTR,
        GF_DATA_TYPE_GFUUID,
        GF_DATA_TYPE_IATT,
        GF_DATA_TYPE_MDATA,
        GF_DATA_TYPE_MAX
};