root/branches/Orange-Branch/src/proto/pvfs2-req-proto.h @ 8908

Revision 8908, 76.3 KB (checked in by mtmoore, 23 months ago)

formatting only

Line 
1/*
2 * (C) 2001 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6/* NOTE: if you make any changes to the code contained in this file, please
7 * update the PVFS2_PROTO_VERSION accordingly
8 */
9
10#ifndef __PVFS2_REQ_PROTO_H
11#define __PVFS2_REQ_PROTO_H
12
13#include "pvfs2-config.h"
14#include "pvfs2-types.h"
15#include "pvfs2-attr.h"
16#include "pint-distribution.h"
17#include "pvfs2-request.h"
18#include "pint-request.h"
19#include "pvfs2-mgmt.h"
20#include "pint-hint.h"
21
22/* update PVFS2_PROTO_MAJOR on wire protocol changes that break backwards
23 * compatibility (such as changing the semantics or protocol fields for an
24 * existing request type)
25 */
26#define PVFS2_PROTO_MAJOR 6
27/* update PVFS2_PROTO_MINOR on wire protocol changes that preserve backwards
28 * compatibility (such as adding a new request type)
29 */
30#define PVFS2_PROTO_MINOR 0
31#define PVFS2_PROTO_VERSION ((PVFS2_PROTO_MAJOR*1000)+(PVFS2_PROTO_MINOR))
32
33/* we set the maximum possible size of a small I/O packed message as 64K.  This
34 * is an upper limit that is used to allocate the request and response encoded
35 * buffers, and is independent of the max unexpected message size of the specific
36 * BMI module.  All max unexpected message sizes for BMI modules have to be less
37 * than this value
38 */
39#define PINT_SMALL_IO_MAXSIZE (16*1024)
40
41enum PVFS_server_op
42{
43    PVFS_SERV_INVALID = 0,
44    PVFS_SERV_CREATE = 1,
45    PVFS_SERV_REMOVE = 2,
46    PVFS_SERV_IO = 3,
47    PVFS_SERV_GETATTR = 4,
48    PVFS_SERV_SETATTR = 5,
49    PVFS_SERV_LOOKUP_PATH = 6,
50    PVFS_SERV_CRDIRENT = 7,
51    PVFS_SERV_RMDIRENT = 8,
52    PVFS_SERV_CHDIRENT = 9,
53    PVFS_SERV_TRUNCATE = 10,
54    PVFS_SERV_MKDIR = 11,
55    PVFS_SERV_READDIR = 12,
56    PVFS_SERV_GETCONFIG = 13,
57    PVFS_SERV_WRITE_COMPLETION = 14,
58    PVFS_SERV_FLUSH = 15,
59    PVFS_SERV_MGMT_SETPARAM = 16,
60    PVFS_SERV_MGMT_NOOP = 17,
61    PVFS_SERV_STATFS = 18,
62    PVFS_SERV_PERF_UPDATE = 19,  /* not a real protocol request */
63    PVFS_SERV_MGMT_PERF_MON = 20,
64    PVFS_SERV_MGMT_ITERATE_HANDLES = 21,
65    PVFS_SERV_MGMT_DSPACE_INFO_LIST = 22,
66    PVFS_SERV_MGMT_EVENT_MON = 23,
67    PVFS_SERV_MGMT_REMOVE_OBJECT = 24,
68    PVFS_SERV_MGMT_REMOVE_DIRENT = 25,
69    PVFS_SERV_MGMT_GET_DIRDATA_HANDLE = 26,
70    PVFS_SERV_JOB_TIMER = 27,    /* not a real protocol request */
71    PVFS_SERV_PROTO_ERROR = 28,
72    PVFS_SERV_GETEATTR = 29,
73    PVFS_SERV_SETEATTR = 30,
74    PVFS_SERV_DELEATTR = 31,
75    PVFS_SERV_LISTEATTR = 32,
76    PVFS_SERV_SMALL_IO = 33,
77    PVFS_SERV_LISTATTR = 34,
78    PVFS_SERV_BATCH_CREATE = 35,
79    PVFS_SERV_BATCH_REMOVE = 36,
80    PVFS_SERV_PRECREATE_POOL_REFILLER = 37, /* not a real protocol request */
81    PVFS_SERV_UNSTUFF = 38,
82    PVFS_SERV_MIRROR = 39,
83    PVFS_SERV_IMM_COPIES = 40,
84    PVFS_SERV_TREE_REMOVE = 41,
85    PVFS_SERV_TREE_GET_FILE_SIZE = 42,
86    /* leave this entry last */
87    PVFS_SERV_NUM_OPS
88};
89
90/*
91 * These ops must always work, even if the server is in admin mode.
92 */
93#define PVFS_SERV_IS_MGMT_OP(x) \
94    ((x) == PVFS_SERV_MGMT_SETPARAM \
95  || (x) == PVFS_SERV_MGMT_REMOVE_OBJECT \
96  || (x) == PVFS_SERV_MGMT_REMOVE_DIRENT)
97
98/******************************************************************/
99/* these values define limits on the maximum size of variable length
100 * parameters used within the request protocol
101 */
102
103/* max size of layout information (may include explicit server list */
104#define PVFS_REQ_LIMIT_LAYOUT             4096
105/* max size of opaque distribution parameters */
106#define PVFS_REQ_LIMIT_DIST_BYTES         1024
107/* max size of each configuration file transmitted to clients.
108 * Note: If you change this value, you should change the $req_limit
109 * in pvfs2-genconfig as well. */
110#define PVFS_REQ_LIMIT_CONFIG_FILE_BYTES  65536
111/* max size of all path strings */
112#define PVFS_REQ_LIMIT_PATH_NAME_BYTES    PVFS_NAME_MAX
113/* max size of strings representing a single path element */
114#define PVFS_REQ_LIMIT_SEGMENT_BYTES      PVFS_SEGMENT_MAX
115/* max total size of I/O request descriptions */
116#define PVFS_REQ_LIMIT_IOREQ_BYTES        8192
117/* maximum size of distribution name used for the hints */
118#define PVFS_REQ_LIMIT_DIST_NAME          128
119/* max count of segments allowed per path lookup (note that this governs
120 * the number of handles and attributes returned in lookup_path responses)
121 */
122#define PVFS_REQ_LIMIT_PATH_SEGMENT_COUNT   40
123/* max count of datafiles associated with a logical file */
124#define PVFS_REQ_LIMIT_DFILE_COUNT        1024
125#define PVFS_REQ_LIMIT_DFILE_COUNT_IS_VALID(dfile_count) \
126((dfile_count > 0) && (dfile_count < PVFS_REQ_LIMIT_DFILE_COUNT))
127#define PVFS_REQ_LIMIT_MIRROR_DFILE_COUNT 1024
128/* max count of directory entries per readdir request */
129#define PVFS_REQ_LIMIT_DIRENT_COUNT        512
130/* max number of perf metrics returned by mgmt perf mon op */
131#define PVFS_REQ_LIMIT_MGMT_PERF_MON_COUNT 16
132/* max number of events returned by mgmt event mon op */
133#define PVFS_REQ_LIMIT_MGMT_EVENT_MON_COUNT 2048
134/* max number of handles returned by any operation using an array of handles */
135#define PVFS_REQ_LIMIT_HANDLES_COUNT 1024
136/* max number of handles that can be created at once using batch create */
137#define PVFS_REQ_LIMIT_BATCH_CREATE 8192
138/* max number of handles returned by mgmt iterate handles op */
139#define PVFS_REQ_LIMIT_MGMT_ITERATE_HANDLES_COUNT \
140  PVFS_REQ_LIMIT_HANDLES_COUNT
141/* max number of info list items returned by mgmt dspace info list op */
142/* max number of dspace info structs returned by mgmt dpsace info op */
143#define PVFS_REQ_LIMIT_MGMT_DSPACE_INFO_LIST_COUNT 1024
144/* max number of path elements in a lookup_attr response */
145#define PVFS_REQ_LIMIT_MAX_PATH_ELEMENTS  40
146/* max number of symlinks to resolve before erroring out */
147#define PVFS_REQ_LIMIT_MAX_SYMLINK_RESOLUTION_COUNT 8
148/* max number of bytes in the key of a key/value pair including null term */
149#define PVFS_REQ_LIMIT_KEY_LEN 128
150/* max number of bytes in a value of a key/value/pair */
151#define PVFS_REQ_LIMIT_VAL_LEN 4096
152/* max number of key/value pairs to set or get in a list operation */
153#define PVFS_REQ_LIMIT_KEYVAL_LIST 32
154/* max number of handles for which we return attributes */
155#define PVFS_REQ_LIMIT_LISTATTR 60
156/* max number of bytes in an extended attribute key including null term */
157#define PVFS_REQ_LIMIT_EATTR_KEY_LEN    PVFS_MAX_XATTR_NAMELEN
158/* max number of bytes in an extended attribute value including null term */
159#define PVFS_REQ_LIMIT_EATTR_VAL_LEN    PVFS_MAX_XATTR_VALUELEN
160/* max number of keys or key/value pairs to set or get in an operation */
161#define PVFS_REQ_LIMIT_EATTR_LIST       PVFS_MAX_XATTR_LISTLEN
162
163
164/* create *********************************************************/
165/* - used to create an object.  This creates a metadata handle,
166 * a datafile handle, and links the datafile handle to the metadata handle.
167 * It also sets the attributes on the metadata. */
168
169struct PVFS_servreq_create
170{
171    PVFS_fs_id fs_id;
172    PVFS_object_attr attr;
173
174    int32_t num_dfiles_req;
175    /* NOTE: leave layout as final field so that we can deal with encoding
176     * errors */
177    PVFS_sys_layout layout;
178};
179endecode_fields_5_struct(
180    PVFS_servreq_create,
181    PVFS_fs_id, fs_id,
182    skip4,,
183    PVFS_object_attr, attr,
184    int32_t, num_dfiles_req,
185    PVFS_sys_layout, layout);
186
187#define extra_size_PVFS_servreq_create \
188    (extra_size_PVFS_object_attr + extra_size_PVFS_sys_layout)
189
190#define PINT_SERVREQ_CREATE_FILL(__req,                                    \
191                                 __creds,                                  \
192                                 __fsid,                                   \
193                                 __attr,                                   \
194                                 __num_dfiles_req,                         \
195                                 __layout,                                 \
196                                 __hints)                                  \
197do {                                                                       \
198    int mask;                                                              \
199    memset(&(__req), 0, sizeof(__req));                                    \
200    (__req).op = PVFS_SERV_CREATE;                                         \
201    (__req).credentials = (__creds);                                       \
202    (__req).hints = (__hints);                                             \
203    (__req).u.create.fs_id = (__fsid);                                     \
204    (__req).u.create.num_dfiles_req = (__num_dfiles_req);                  \
205    (__attr).objtype = PVFS_TYPE_METAFILE;                                 \
206    mask = (__attr).mask;                                                  \
207    (__attr).mask = PVFS_ATTR_COMMON_ALL;                                  \
208    (__attr).mask |= PVFS_ATTR_SYS_TYPE;                                   \
209    PINT_copy_object_attr(&(__req).u.create.attr, &(__attr));              \
210    (__req).u.create.attr.mask |= mask;                                    \
211    (__req).u.create.layout = __layout;                                    \
212} while (0)
213
214struct PVFS_servresp_create
215{
216    PVFS_handle metafile_handle;
217    int32_t stuffed;
218    int32_t datafile_count;
219    PVFS_handle *datafile_handles;
220};
221endecode_fields_2a_struct(
222    PVFS_servresp_create,
223    PVFS_handle, metafile_handle,
224    int32_t, stuffed,
225    int32_t, datafile_count,
226    PVFS_handle, datafile_handles);
227#define extra_size_PVFS_servresp_create \
228    (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
229
230/* batch_create *********************************************************/
231/* - used to create new multiple metafile and datafile objects */
232
233struct PVFS_servreq_batch_create
234{
235    PVFS_fs_id fs_id;
236    PVFS_ds_type object_type;
237    uint32_t object_count;
238
239    /*
240      an array of handle extents that we use to suggest to
241      the server from which handle range to allocate for the
242      newly created handle(s).  To request a single handle,
243      a single extent with first = last should be used.
244    */
245    PVFS_handle_extent_array handle_extent_array;
246};
247endecode_fields_5_struct(
248    PVFS_servreq_batch_create,
249    PVFS_fs_id, fs_id,
250    PVFS_ds_type, object_type,
251    uint32_t, object_count,
252    skip4,,
253    PVFS_handle_extent_array, handle_extent_array);
254
255#define extra_size_PVFS_servreq_batch_create \
256    (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle_extent))
257
258#define PINT_SERVREQ_BATCH_CREATE_FILL(__req,          \
259                                 __creds,              \
260                                 __fsid,               \
261                                 __objtype,            \
262                                 __objcount,           \
263                                 __ext_array,          \
264                                 __hints)              \
265do {                                                   \
266    memset(&(__req), 0, sizeof(__req));                \
267    (__req).op = PVFS_SERV_BATCH_CREATE;               \
268    (__req).credentials = (__creds);                   \
269    (__req).hints = (__hints);                         \
270    (__req).u.batch_create.fs_id = (__fsid);           \
271    (__req).u.batch_create.object_type = (__objtype);        \
272    (__req).u.batch_create.object_count = (__objcount);      \
273    (__req).u.batch_create.handle_extent_array.extent_count =\
274        (__ext_array).extent_count;                    \
275    (__req).u.batch_create.handle_extent_array.extent_array =\
276        (__ext_array).extent_array;                    \
277} while (0)
278
279struct PVFS_servresp_batch_create
280{
281    PVFS_handle *handle_array;
282    uint32_t handle_count;
283};
284endecode_fields_1a_struct(
285    PVFS_servresp_batch_create,
286    skip4,,
287    uint32_t, handle_count,
288    PVFS_handle, handle_array);
289#define extra_size_PVFS_servresp_batch_create \
290  (PVFS_REQ_LIMIT_BATCH_CREATE * sizeof(PVFS_handle))
291
292/* remove *****************************************************/
293/* - used to remove an existing metafile or datafile object */
294
295struct PVFS_servreq_remove
296{
297    PVFS_handle handle;
298    PVFS_fs_id  fs_id;
299};
300endecode_fields_2_struct(
301    PVFS_servreq_remove,
302    PVFS_handle, handle,
303    PVFS_fs_id, fs_id);
304
305#define PINT_SERVREQ_REMOVE_FILL(__req,   \
306                                 __creds, \
307                                 __fsid,  \
308                                 __handle,\
309                                 __hints) \
310do {                                      \
311    memset(&(__req), 0, sizeof(__req));   \
312    (__req).op = PVFS_SERV_REMOVE;        \
313    (__req).hints = (__hints);            \
314    (__req).credentials = (__creds);      \
315    (__req).u.remove.fs_id = (__fsid);    \
316    (__req).u.remove.handle = (__handle); \
317} while (0)
318
319struct PVFS_servreq_batch_remove
320{
321    PVFS_fs_id  fs_id;
322    int32_t handle_count;
323    PVFS_handle *handles;
324};
325endecode_fields_1a_struct(
326    PVFS_servreq_batch_remove,
327    PVFS_fs_id, fs_id,
328    int32_t, handle_count,
329    PVFS_handle, handles);
330#define extra_size_PVFS_servreq_batch_remove \
331  (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
332
333#define PINT_SERVREQ_BATCH_REMOVE_FILL(__req,        \
334                                       __creds,      \
335                                       __fsid,       \
336                                       __count,      \
337                                       __handles)    \
338do {                                                 \
339    memset(&(__req), 0, sizeof(__req));              \
340    (__req).op = PVFS_SERV_BATCH_REMOVE;             \
341    (__req).credentials = (__creds);                 \
342    (__req).u.batch_remove.fs_id = (__fsid);         \
343    (__req).u.batch_remove.handle_count = (__count); \
344    (__req).u.batch_remove.handles = (__handles);    \
345} while (0)
346
347/* mgmt_remove_object */
348/* - used to remove an existing object reference */
349
350struct PVFS_servreq_mgmt_remove_object
351{
352    PVFS_handle handle;
353    PVFS_fs_id fs_id;
354};
355endecode_fields_2_struct(
356    PVFS_servreq_mgmt_remove_object,
357    PVFS_handle, handle,
358    PVFS_fs_id, fs_id);
359
360#define PINT_SERVREQ_MGMT_REMOVE_OBJECT_FILL(__req,   \
361                                             __creds, \
362                                             __fsid,  \
363                                             __handle,\
364                                             __hints) \
365do {                                                  \
366    memset(&(__req), 0, sizeof(__req));               \
367    (__req).op = PVFS_SERV_MGMT_REMOVE_OBJECT;        \
368    (__req).hints = (__hints);                        \
369    (__req).credentials = (__creds);                  \
370    (__req).u.mgmt_remove_object.fs_id = (__fsid);    \
371    (__req).u.mgmt_remove_object.handle = (__handle); \
372} while (0)
373
374/* mgmt_remove_dirent */
375/* - used to remove an existing dirent under the specified parent ref */
376
377struct PVFS_servreq_mgmt_remove_dirent
378{
379    PVFS_handle handle;
380    PVFS_fs_id fs_id;
381    char *entry;
382};
383endecode_fields_4_struct(
384    PVFS_servreq_mgmt_remove_dirent,
385    PVFS_handle, handle,
386    PVFS_fs_id, fs_id,
387    skip4,,
388    string, entry);
389#define extra_size_PVFS_servreq_mgmt_remove_dirent \
390  roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
391
392#define PINT_SERVREQ_MGMT_REMOVE_DIRENT_FILL(__req,   \
393                                             __creds, \
394                                             __fsid,  \
395                                             __handle,\
396                                             __entry, \
397                                             __hints) \
398do {                                                  \
399    memset(&(__req), 0, sizeof(__req));               \
400    (__req).op = PVFS_SERV_MGMT_REMOVE_DIRENT;        \
401    (__req).hints = (__hints);                        \
402    (__req).credentials = (__creds);                  \
403    (__req).u.mgmt_remove_dirent.fs_id = (__fsid);    \
404    (__req).u.mgmt_remove_dirent.handle = (__handle); \
405    (__req).u.mgmt_remove_dirent.entry = (__entry);   \
406} while (0)
407
408struct PVFS_servreq_tree_remove
409{
410    PVFS_fs_id  fs_id;
411    uint32_t num_data_files;
412    PVFS_handle *handle_array;
413};
414endecode_fields_1a_struct(
415    PVFS_servreq_tree_remove,
416    PVFS_fs_id, fs_id,
417    uint32_t, num_data_files,
418    PVFS_handle, handle_array);
419#define extra_size_PVFS_servreq_tree_remove \
420  (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
421
422#define PINT_SERVREQ_TREE_REMOVE_FILL(__req,                   \
423                                 __creds,                      \
424                                 __fsid,                       \
425                                 __num_data_files,             \
426                                 __handle_array,               \
427                                 __hints)                      \
428do {                                                           \
429    memset(&(__req), 0, sizeof(__req));                        \
430    (__req).op = PVFS_SERV_TREE_REMOVE;                        \
431    (__req).hints = (__hints);                                 \
432    (__req).credentials = (__creds);                           \
433    (__req).u.tree_remove.fs_id = (__fsid);                    \
434    (__req).u.tree_remove.num_data_files = (__num_data_files); \
435    (__req).u.tree_remove.handle_array = (__handle_array);     \
436} while (0)
437
438struct PVFS_servreq_tree_get_file_size
439{
440    PVFS_fs_id  fs_id;
441    uint32_t caller_handle_index;
442    uint32_t retry_msgpair_at_leaf;
443    uint32_t num_data_files;
444    PVFS_handle *handle_array;
445};
446endecode_fields_3a_struct(
447    PVFS_servreq_tree_get_file_size,
448    PVFS_fs_id, fs_id,
449    uint32_t, caller_handle_index,
450    uint32_t, retry_msgpair_at_leaf,
451    uint32_t, num_data_files,
452    PVFS_handle, handle_array);
453#define extra_size_PVFS_servreq_tree_get_file_size \
454  (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
455
456#define PINT_SERVREQ_TREE_GET_FILE_SIZE_FILL(__req,                    \
457                                 __creds,                              \
458                                 __fsid,                               \
459                                 __caller_handle_index,                \
460                                 __num_data_files,                     \
461                                 __handle_array,                       \
462                                 __retry_msgpair_at_leaf,              \
463                                 __hints)                              \
464do {                                                                   \
465    memset(&(__req), 0, sizeof(__req));                                \
466    (__req).op = PVFS_SERV_TREE_GET_FILE_SIZE;                         \
467    (__req).hints = (__hints);                                         \
468    (__req).credentials = (__creds);                                   \
469    (__req).u.tree_get_file_size.fs_id = (__fsid);                     \
470    (__req).u.tree_get_file_size.caller_handle_index =                 \
471        (__caller_handle_index);                                       \
472    (__req).u.tree_get_file_size.num_data_files = (__num_data_files);  \
473    (__req).u.tree_get_file_size.handle_array = (__handle_array);      \
474    (__req).u.tree_get_file_size.retry_msgpair_at_leaf =               \
475        (__retry_msgpair_at_leaf);\
476} while (0)
477
478struct PVFS_servresp_tree_get_file_size
479{
480    uint32_t caller_handle_index;
481    uint32_t handle_count;
482    PVFS_size  *size;
483    PVFS_error *error;
484};
485endecode_fields_1aa_struct(
486    PVFS_servresp_tree_get_file_size,
487    uint32_t, caller_handle_index,
488    uint32_t, handle_count,
489    PVFS_size, size,
490    PVFS_error, error);
491#define extra_size_PVFS_servresp_tree_get_file_size \
492  ( (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_error)) + \
493    (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_size)) )
494
495/* mgmt_get_dirdata_handle */
496/* - used to retrieve the dirdata handle of the specified parent ref */
497struct PVFS_servreq_mgmt_get_dirdata_handle
498{
499    PVFS_handle handle;
500    PVFS_fs_id fs_id;
501};
502endecode_fields_2_struct(
503    PVFS_servreq_mgmt_get_dirdata_handle,
504    PVFS_handle, handle,
505    PVFS_fs_id, fs_id);
506
507#define PINT_SERVREQ_MGMT_GET_DIRDATA_HANDLE_FILL(__req,   \
508                                                  __creds, \
509                                                  __fsid,  \
510                                                  __handle,\
511                                                  __hints) \
512do {                                                       \
513    memset(&(__req), 0, sizeof(__req));                    \
514    (__req).op = PVFS_SERV_MGMT_GET_DIRDATA_HANDLE;        \
515    (__req).credentials = (__creds);                       \
516    (__req).hints = (__hints);                             \
517    (__req).u.mgmt_get_dirdata_handle.fs_id = (__fsid);    \
518    (__req).u.mgmt_get_dirdata_handle.handle = (__handle); \
519} while (0)
520
521struct PVFS_servresp_mgmt_get_dirdata_handle
522{
523    PVFS_handle handle;
524};
525endecode_fields_1_struct(
526    PVFS_servresp_mgmt_get_dirdata_handle,
527    PVFS_handle, handle);
528
529/* flush
530 * - used to flush an object to disk */
531struct PVFS_servreq_flush
532{
533    PVFS_handle handle;
534    PVFS_fs_id fs_id;
535    int32_t flags;
536};
537endecode_fields_3_struct(
538    PVFS_servreq_flush,
539    PVFS_handle, handle,
540    PVFS_fs_id, fs_id,
541    int32_t, flags);
542
543#define PINT_SERVREQ_FLUSH_FILL(__req,   \
544                                __creds, \
545                                __fsid,  \
546                                __handle,\
547                                __hints )\
548do {                                     \
549    memset(&(__req), 0, sizeof(__req));  \
550    (__req).op = PVFS_SERV_FLUSH;        \
551    (__req).credentials = (__creds);     \
552    (__req).hints = (__hints);           \
553    (__req).u.flush.fs_id = (__fsid);    \
554    (__req).u.flush.handle = (__handle); \
555} while (0)
556
557/* getattr ****************************************************/
558/* - retreives attributes based on mask of PVFS_ATTR_XXX values */
559
560struct PVFS_servreq_getattr
561{
562    PVFS_handle handle; /* handle of target object */
563    PVFS_fs_id fs_id;   /* file system */
564    uint32_t attrmask;  /* mask of desired attributes */
565};
566endecode_fields_3_struct(
567    PVFS_servreq_getattr,
568    PVFS_handle, handle,
569    PVFS_fs_id, fs_id,
570    uint32_t, attrmask);
571
572#define PINT_SERVREQ_GETATTR_FILL(__req,   \
573                                  __creds, \
574                                  __fsid,  \
575                                  __handle,\
576                                  __amask, \
577                                  __hints) \
578do {                                       \
579    memset(&(__req), 0, sizeof(__req));    \
580    (__req).op = PVFS_SERV_GETATTR;        \
581    (__req).credentials = (__creds);       \
582    (__req).hints = (__hints);             \
583    (__req).u.getattr.fs_id = (__fsid);    \
584    (__req).u.getattr.handle = (__handle); \
585    (__req).u.getattr.attrmask = (__amask);\
586} while (0)
587
588struct PVFS_servresp_getattr
589{
590    PVFS_object_attr attr;
591};
592endecode_fields_1_struct(
593    PVFS_servresp_getattr,
594    PVFS_object_attr, attr);
595#define extra_size_PVFS_servresp_getattr \
596    extra_size_PVFS_object_attr
597
598/* unstuff ****************************************************/
599/* - creates the datafile handles for the file.  This allows a stuffed
600 * file to migrate to a large one. */
601
602struct PVFS_servreq_unstuff
603{
604    PVFS_handle handle; /* handle of target object */
605    PVFS_fs_id fs_id;   /* file system */
606    uint32_t attrmask;  /* mask of desired attributes */
607};
608endecode_fields_3_struct(
609    PVFS_servreq_unstuff,
610    PVFS_handle, handle,
611    PVFS_fs_id, fs_id,
612    uint32_t, attrmask);
613
614#define PINT_SERVREQ_UNSTUFF_FILL(__req,           \
615                                  __creds,         \
616                                  __fsid,          \
617                                  __handle,        \
618                                  __amask)         \
619do {                                               \
620    memset(&(__req), 0, sizeof(__req));            \
621    (__req).op = PVFS_SERV_UNSTUFF;                \
622    (__req).credentials = (__creds);               \
623    (__req).u.unstuff.fs_id = (__fsid);            \
624    (__req).u.unstuff.handle = (__handle);         \
625    (__req).u.unstuff.attrmask = (__amask);        \
626} while (0)
627
628struct PVFS_servresp_unstuff
629{
630    /* return the entire object's attributes, which includes the
631     * new datafile handles for the migrated file.
632     */
633    PVFS_object_attr attr;
634};
635endecode_fields_1_struct(
636    PVFS_servresp_unstuff,
637    PVFS_object_attr, attr);
638#define extra_size_PVFS_servresp_unstuff \
639    extra_size_PVFS_object_attr
640
641/* setattr ****************************************************/
642/* - sets attributes specified by mask of PVFS_ATTR_XXX values */
643
644struct PVFS_servreq_setattr
645{
646    PVFS_handle handle;    /* handle of target object */
647    PVFS_fs_id fs_id;      /* file system */
648    PVFS_object_attr attr; /* new attributes */
649};
650endecode_fields_4_struct(
651    PVFS_servreq_setattr,
652    PVFS_handle, handle,
653    PVFS_fs_id, fs_id,
654    skip4,,
655    PVFS_object_attr, attr);
656#define extra_size_PVFS_servreq_setattr \
657    extra_size_PVFS_object_attr
658
659#define PINT_SERVREQ_SETATTR_FILL(__req,         \
660                                  __creds,       \
661                                  __fsid,        \
662                                  __handle,      \
663                                  __objtype,     \
664                                  __attr,        \
665                                  __extra_amask, \
666                                  __hints)       \
667do {                                             \
668    memset(&(__req), 0, sizeof(__req));          \
669    (__req).op = PVFS_SERV_SETATTR;              \
670    (__req).credentials = (__creds);             \
671    (__req).hints = (__hints);                   \
672    (__req).u.setattr.fs_id = (__fsid);          \
673    (__req).u.setattr.handle = (__handle);       \
674    (__attr).objtype = (__objtype);              \
675    (__attr).mask |= PVFS_ATTR_SYS_TYPE;         \
676    PINT_CONVERT_ATTR(&(__req).u.setattr.attr, &(__attr), __extra_amask);\
677} while (0)
678
679/* lookup path ************************************************/
680/* - looks up as many elements of the specified path as possible */
681
682struct PVFS_servreq_lookup_path
683{
684    char *path;                  /* path name */
685    PVFS_fs_id fs_id;            /* file system */
686    PVFS_handle handle; /* handle of path parent */
687    /* mask of attribs to return with lookup results */
688    uint32_t attrmask;
689};
690endecode_fields_5_struct(
691    PVFS_servreq_lookup_path,
692    string, path,
693    PVFS_fs_id, fs_id,
694    skip4,,
695    PVFS_handle, handle,
696    uint32_t, attrmask);
697#define extra_size_PVFS_servreq_lookup_path \
698  roundup8(PVFS_REQ_LIMIT_PATH_NAME_BYTES + 1)
699
700#define PINT_SERVREQ_LOOKUP_PATH_FILL(__req,           \
701                                      __creds,         \
702                                      __path,          \
703                                      __fsid,          \
704                                      __handle,        \
705                                      __amask,         \
706                                      __hints)         \
707do {                                                   \
708    memset(&(__req), 0, sizeof(__req));                \
709    (__req).op = PVFS_SERV_LOOKUP_PATH;                \
710    (__req).credentials = (__creds);                   \
711    (__req).hints = (__hints);                         \
712    (__req).u.lookup_path.path = (__path);             \
713    (__req).u.lookup_path.fs_id = (__fsid);            \
714    (__req).u.lookup_path.handle = (__handle);\
715    (__req).u.lookup_path.attrmask = (__amask);        \
716} while (0)
717
718struct PVFS_servresp_lookup_path
719{
720    /* array of handles for each successfully resolved path segment */
721    PVFS_handle *handle_array;           
722    /* array of attributes for each path segment (when available) */
723    PVFS_object_attr *attr_array;
724    uint32_t handle_count; /* # of handles returned */
725    uint32_t attr_count;   /* # of attributes returned */
726};
727endecode_fields_1a_1a_struct(
728    PVFS_servresp_lookup_path,
729    skip4,,
730    uint32_t, handle_count,
731    PVFS_handle, handle_array,
732    skip4,,
733    uint32_t, attr_count,
734    PVFS_object_attr, attr_array);
735/* this is a big thing that could be either a full path,
736* or lots of handles, just use the max io req limit */
737#define extra_size_PVFS_servresp_lookup_path \
738  (PVFS_REQ_LIMIT_IOREQ_BYTES)
739
740/* mkdir *******************************************************/
741/* - makes a new directory object */
742
743struct PVFS_servreq_mkdir
744{
745    PVFS_fs_id fs_id;      /* file system */
746    PVFS_object_attr attr; /* initial attributes */
747
748    /*
749      an array of handle extents that we use to suggest to
750      the server from which handle range to allocate for the
751      newly created handle(s).  To request a single handle,
752      a single extent with first = last should be used.
753    */
754    PVFS_handle_extent_array handle_extent_array;
755};
756endecode_fields_4_struct(
757    PVFS_servreq_mkdir,
758    PVFS_fs_id, fs_id,
759    skip4,,
760    PVFS_object_attr, attr,
761    PVFS_handle_extent_array, handle_extent_array);
762#define extra_size_PVFS_servreq_mkdir \
763    (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle_extent))
764
765#define PINT_SERVREQ_MKDIR_FILL(__req,                 \
766                                __creds,               \
767                                __fs_id,               \
768                                __ext_array,           \
769                                __attr,                \
770                                __hints)               \
771do {                                                   \
772    memset(&(__req), 0, sizeof(__req));                \
773    (__req).op = PVFS_SERV_MKDIR;                      \
774    (__req).credentials = (__creds);                   \
775    (__req).hints = (__hints);                         \
776    (__req).u.mkdir.fs_id = __fs_id;                   \
777    (__req).u.mkdir.handle_extent_array.extent_count = \
778        (__ext_array).extent_count;                    \
779    (__req).u.mkdir.handle_extent_array.extent_array = \
780        (__ext_array).extent_array;                    \
781    (__attr).objtype = PVFS_TYPE_DIRECTORY;            \
782    (__attr).mask   |= PVFS_ATTR_SYS_TYPE;             \
783    PINT_CONVERT_ATTR(&(__req).u.mkdir.attr, &(__attr), 0);\
784} while (0)
785
786struct PVFS_servresp_mkdir
787{
788    PVFS_handle handle; /* handle of new directory */
789};
790endecode_fields_1_struct(
791    PVFS_servresp_mkdir,
792    PVFS_handle, handle);
793
794/* create dirent ***********************************************/
795/* - creates a new entry within an existing directory */
796
797struct PVFS_servreq_crdirent
798{
799    char *name;                /* name of new entry */
800    PVFS_handle new_handle;    /* handle of new entry */
801    PVFS_handle handle; /* handle of directory */
802    PVFS_fs_id fs_id;          /* file system */
803};
804endecode_fields_4_struct(
805    PVFS_servreq_crdirent,
806    string, name,
807    PVFS_handle, new_handle,
808    PVFS_handle, handle,
809    PVFS_fs_id, fs_id);
810#define extra_size_PVFS_servreq_crdirent \
811  roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
812
813#define PINT_SERVREQ_CRDIRENT_FILL(__req,           \
814                                   __creds,         \
815                                   __name,          \
816                                   __new_handle,    \
817                                   __handle,        \
818                                   __fs_id,         \
819                                   __hints)         \
820do {                                                \
821    memset(&(__req), 0, sizeof(__req));             \
822    (__req).op = PVFS_SERV_CRDIRENT;                \
823    (__req).credentials = (__creds);                \
824    (__req).hints = (__hints);                      \
825    (__req).u.crdirent.name = (__name);             \
826    (__req).u.crdirent.new_handle = (__new_handle); \
827    (__req).u.crdirent.handle =                     \
828       (__handle);                                  \
829    (__req).u.crdirent.fs_id = (__fs_id);           \
830} while (0)
831
832/* rmdirent ****************************************************/
833/* - removes an existing directory entry */
834
835struct PVFS_servreq_rmdirent
836{
837    char *entry;               /* name of entry to remove */
838    PVFS_handle handle; /* handle of directory */
839    PVFS_fs_id fs_id;          /* file system */
840};
841endecode_fields_3_struct(
842    PVFS_servreq_rmdirent,
843    string, entry,
844    PVFS_handle, handle,
845    PVFS_fs_id, fs_id);
846#define extra_size_PVFS_servreq_rmdirent \
847  roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
848
849#define PINT_SERVREQ_RMDIRENT_FILL(__req,         \
850                                   __creds,       \
851                                   __fsid,        \
852                                   __handle,      \
853                                   __entry,       \
854                                   __hints)       \
855do {                                              \
856    memset(&(__req), 0, sizeof(__req));           \
857    (__req).op = PVFS_SERV_RMDIRENT;              \
858    (__req).credentials = (__creds);              \
859    (__req).hints = (__hints);                    \
860    (__req).u.rmdirent.fs_id = (__fsid);          \
861    (__req).u.rmdirent.handle = (__handle);       \
862    (__req).u.rmdirent.entry = (__entry);         \
863} while (0);
864
865struct PVFS_servresp_rmdirent
866{
867    PVFS_handle entry_handle;   /* handle of removed entry */
868};
869endecode_fields_1_struct(
870    PVFS_servresp_rmdirent,
871    PVFS_handle, entry_handle);
872
873/* chdirent ****************************************************/
874/* - modifies an existing directory entry on a particular file system */
875
876struct PVFS_servreq_chdirent
877{
878    char *entry;                   /* name of entry to remove */
879    PVFS_handle new_dirent_handle; /* handle of directory */
880    PVFS_handle handle;     /* handle of directory */
881    PVFS_fs_id fs_id;              /* file system */
882};
883endecode_fields_4_struct(
884    PVFS_servreq_chdirent,
885    string, entry,
886    PVFS_handle, new_dirent_handle,
887    PVFS_handle, handle,
888    PVFS_fs_id, fs_id);
889#define extra_size_PVFS_servreq_chdirent \
890  roundup8(PVFS_REQ_LIMIT_SEGMENT_BYTES+1)
891
892#define PINT_SERVREQ_CHDIRENT_FILL(__req,          \
893                                   __creds,        \
894                                   __fsid,         \
895                                   __handle,       \
896                                   __new_dirent,   \
897                                   __entry,        \
898                                   __hints)        \
899do {                                               \
900    memset(&(__req), 0, sizeof(__req));            \
901    (__req).op = PVFS_SERV_CHDIRENT;               \
902    (__req).credentials = (__creds);               \
903    (__req).hints = (__hints);                     \
904    (__req).u.chdirent.fs_id = (__fsid);           \
905    (__req).u.chdirent.handle =                    \
906        (__handle);                                \
907    (__req).u.chdirent.new_dirent_handle =         \
908        (__new_dirent);                            \
909    (__req).u.chdirent.entry = (__entry);          \
910} while (0);
911
912struct PVFS_servresp_chdirent
913{
914    PVFS_handle old_dirent_handle;
915};
916endecode_fields_1_struct(
917    PVFS_servresp_chdirent,
918    PVFS_handle, old_dirent_handle);
919
920/* readdir *****************************************************/
921/* - reads entries from a directory */
922
923struct PVFS_servreq_readdir
924{
925    PVFS_handle handle;     /* handle of dir object */
926    PVFS_fs_id fs_id;       /* file system */
927    PVFS_ds_position token; /* dir offset */
928    uint32_t dirent_count;  /* desired # of entries */
929};
930endecode_fields_4_struct(
931    PVFS_servreq_readdir,
932    PVFS_handle, handle,
933    PVFS_fs_id, fs_id,
934    uint32_t, dirent_count,
935    PVFS_ds_position, token);
936
937#define PINT_SERVREQ_READDIR_FILL(__req,              \
938                                  __creds,            \
939                                  __fsid,             \
940                                  __handle,           \
941                                  __token,            \
942                                  __dirent_count,     \
943                                  __hints)            \
944do {                                                  \
945    memset(&(__req), 0, sizeof(__req));               \
946    (__req).op = PVFS_SERV_READDIR;                   \
947    (__req).credentials = (__creds);                  \
948    (__req).hints = (__hints);                        \
949    (__req).u.readdir.fs_id = (__fsid);               \
950    (__req).u.readdir.handle = (__handle);            \
951    (__req).u.readdir.token = (__token);              \
952    (__req).u.readdir.dirent_count = (__dirent_count);\
953} while (0);
954
955struct PVFS_servresp_readdir
956{
957    PVFS_ds_position token;  /* new dir offset */
958    /* array of directory entries */
959    PVFS_dirent *dirent_array;
960    uint32_t dirent_count;   /* # of entries retrieved */
961    uint64_t directory_version;
962};
963endecode_fields_3a_struct(
964    PVFS_servresp_readdir,
965    PVFS_ds_position, token,
966    uint64_t, directory_version,
967    skip4,,
968    uint32_t, dirent_count,
969    PVFS_dirent, dirent_array);
970#define extra_size_PVFS_servresp_readdir \
971  roundup8(PVFS_REQ_LIMIT_DIRENT_COUNT * (PVFS_NAME_MAX + 1 + 8))
972
973/* getconfig ***************************************************/
974/* - retrieves initial configuration information from server */
975
976#define PINT_SERVREQ_GETCONFIG_FILL(__req, __creds, __hints)\
977do {                                               \
978    memset(&(__req), 0, sizeof(__req));            \
979    (__req).op = PVFS_SERV_GETCONFIG;              \
980    (__req).hints = (__hints);                     \
981    (__req).credentials = (__creds);               \
982} while (0);
983
984struct PVFS_servresp_getconfig
985{
986    char *fs_config_buf;
987    uint32_t fs_config_buf_size;
988};
989endecode_fields_3_struct(
990    PVFS_servresp_getconfig,
991    uint32_t, fs_config_buf_size,
992    skip4,,
993    string, fs_config_buf);
994#define extra_size_PVFS_servresp_getconfig \
995    (PVFS_REQ_LIMIT_CONFIG_FILE_BYTES)
996
997/* mirror ******************************************************/
998/* - copies a datahandle owned by the local server to a data-  */
999/*   handle on a remote server. There could be multiple desti- */
1000/*   nation data handles. dst_count tells us how many there    */
1001/*   are.                                                      */
1002struct PVFS_servreq_mirror
1003{
1004    PVFS_handle src_handle;
1005    PVFS_handle *dst_handle;
1006    PVFS_fs_id  fs_id;
1007    PINT_dist   *dist;
1008    uint32_t    bsize;
1009    uint32_t    src_server_nr;
1010    uint32_t    *wcIndex;
1011    uint32_t     dst_count;
1012    enum PVFS_flowproto_type flow_type;
1013    enum PVFS_encoding_type encoding;
1014};
1015
1016#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1017#define encode_PVFS_servreq_mirror(pptr,x) do {      \
1018   encode_PVFS_handle(pptr,&(x)->src_handle);        \
1019   encode_PVFS_fs_id(pptr,&(x)->fs_id);              \
1020   encode_PINT_dist(pptr,&(x)->dist);                \
1021   encode_uint32_t(pptr,&(x)->bsize);                \
1022   encode_uint32_t(pptr,&(x)->src_server_nr);        \
1023   encode_uint32_t(pptr,&(x)->dst_count);            \
1024   encode_enum(pptr,&(x)->flow_type);                \
1025   encode_enum(pptr,&(x)->encoding);                 \
1026   int i;                                            \
1027   for (i=0; i<(x)->dst_count; i++)                  \
1028   {                                                 \
1029       encode_PVFS_handle(pptr,&(x)->dst_handle[i]); \
1030       encode_uint32_t(pptr,&(x)->wcIndex[i]);       \
1031   }                                                 \
1032} while (0)
1033
1034#define decode_PVFS_servreq_mirror(pptr,x) do {          \
1035   decode_PVFS_handle(pptr,&(x)->src_handle);            \
1036   decode_PVFS_fs_id(pptr,&(x)->fs_id);                  \
1037   decode_PINT_dist(pptr,&(x)->dist);                    \
1038   decode_uint32_t(pptr,&(x)->bsize);                    \
1039   decode_uint32_t(pptr,&(x)->src_server_nr);            \
1040   decode_uint32_t(pptr,&(x)->dst_count);                \
1041   decode_enum(pptr,&(x)->flow_type);                    \
1042   decode_enum(pptr,&(x)->encoding);                     \
1043   (x)->dst_handle = decode_malloc((x)->dst_count *      \
1044                                   sizeof(PVFS_handle)); \
1045   (x)->wcIndex = decode_malloc((x)->dst_count *         \
1046                               sizeof(uint32_t));        \
1047   int i;                                                \
1048   for (i=0; i<(x)->dst_count; i++)                      \
1049   {                                                     \
1050       decode_PVFS_handle(pptr,&(x)->dst_handle[i]);     \
1051       decode_uint32_t(pptr,&(x)->wcIndex[i]);           \
1052   }                                                     \
1053} while (0)
1054#endif
1055
1056#define extra_size_PVFS_servreq_mirror \
1057   ( (sizeof(PVFS_handle) * PVFS_REQ_LIMIT_HANDLES_COUNT) + \
1058     (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) )
1059
1060/*Response to mirror request.  Identifies the number of bytes written and the */
1061/*status of that write for each source-destination handle pair. (Source is    */
1062/*always the same for each pair.)                                             */
1063struct PVFS_servresp_mirror
1064{
1065    PVFS_handle src_handle;
1066    uint32_t src_server_nr;
1067    uint32_t *bytes_written;
1068    uint32_t *write_status_code;
1069    uint32_t dst_count;
1070};
1071
1072#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1073#define encode_PVFS_servresp_mirror(pptr,x) do {         \
1074   encode_PVFS_handle(pptr,&(x)->src_handle);            \
1075   encode_uint32_t(pptr,&(x)->src_server_nr);            \
1076   encode_uint32_t(pptr,&(x)->dst_count);                \
1077   int i;                                                \
1078   for (i=0; i<(x)->dst_count; i++)                      \
1079   {                                                     \
1080       encode_uint32_t(pptr,&(x)->bytes_written[i]);     \
1081       encode_uint32_t(pptr,&(x)->write_status_code[i]); \
1082   }                                                     \
1083} while (0)
1084
1085#define decode_PVFS_servresp_mirror(pptr,x) do {            \
1086  decode_PVFS_handle(pptr,&(x)->src_handle);                \
1087  decode_uint32_t(pptr,&(x)->src_server_nr);                \
1088  decode_uint32_t(pptr,&(x)->dst_count);                    \
1089  (x)->bytes_written     = decode_malloc((x)->dst_count *   \
1090                                         sizeof(uint32_t)); \
1091  (x)->write_status_code = decode_malloc((x)->dst_count *   \
1092                                         sizeof(uint32_t)); \
1093  int i;                                                    \
1094  for (i=0; i<(x)->dst_count; i++ )                         \
1095  {                                                         \
1096      decode_uint32_t(pptr,&(x)->bytes_written[i]);         \
1097      decode_uint32_t(pptr,&(x)->write_status_code[i]);     \
1098  }                                                         \
1099} while (0)
1100#endif
1101
1102#define extra_size_PVFS_servresp_mirror \
1103  ( (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) + \
1104    (sizeof(uint32_t) * PVFS_REQ_LIMIT_HANDLES_COUNT) )
1105
1106
1107/* truncate ****************************************************/
1108/* - resizes an existing datafile */
1109
1110struct PVFS_servreq_truncate
1111{
1112    PVFS_handle handle; /* handle of obj to resize */
1113    PVFS_fs_id fs_id;   /* file system */
1114    PVFS_size size;     /* new size */
1115    int32_t flags;      /* future use */
1116
1117};
1118endecode_fields_5_struct(
1119    PVFS_servreq_truncate,
1120    PVFS_handle, handle,
1121    PVFS_fs_id, fs_id,
1122    skip4,,
1123    PVFS_size, size,
1124    int32_t, flags);
1125#define PINT_SERVREQ_TRUNCATE_FILL(__req,  \
1126                                __creds,   \
1127                                __fsid,    \
1128                                __size,    \
1129                                __handle,  \
1130                                __hints)   \
1131do {                                       \
1132    memset(&(__req), 0, sizeof(__req));    \
1133    (__req).op = PVFS_SERV_TRUNCATE;       \
1134    (__req).credentials = (__creds);       \
1135    (__req).hints = (__hints);             \
1136    (__req).u.truncate.fs_id = (__fsid);   \
1137    (__req).u.truncate.size = (__size);    \
1138    (__req).u.truncate.handle = (__handle);\
1139} while (0)
1140
1141/* statfs ****************************************************/
1142/* - retrieves statistics for a particular file system */
1143
1144struct PVFS_servreq_statfs
1145{
1146    PVFS_fs_id fs_id;  /* file system */
1147};
1148endecode_fields_1_struct(
1149    PVFS_servreq_statfs,
1150    PVFS_fs_id, fs_id);
1151
1152#define PINT_SERVREQ_STATFS_FILL(__req, __creds, __fsid,__hints)\
1153do {                                                    \
1154    memset(&(__req), 0, sizeof(__req));                 \
1155    (__req).op = PVFS_SERV_STATFS;                      \
1156    (__req).credentials = (__creds);                    \
1157    (__req).hints = (__hints);                          \
1158    (__req).u.statfs.fs_id = (__fsid);                  \
1159} while (0)
1160
1161struct PVFS_servresp_statfs
1162{
1163    PVFS_statfs stat;
1164};
1165endecode_fields_1_struct(
1166    PVFS_servresp_statfs,
1167    PVFS_statfs, stat);
1168
1169/* io **********************************************************/
1170/* - performs a read or write operation */
1171
1172struct PVFS_servreq_io
1173{
1174    PVFS_handle handle;        /* target datafile */
1175    PVFS_fs_id fs_id;          /* file system */
1176    /* type of I/O operation to perform */
1177    enum PVFS_io_type io_type; /* enum defined in pvfs2-types.h */
1178
1179    /* type of flow protocol to use for I/O transfer */
1180    enum PVFS_flowproto_type flow_type;
1181
1182    /* relative number of this I/O server in distribution */
1183    uint32_t server_nr;
1184    /* total number of I/O servers involved in distribution */
1185    uint32_t server_ct;
1186
1187    /* distribution */
1188    PINT_dist *io_dist;
1189    /* file datatype */
1190    struct PINT_Request * file_req;
1191    /* offset into file datatype */
1192    PVFS_offset file_req_offset;
1193    /* aggregate size of data to transfer */
1194    PVFS_size aggregate_size;
1195};
1196#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1197#define encode_PVFS_servreq_io(pptr,x) do { \
1198    encode_PVFS_handle(pptr, &(x)->handle); \
1199    encode_PVFS_fs_id(pptr, &(x)->fs_id); \
1200    encode_skip4(pptr,); \
1201    encode_enum(pptr, &(x)->io_type); \
1202    encode_enum(pptr, &(x)->flow_type); \
1203    encode_uint32_t(pptr, &(x)->server_nr); \
1204    encode_uint32_t(pptr, &(x)->server_ct); \
1205    encode_PINT_dist(pptr, &(x)->io_dist); \
1206    encode_PINT_Request(pptr, &(x)->file_req); \
1207    encode_PVFS_offset(pptr, &(x)->file_req_offset); \
1208    encode_PVFS_size(pptr, &(x)->aggregate_size); \
1209} while (0)
1210#define decode_PVFS_servreq_io(pptr,x) do { \
1211    decode_PVFS_handle(pptr, &(x)->handle); \
1212    decode_PVFS_fs_id(pptr, &(x)->fs_id); \
1213    decode_skip4(pptr,); \
1214    decode_enum(pptr, &(x)->io_type); \
1215    decode_enum(pptr, &(x)->flow_type); \
1216    decode_uint32_t(pptr, &(x)->server_nr); \
1217    decode_uint32_t(pptr, &(x)->server_ct); \
1218    decode_PINT_dist(pptr, &(x)->io_dist); \
1219    decode_PINT_Request(pptr, &(x)->file_req); \
1220    PINT_request_decode((x)->file_req); /* unpacks the pointers */ \
1221    decode_PVFS_offset(pptr, &(x)->file_req_offset); \
1222    decode_PVFS_size(pptr, &(x)->aggregate_size); \
1223} while (0)
1224/* could be huge, limit to max ioreq size beyond struct itself */
1225#define extra_size_PVFS_servreq_io roundup8(PVFS_REQ_LIMIT_PATH_NAME_BYTES) \
1226  + roundup8(PVFS_REQ_LIMIT_PINT_REQUEST_NUM * sizeof(PINT_Request))
1227#endif
1228
1229#define PINT_SERVREQ_IO_FILL(__req,                   \
1230                             __creds,                 \
1231                             __fsid,                  \
1232                             __handle,                \
1233                             __io_type,               \
1234                             __flow_type,             \
1235                             __datafile_nr,           \
1236                             __datafile_ct,           \
1237                             __io_dist,               \
1238                             __file_req,              \
1239                             __file_req_off,          \
1240                             __aggregate_size,        \
1241                             __hints)                 \
1242do {                                                  \
1243    memset(&(__req), 0, sizeof(__req));               \
1244    (__req).op                 = PVFS_SERV_IO;        \
1245    (__req).credentials        = (__creds);           \
1246    (__req).hints              = (__hints);           \
1247    (__req).u.io.fs_id         = (__fsid);            \
1248    (__req).u.io.handle        = (__handle);          \
1249    (__req).u.io.io_type       = (__io_type);         \
1250    (__req).u.io.flow_type     = (__flow_type);       \
1251    (__req).u.io.server_nr       = (__datafile_nr);   \
1252    (__req).u.io.server_ct     = (__datafile_ct);     \
1253    (__req).u.io.io_dist       = (__io_dist);         \
1254    (__req).u.io.file_req        = (__file_req);      \
1255    (__req).u.io.file_req_offset = (__file_req_off);  \
1256    (__req).u.io.aggregate_size  = (__aggregate_size);\
1257} while (0)
1258
1259struct PVFS_servresp_io
1260{
1261    PVFS_size bstream_size;  /* size of datafile */
1262};
1263endecode_fields_1_struct(
1264    PVFS_servresp_io,
1265    PVFS_size, bstream_size);
1266
1267/* write operations require a second response to announce completion */
1268struct PVFS_servresp_write_completion
1269{
1270    PVFS_size total_completed; /* amount of data transferred */
1271};
1272endecode_fields_1_struct(
1273    PVFS_servresp_write_completion,
1274    PVFS_size, total_completed);
1275
1276#define SMALL_IO_MAX_SEGMENTS 64
1277
1278struct PVFS_servreq_small_io
1279{
1280    PVFS_handle handle;
1281    PVFS_fs_id fs_id;
1282    enum PVFS_io_type io_type;
1283
1284    uint32_t server_nr;
1285    uint32_t server_ct;
1286
1287    PINT_dist * dist;
1288    struct PINT_Request * file_req;
1289    PVFS_offset file_req_offset;
1290    PVFS_size aggregate_size;
1291
1292    /* these are used for writes to map the regions of the memory buffer
1293     * to the contiguous encoded message.  They don't get encoded.
1294     */
1295    int segments;
1296    PVFS_offset offsets[SMALL_IO_MAX_SEGMENTS];
1297    PVFS_size sizes[SMALL_IO_MAX_SEGMENTS];
1298
1299    PVFS_size total_bytes; /* changed from int32_t */
1300    char * buffer;
1301};
1302
1303#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1304#define encode_PVFS_servreq_small_io(pptr,x) do { \
1305    encode_PVFS_handle(pptr, &(x)->handle); \
1306    encode_PVFS_fs_id(pptr, &(x)->fs_id); \
1307    encode_enum(pptr, &(x)->io_type); \
1308    encode_uint32_t(pptr, &(x)->server_nr); \
1309    encode_uint32_t(pptr, &(x)->server_ct); \
1310    encode_PINT_dist(pptr, &(x)->dist); \
1311    encode_PINT_Request(pptr, &(x)->file_req); \
1312    encode_PVFS_offset(pptr, &(x)->file_req_offset); \
1313    encode_PVFS_size(pptr, &(x)->aggregate_size); \
1314    encode_PVFS_size(pptr, &(x)->total_bytes); \
1315    encode_skip4(pptr,); \
1316    if ((x)->io_type == PVFS_IO_WRITE) \
1317    { \
1318        int i = 0; \
1319        for(; i < (x)->segments; ++i) \
1320        { \
1321            memcpy((*pptr), \
1322                   (char *)(x)->buffer + ((x)->offsets[i]), \
1323                   (x)->sizes[i]); \
1324            (*pptr) += (x)->sizes[i]; \
1325        } \
1326    } \
1327} while (0)
1328
1329#define decode_PVFS_servreq_small_io(pptr,x) do { \
1330    decode_PVFS_handle(pptr, &(x)->handle); \
1331    decode_PVFS_fs_id(pptr, &(x)->fs_id); \
1332    decode_enum(pptr, &(x)->io_type); \
1333    decode_uint32_t(pptr, &(x)->server_nr); \
1334    decode_uint32_t(pptr, &(x)->server_ct); \
1335    decode_PINT_dist(pptr, &(x)->dist); \
1336    decode_PINT_Request(pptr, &(x)->file_req); \
1337    PINT_request_decode((x)->file_req); /* unpacks the pointers */ \
1338    decode_PVFS_offset(pptr, &(x)->file_req_offset); \
1339    decode_PVFS_size(pptr, &(x)->aggregate_size); \
1340    decode_PVFS_size(pptr, &(x)->total_bytes); \
1341    decode_skip4(pptr,); \
1342    if ((x)->io_type == PVFS_IO_WRITE) \
1343    { \
1344        /* instead of copying the message we just set the pointer, since \
1345         * we know it will not be freed unil the small io state machine \
1346         * has completed. \
1347         */ \
1348        (x)->buffer = (*pptr); \
1349        (*pptr) += (x)->total_bytes; \
1350    } \
1351} while (0)
1352#endif
1353
1354#define extra_size_PVFS_servreq_small_io PINT_SMALL_IO_MAXSIZE
1355
1356/* could be huge, limit to max ioreq size beyond struct itself */
1357#define PINT_SERVREQ_SMALL_IO_FILL(__req,                                \
1358                                   __creds,                              \
1359                                   __fsid,                               \
1360                                   __handle,                             \
1361                                   __io_type,                            \
1362                                   __dfile_nr,                           \
1363                                   __dfile_ct,                           \
1364                                   __dist,                               \
1365                                   __filereq,                            \
1366                                   __filereq_offset,                     \
1367                                   __segments,                           \
1368                                   __memreq_size,                        \
1369                                   __hints )                             \
1370do {                                                                     \
1371    int _sio_i;                                                          \
1372    (__req).op                                = PVFS_SERV_SMALL_IO;      \
1373    (__req).credentials                       = (__creds);               \
1374    (__req).hints                             = (__hints);               \
1375    (__req).u.small_io.fs_id                  = (__fsid);                \
1376    (__req).u.small_io.handle                 = (__handle);              \
1377    (__req).u.small_io.io_type                = (__io_type);             \
1378    (__req).u.small_io.server_nr              = (__dfile_nr);            \
1379    (__req).u.small_io.server_ct              = (__dfile_ct);            \
1380    (__req).u.small_io.dist                   = (__dist);                \
1381    (__req).u.small_io.file_req               = (__filereq);             \
1382    (__req).u.small_io.file_req_offset        = (__filereq_offset);      \
1383    (__req).u.small_io.aggregate_size         = (__memreq_size);         \
1384    (__req).u.small_io.segments               = (__segments);            \
1385    (__req).u.small_io.total_bytes            = 0;                       \
1386    for(_sio_i = 0; _sio_i < (__segments); ++_sio_i)                     \
1387    {                                                                    \
1388        (__req).u.small_io.total_bytes +=                                \
1389            (__req).u.small_io.sizes[_sio_i];                            \
1390    }                                                                    \
1391} while(0)
1392
1393struct PVFS_servresp_small_io
1394{
1395    enum PVFS_io_type io_type;
1396
1397    /* the io state machine needs the total bstream size to calculate
1398     * the correct return size
1399     */
1400    PVFS_size bstream_size;
1401
1402    /* for writes, this is the amount written. 
1403     * for reads, this is the number of bytes read */
1404    PVFS_size result_size;
1405    char * buffer;
1406};
1407
1408#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1409#define encode_PVFS_servresp_small_io(pptr,x) \
1410    do { \
1411        encode_enum(pptr, &(x)->io_type); \
1412        encode_skip4(pptr,); \
1413        encode_PVFS_size(pptr, &(x)->bstream_size); \
1414        encode_PVFS_size(pptr, &(x)->result_size); \
1415        if((x)->io_type == PVFS_IO_READ && (x)->buffer) \
1416        { \
1417            memcpy((*pptr), (x)->buffer, (x)->result_size); \
1418            (*pptr) += (x)->result_size; \
1419        } \
1420    } while(0)
1421
1422#define decode_PVFS_servresp_small_io(pptr,x) \
1423    do { \
1424        decode_enum(pptr, &(x)->io_type); \
1425        decode_skip4(pptr,); \
1426        decode_PVFS_size(pptr, &(x)->bstream_size); \
1427        decode_PVFS_size(pptr, &(x)->result_size); \
1428        if((x)->io_type == PVFS_IO_READ) \
1429        { \
1430            (x)->buffer = (*pptr); \
1431            (*pptr) += (x)->result_size; \
1432        } \
1433    } while(0)
1434#endif
1435
1436#define extra_size_PVFS_servresp_small_io PINT_SMALL_IO_MAXSIZE
1437
1438/* listattr ****************************************************/
1439/* - retrieves attributes for a list of handles based on mask of PVFS_ATTR_XXX values */
1440
1441struct PVFS_servreq_listattr
1442{
1443    PVFS_fs_id  fs_id;   /* file system */
1444    uint32_t    attrmask;  /* mask of desired attributes */
1445    uint32_t    nhandles; /* number of handles */
1446    PVFS_handle *handles; /* handle of target object */
1447};
1448endecode_fields_3a_struct(
1449    PVFS_servreq_listattr,
1450    PVFS_fs_id, fs_id,
1451    uint32_t, attrmask,
1452    skip4,,
1453    uint32_t, nhandles,
1454    PVFS_handle, handles);
1455#define extra_size_PVFS_servreq_listattr \
1456    (PVFS_REQ_LIMIT_LISTATTR * sizeof(PVFS_handle))
1457
1458#define PINT_SERVREQ_LISTATTR_FILL(__req,   \
1459                                  __creds, \
1460                                  __fsid,  \
1461                                  __amask, \
1462                                  __nhandles, \
1463                                  __handle_array, \
1464                                  __hints) \
1465do {                                       \
1466    memset(&(__req), 0, sizeof(__req));    \
1467    (__req).op = PVFS_SERV_LISTATTR;        \
1468    (__req).credentials = (__creds);       \
1469    (__req).hints = (__hints);             \
1470    (__req).u.listattr.fs_id = (__fsid);    \
1471    (__req).u.listattr.attrmask = (__amask);\
1472    (__req).u.listattr.nhandles = (__nhandles);    \
1473    (__req).u.listattr.handles = (__handle_array); \
1474} while (0)
1475
1476struct PVFS_servresp_listattr
1477{
1478    uint32_t nhandles;
1479    PVFS_error       *error;
1480    PVFS_object_attr *attr;
1481};
1482endecode_fields_1aa_struct(
1483    PVFS_servresp_listattr,
1484    skip4,,
1485    uint32_t, nhandles,
1486    PVFS_error, error,
1487    PVFS_object_attr, attr);
1488#define extra_size_PVFS_servresp_listattr \
1489    ((PVFS_REQ_LIMIT_LISTATTR * sizeof(PVFS_error)) + (PVFS_REQ_LIMIT_LISTATTR * extra_size_PVFS_object_attr))
1490
1491
1492/* mgmt_setparam ****************************************************/
1493/* - management operation for setting runtime parameters */
1494
1495struct PVFS_servreq_mgmt_setparam
1496{
1497    PVFS_fs_id fs_id;             /* file system */
1498    enum PVFS_server_param param; /* parameter to set */
1499    struct PVFS_mgmt_setparam_value value;
1500};
1501endecode_fields_3_struct(
1502    PVFS_servreq_mgmt_setparam,
1503    PVFS_fs_id, fs_id,
1504    enum, param,
1505    PVFS_mgmt_setparam_value, value);
1506
1507#define PINT_SERVREQ_MGMT_SETPARAM_FILL(__req,                   \
1508                                        __creds,                 \
1509                                        __fsid,                  \
1510                                        __param,                 \
1511                                        __value,                 \
1512                                        __hints)                 \
1513do {                                                             \
1514    memset(&(__req), 0, sizeof(__req));                          \
1515    (__req).op = PVFS_SERV_MGMT_SETPARAM;                        \
1516    (__req).credentials = (__creds);                             \
1517    (__req).hints = (__hints);                                   \
1518    (__req).u.mgmt_setparam.fs_id = (__fsid);                    \
1519    (__req).u.mgmt_setparam.param = (__param);                   \
1520    if(__value){                                                 \
1521        (__req).u.mgmt_setparam.value.type = (__value)->type;    \
1522        (__req).u.mgmt_setparam.value.u.value = (__value)->u.value; \
1523    } \
1524} while (0)
1525
1526/* mgmt_noop ********************************************************/
1527/* - does nothing except contact a server to see if it is responding
1528 * to requests
1529 */
1530
1531#define PINT_SERVREQ_MGMT_NOOP_FILL(__req, __creds, __hints)\
1532do {                                               \
1533    memset(&(__req), 0, sizeof(__req));            \
1534    (__req).op = PVFS_SERV_MGMT_NOOP;              \
1535    (__req).credentials = (__creds);               \
1536    (__req).hints = (__hints);                     \
1537} while (0)
1538
1539
1540/* mgmt_perf_mon ****************************************************/
1541/* retrieves performance statistics from server */
1542
1543struct PVFS_servreq_mgmt_perf_mon
1544{
1545    uint32_t next_id;      /* next time stamp id we want to retrieve */
1546    uint32_t key_count;    /* how many counters per measurements we want */
1547    uint32_t count;        /* how many measurements we want */
1548};
1549endecode_fields_3_struct(
1550    PVFS_servreq_mgmt_perf_mon,
1551    uint32_t, next_id,
1552    uint32_t, key_count,
1553    uint32_t, count);
1554
1555#define PINT_SERVREQ_MGMT_PERF_MON_FILL(__req,        \
1556                                        __creds,      \
1557                                        __next_id,    \
1558                                        __key_count,  \
1559                                        __count,      \
1560                                        __hints)      \
1561do {                                                  \
1562    memset(&(__req), 0, sizeof(__req));               \
1563    (__req).op = PVFS_SERV_MGMT_PERF_MON;             \
1564    (__req).credentials = (__creds);                  \
1565    (__req).hints = (__hints);                        \
1566    (__req).u.mgmt_perf_mon.next_id = (__next_id);    \
1567    (__req).u.mgmt_perf_mon.key_count = (__key_count);\
1568    (__req).u.mgmt_perf_mon.count = (__count);        \
1569} while (0)
1570
1571struct PVFS_servresp_mgmt_perf_mon
1572{
1573    int64_t *perf_array;            /* array of statistics */
1574    uint32_t perf_array_count;      /* size of above array */
1575    uint32_t key_count;             /* number of keys in each sample */
1576    uint32_t suggested_next_id;     /* next id to pick up from this point */
1577    uint64_t end_time_ms;           /* end time for final array entry */
1578    uint64_t cur_time_ms;           /* current time according to svr */
1579};
1580endecode_fields_5a_struct(
1581    PVFS_servresp_mgmt_perf_mon,
1582    uint32_t, key_count,
1583    uint32_t, suggested_next_id,
1584    uint64_t, end_time_ms,
1585    uint64_t, cur_time_ms,
1586    skip4,,
1587    uint32_t, perf_array_count,
1588    int64_t,  perf_array);
1589#define extra_size_PVFS_servresp_mgmt_perf_mon \
1590    (PVFS_REQ_LIMIT_IOREQ_BYTES)
1591
1592/* mgmt_iterate_handles ***************************************/
1593/* iterates through handles stored on server */
1594
1595struct PVFS_servreq_mgmt_iterate_handles
1596{
1597    PVFS_fs_id fs_id;
1598    int32_t handle_count;
1599    int32_t flags;
1600    PVFS_ds_position position;
1601};
1602endecode_fields_4_struct(
1603    PVFS_servreq_mgmt_iterate_handles,
1604    PVFS_fs_id, fs_id,
1605    int32_t, handle_count,
1606    int32_t, flags,
1607    PVFS_ds_position, position);
1608
1609#define PINT_SERVREQ_MGMT_ITERATE_HANDLES_FILL(__req,              \
1610                                        __creds,                   \
1611                                        __fs_id,                   \
1612                                        __handle_count,            \
1613                                        __position,                \
1614                                        __flags,                   \
1615                                        __hints)                   \
1616do {                                                               \
1617    memset(&(__req), 0, sizeof(__req));                            \
1618    (__req).op = PVFS_SERV_MGMT_ITERATE_HANDLES;                   \
1619    (__req).credentials = (__creds);                               \
1620    (__req).hints = (__hints);                                     \
1621    (__req).u.mgmt_iterate_handles.fs_id = (__fs_id);              \
1622    (__req).u.mgmt_iterate_handles.handle_count = (__handle_count);\
1623    (__req).u.mgmt_iterate_handles.position = (__position),        \
1624    (__req).u.mgmt_iterate_handles.flags = (__flags);              \
1625} while (0)
1626
1627struct PVFS_servresp_mgmt_iterate_handles
1628{
1629    PVFS_ds_position position;
1630    PVFS_handle *handle_array;
1631    int handle_count;
1632};
1633endecode_fields_2a_struct(
1634    PVFS_servresp_mgmt_iterate_handles,
1635    PVFS_ds_position, position,
1636    skip4,,
1637    int32_t, handle_count,
1638    PVFS_handle, handle_array);
1639#define extra_size_PVFS_servresp_mgmt_iterate_handles \
1640  (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
1641
1642/* mgmt_dspace_info_list **************************************/
1643/* - returns low level dspace information for a list of handles */
1644
1645struct PVFS_servreq_mgmt_dspace_info_list
1646{
1647    PVFS_fs_id fs_id;
1648    PVFS_handle* handle_array;
1649    int32_t handle_count;
1650};
1651endecode_fields_1a_struct(
1652    PVFS_servreq_mgmt_dspace_info_list,
1653    PVFS_fs_id, fs_id,
1654    int32_t, handle_count,
1655    PVFS_handle, handle_array);
1656#define extra_size_PVFS_servreq_mgmt_dspace_info_list \
1657  (PVFS_REQ_LIMIT_HANDLES_COUNT * sizeof(PVFS_handle))
1658
1659#define PINT_SERVREQ_MGMT_DSPACE_INFO_LIST(__req,                   \
1660                                        __creds,                    \
1661                                        __fs_id,                    \
1662                                        __handle_array,             \
1663                                        __handle_count,             \
1664                                        __hints)                    \
1665do {                                                                \
1666    memset(&(__req), 0, sizeof(__req));                             \
1667    (__req).op = PVFS_SERV_MGMT_DSPACE_INFO_LIST;                   \
1668    (__req).credentials = (__creds);                                \
1669    (__req).hints = (__hints);                                      \
1670    (__req).u.mgmt_dspace_info_list.fs_id = (__fs_id);              \
1671    (__req).u.mgmt_dspace_info_list.handle_array = (__handle_array);\
1672    (__req).u.mgmt_dspace_info_list.handle_count = (__handle_count);\
1673} while (0)
1674
1675struct PVFS_servresp_mgmt_dspace_info_list
1676{
1677    struct PVFS_mgmt_dspace_info *dspace_info_array;
1678    int32_t dspace_info_count;
1679};
1680endecode_fields_1a_struct(
1681    PVFS_servresp_mgmt_dspace_info_list,
1682    skip4,,
1683    int32_t, dspace_info_count,
1684    PVFS_mgmt_dspace_info, dspace_info_array);
1685#define extra_size_PVFS_servresp_mgmt_dspace_info_list \
1686   (PVFS_REQ_LIMIT_MGMT_DSPACE_INFO_LIST_COUNT * \
1687    sizeof(struct PVFS_mgmt_dspace_info))
1688
1689/* mgmt_event_mon **************************************/
1690/* - returns event logging data */
1691
1692struct PVFS_servreq_mgmt_event_mon
1693{
1694    uint32_t event_count;
1695};
1696endecode_fields_1_struct(
1697    PVFS_servreq_mgmt_event_mon,
1698    uint32_t, event_count);
1699
1700#define PINT_SERVREQ_MGMT_EVENT_MON_FILL(__req, __creds, __event_count, __hints)\
1701do {                                                                   \
1702    memset(&(__req), 0, sizeof(__req));                                \
1703    (__req).op = PVFS_SERV_MGMT_EVENT_MON;                             \
1704    (__req).credentials = (__creds);                                   \
1705    (__req).hints = (__hints);                                         \
1706    (__req).u.mgmt_event_mon.event_count = (__event_count);            \
1707} while (0)
1708
1709struct PVFS_servresp_mgmt_event_mon
1710{
1711    struct PVFS_mgmt_event* event_array;
1712    uint32_t event_count;
1713};
1714endecode_fields_1a_struct(
1715    PVFS_servresp_mgmt_event_mon,
1716    skip4,,
1717    uint32_t, event_count,
1718    PVFS_mgmt_event, event_array);
1719#define extra_size_PVFS_servresp_mgmt_event_mon \
1720  (PVFS_REQ_LIMIT_MGMT_EVENT_MON_COUNT * \
1721   roundup8(sizeof(struct PVFS_mgmt_event)))
1722
1723/* geteattr ****************************************************/
1724/* - retrieves list of extended attributes */
1725
1726struct PVFS_servreq_geteattr
1727{
1728    PVFS_handle handle;  /* handle of target object */
1729    PVFS_fs_id fs_id;    /* file system */
1730    int32_t nkey;        /* number of keys to read */
1731    PVFS_ds_keyval *key; /* array of keys to read */
1732    PVFS_size *valsz;    /* array of value buffer sizes */
1733};
1734endecode_fields_2aa_struct(
1735    PVFS_servreq_geteattr,
1736    PVFS_handle, handle,
1737    PVFS_fs_id, fs_id,
1738    int32_t, nkey,
1739    PVFS_ds_keyval, key,
1740    PVFS_size, valsz);
1741#define extra_size_PVFS_servreq_geteattr \
1742    ((PVFS_REQ_LIMIT_EATTR_KEY_LEN + sizeof(PVFS_size) \
1743     * PVFS_REQ_LIMIT_EATTR_LIST))
1744
1745#define PINT_SERVREQ_GETEATTR_FILL(__req,   \
1746                                  __creds, \
1747                                  __fsid,  \
1748                                  __handle,\
1749                                  __nkey,\
1750                                  __key_array, \
1751                                  __size_array,\
1752                                  __hints) \
1753do {                                       \
1754    memset(&(__req), 0, sizeof(__req));    \
1755    (__req).op = PVFS_SERV_GETEATTR;       \
1756    (__req).credentials = (__creds);       \
1757    (__req).hints = (__hints);             \
1758    (__req).u.geteattr.fs_id = (__fsid);   \
1759    (__req).u.geteattr.handle = (__handle);\
1760    (__req).u.geteattr.nkey = (__nkey);    \
1761    (__req).u.geteattr.key = (__key_array);\
1762    (__req).u.geteattr.valsz = (__size_array);\
1763} while (0)
1764
1765struct PVFS_servresp_geteattr
1766{
1767    int32_t nkey;           /* number of values returned */
1768    PVFS_ds_keyval *val;    /* array of values returned */
1769    PVFS_error *err;        /* array of error codes */
1770};
1771endecode_fields_1aa_struct(
1772    PVFS_servresp_geteattr,
1773    skip4,,
1774    int32_t, nkey,
1775    PVFS_ds_keyval, val,
1776    PVFS_error, err);
1777#define extra_size_PVFS_servresp_geteattr \
1778    ((PVFS_REQ_LIMIT_EATTR_VAL_LEN + sizeof(PVFS_error)) \
1779     * PVFS_REQ_LIMIT_EATTR_LIST)
1780
1781/* seteattr ****************************************************/
1782/* - sets list of extended attributes */
1783
1784struct PVFS_servreq_seteattr
1785{
1786    PVFS_handle handle;    /* handle of target object */
1787    PVFS_fs_id fs_id;      /* file system */
1788    int32_t    flags;      /* flags */
1789    int32_t    nkey;       /* number of keys and vals */
1790    PVFS_ds_keyval *key;    /* attribute key */
1791    PVFS_ds_keyval *val;    /* attribute value */
1792};
1793endecode_fields_4aa_struct(
1794    PVFS_servreq_seteattr,
1795    PVFS_handle, handle,
1796    PVFS_fs_id, fs_id,
1797    int32_t, flags,
1798    skip4,,
1799    int32_t, nkey,
1800    PVFS_ds_keyval, key,
1801    PVFS_ds_keyval, val);
1802#define extra_size_PVFS_servreq_seteattr \
1803    ((PVFS_REQ_LIMIT_EATTR_KEY_LEN  + PVFS_REQ_LIMIT_EATTR_VAL_LEN) \
1804        * PVFS_REQ_LIMIT_EATTR_LIST)
1805
1806#define PINT_SERVREQ_SETEATTR_FILL(__req,   \
1807                                  __creds,       \
1808                                  __fsid,        \
1809                                  __handle,      \
1810                                  __flags,       \
1811                                  __nkey,        \
1812                                  __key_array,   \
1813                                  __val_array,   \
1814                                  __hints)       \
1815do {                                             \
1816    memset(&(__req), 0, sizeof(__req));          \
1817    (__req).op = PVFS_SERV_SETEATTR;        \
1818    (__req).credentials = (__creds);        \
1819    (__req).hints = (__hints);              \
1820    (__req).u.seteattr.fs_id = (__fsid);    \
1821    (__req).u.seteattr.handle = (__handle); \
1822    (__req).u.seteattr.flags = (__flags);   \
1823    (__req).u.seteattr.nkey = (__nkey);     \
1824    (__req).u.seteattr.key = (__key_array); \
1825    (__req).u.seteattr.val = (__val_array); \
1826} while (0)
1827
1828/* deleattr ****************************************************/
1829/* - deletes extended attributes */
1830
1831struct PVFS_servreq_deleattr
1832{
1833    PVFS_handle handle; /* handle of target object */
1834    PVFS_fs_id fs_id;   /* file system */
1835    PVFS_ds_keyval key; /* key to read */
1836};
1837endecode_fields_3_struct(
1838    PVFS_servreq_deleattr,
1839    PVFS_handle, handle,
1840    PVFS_fs_id, fs_id,
1841    PVFS_ds_keyval, key);
1842#define extra_size_PVFS_servreq_deleattr \
1843    PVFS_REQ_LIMIT_EATTR_KEY_LEN
1844
1845#define PINT_SERVREQ_DELEATTR_FILL(__req,   \
1846                                  __creds, \
1847                                  __fsid,  \
1848                                  __handle,\
1849                                  __key,   \
1850                                  __hints) \
1851do {                                       \
1852    memset(&(__req), 0, sizeof(__req));    \
1853    (__req).op = PVFS_SERV_DELEATTR;        \
1854    (__req).credentials = (__creds);       \
1855    (__req).hints = (__hints);             \
1856    (__req).u.deleattr.fs_id = (__fsid);    \
1857    (__req).u.deleattr.handle = (__handle); \
1858    (__req).u.deleattr.key.buffer_sz = (__key).buffer_sz;\
1859    (__req).u.deleattr.key.buffer = (__key).buffer;\
1860} while (0)
1861
1862/* listeattr **************************************************/
1863/* - list extended attributes */
1864
1865struct PVFS_servreq_listeattr
1866{
1867    PVFS_handle handle;     /* handle of dir object */
1868    PVFS_fs_id  fs_id;      /* file system */
1869    PVFS_ds_position token; /* offset */
1870    uint32_t     nkey;      /* desired number of keys to read */
1871    PVFS_size   *keysz;     /* array of key buffer sizes */
1872};
1873endecode_fields_4a_struct(
1874    PVFS_servreq_listeattr,
1875    PVFS_handle, handle,
1876    PVFS_fs_id, fs_id,
1877    skip4,,
1878    PVFS_ds_position, token,
1879    uint32_t, nkey,
1880    PVFS_size, keysz);
1881#define extra_size_PVFS_servreq_listeattr \
1882    (PVFS_REQ_LIMIT_EATTR_LIST * sizeof(PVFS_size))
1883
1884#define PINT_SERVREQ_LISTEATTR_FILL(__req,            \
1885                                  __creds,            \
1886                                  __fsid,             \
1887                                  __handle,           \
1888                                  __token,            \
1889                                  __nkey,             \
1890                                  __size_array,       \
1891                                  __hints)            \
1892do {                                                  \
1893    memset(&(__req), 0, sizeof(__req));               \
1894    (__req).op = PVFS_SERV_LISTEATTR;                 \
1895    (__req).credentials = (__creds);                  \
1896    (__req).hints = (__hints);                        \
1897    (__req).u.listeattr.fs_id = (__fsid);             \
1898    (__req).u.listeattr.handle = (__handle);          \
1899    (__req).u.listeattr.token = (__token);            \
1900    (__req).u.listeattr.nkey = (__nkey);              \
1901    (__req).u.listeattr.keysz = (__size_array);       \
1902} while (0);
1903
1904struct PVFS_servresp_listeattr
1905{
1906    PVFS_ds_position token;  /* new dir offset */
1907    uint32_t nkey;   /* # of keys retrieved */
1908    PVFS_ds_keyval *key; /* array of keys returned */
1909};
1910endecode_fields_2a_struct(
1911    PVFS_servresp_listeattr,
1912    PVFS_ds_position, token,
1913    skip4,,
1914    uint32_t, nkey,
1915    PVFS_ds_keyval, key);
1916#define extra_size_PVFS_servresp_listeattr \
1917    (PVFS_REQ_LIMIT_EATTR_KEY_LEN * PVFS_REQ_LIMIT_EATTR_LIST)
1918
1919
1920/* server request *********************************************/
1921/* - generic request with union of all op specific structs */
1922
1923struct PVFS_server_req
1924{
1925    enum PVFS_server_op op;
1926    PVFS_credentials credentials;
1927    PVFS_hint hints;
1928
1929    union
1930    {
1931        struct PVFS_servreq_mirror mirror;
1932        struct PVFS_servreq_create create;
1933        struct PVFS_servreq_unstuff unstuff;
1934        struct PVFS_servreq_batch_create batch_create;
1935        struct PVFS_servreq_remove remove;
1936        struct PVFS_servreq_batch_remove batch_remove;
1937        struct PVFS_servreq_io io;
1938        struct PVFS_servreq_getattr getattr;
1939        struct PVFS_servreq_setattr setattr;
1940        struct PVFS_servreq_mkdir mkdir;
1941        struct PVFS_servreq_readdir readdir;
1942        struct PVFS_servreq_lookup_path lookup_path;
1943        struct PVFS_servreq_crdirent crdirent;
1944        struct PVFS_servreq_rmdirent rmdirent;
1945        struct PVFS_servreq_chdirent chdirent;
1946        struct PVFS_servreq_truncate truncate;
1947        struct PVFS_servreq_flush flush;
1948        struct PVFS_servreq_mgmt_setparam mgmt_setparam;
1949        struct PVFS_servreq_statfs statfs;
1950        struct PVFS_servreq_mgmt_perf_mon mgmt_perf_mon;
1951        struct PVFS_servreq_mgmt_iterate_handles mgmt_iterate_handles;
1952        struct PVFS_servreq_mgmt_dspace_info_list mgmt_dspace_info_list;
1953        struct PVFS_servreq_mgmt_event_mon mgmt_event_mon;
1954        struct PVFS_servreq_mgmt_remove_object mgmt_remove_object;
1955        struct PVFS_servreq_mgmt_remove_dirent mgmt_remove_dirent;
1956        struct PVFS_servreq_mgmt_get_dirdata_handle mgmt_get_dirdata_handle;
1957        struct PVFS_servreq_geteattr geteattr;
1958        struct PVFS_servreq_seteattr seteattr;
1959        struct PVFS_servreq_deleattr deleattr;
1960        struct PVFS_servreq_listeattr listeattr;
1961        struct PVFS_servreq_small_io small_io;
1962        struct PVFS_servreq_listattr listattr;
1963        struct PVFS_servreq_tree_remove tree_remove;
1964        struct PVFS_servreq_tree_get_file_size tree_get_file_size;
1965    } u;
1966};
1967#ifdef __PINT_REQPROTO_ENCODE_FUNCS_C
1968/* insert padding to ensure the union starts on an aligned boundary */
1969static inline void
1970encode_PVFS_server_req(char **pptr, const struct PVFS_server_req *x) {
1971    encode_enum(pptr, &x->op);
1972#ifdef HAVE_VALGRIND_H
1973    *(int32_t*) *pptr = 0;  /* else possible memcpy in BMI sees uninit */
1974#endif
1975    *pptr += 4;
1976    encode_PVFS_credentials(pptr, &x->credentials);
1977    encode_PINT_hint(pptr, x->hints);
1978}
1979static inline void
1980decode_PVFS_server_req(char **pptr, struct PVFS_server_req *x) {
1981    decode_enum(pptr, &x->op);
1982    *pptr += 4;
1983    decode_PVFS_credentials(pptr, &x->credentials);
1984    decode_PINT_hint(pptr, &x->hints);
1985}
1986#endif
1987
1988/* server response *********************************************/
1989/* - generic response with union of all op specific structs */
1990struct PVFS_server_resp
1991{
1992    enum PVFS_server_op op;
1993    PVFS_error status;
1994    union
1995    {
1996        struct PVFS_servresp_mirror mirror;
1997        struct PVFS_servresp_create create;
1998        struct PVFS_servresp_unstuff unstuff;
1999        struct PVFS_servresp_batch_create batch_create;
2000        struct PVFS_servresp_getattr getattr;
2001        struct PVFS_servresp_mkdir mkdir;
2002        struct PVFS_servresp_readdir readdir;
2003        struct PVFS_servresp_lookup_path lookup_path;
2004        struct PVFS_servresp_rmdirent rmdirent;
2005        struct PVFS_servresp_chdirent chdirent;
2006        struct PVFS_servresp_getconfig getconfig;
2007        struct PVFS_servresp_io io;
2008        struct PVFS_servresp_write_completion write_completion;
2009        struct PVFS_servresp_statfs statfs;
2010        struct PVFS_servresp_mgmt_perf_mon mgmt_perf_mon;
2011        struct PVFS_servresp_mgmt_iterate_handles mgmt_iterate_handles;
2012        struct PVFS_servresp_mgmt_dspace_info_list mgmt_dspace_info_list;
2013        struct PVFS_servresp_mgmt_event_mon mgmt_event_mon;
2014        struct PVFS_servresp_mgmt_get_dirdata_handle mgmt_get_dirdata_handle;
2015        struct PVFS_servresp_geteattr geteattr;
2016        struct PVFS_servresp_listeattr listeattr;
2017        struct PVFS_servresp_small_io small_io;
2018        struct PVFS_servresp_listattr listattr;
2019        struct PVFS_servresp_tree_get_file_size tree_get_file_size;
2020    } u;
2021};
2022endecode_fields_2_struct(
2023    PVFS_server_resp,
2024    enum, op,
2025    PVFS_error, status);
2026
2027#endif /* __PVFS2_REQ_PROTO_H */
2028
2029/*
2030 * Local variables:
2031 *  c-indent-level: 4
2032 *  c-basic-offset: 4
2033 * End:
2034 *
2035 * vim: ts=8 sts=4 sw=4 expandtab
2036 */
Note: See TracBrowser for help on using the browser.