glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

xdr-common.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #ifndef _XDR_COMMON_H_
12 #define _XDR_COMMON_H_
13 
14 #include <rpc/types.h>
15 #include <sys/types.h>
16 #include <rpc/xdr.h>
17 #include <rpc/auth.h>
18 #include <sys/uio.h>
19 
20 #ifdef __NetBSD__
21 #include <dirent.h>
22 #endif /* __NetBSD__ */
23 
29 };
30 
31 #define GLUSTER_DUMP_PROGRAM 123451501 /* Completely random */
32 #define GLUSTER_DUMP_VERSION 1
33 
34 /* MAX_AUTH_BYTES is restricted to 400 bytes, see
35  * http://tools.ietf.org/html/rfc5531#section-8.2 */
36 #define GF_MAX_AUTH_BYTES MAX_AUTH_BYTES
37 
38 /* The size of an AUTH_GLUSTERFS_V2 structure:
39  *
40  * 1 | pid
41  * 1 | uid
42  * 1 | gid
43  * 1 | groups_len
44  * XX | groups_val (GF_MAX_AUX_GROUPS=65535)
45  * 1 | lk_owner_len
46  * YY | lk_owner_val (GF_MAX_LOCK_OWNER_LEN=1024)
47  * ----+-------------------------------------------
48  * 5 | total xdr-units
49  *
50  * one XDR-unit is defined as BYTES_PER_XDR_UNIT = 4 bytes
51  * MAX_AUTH_BYTES = 400 is the maximum, this is 100 xdr-units.
52  * XX + YY can be 95 to fill the 100 xdr-units.
53  *
54  * Note that the on-wire protocol has tighter requirements than the internal
55  * structures. It is possible for xlators to use more groups and a bigger
56  * lk_owner than that can be sent by a GlusterFS-client.
57  *
58  * -------
59  * On v3, there are 4 more units, and hence it will be 9 xdr-units
60  */
61 #define GF_AUTH_GLUSTERFS_MAX_GROUPS(lk_len, type) \
62  ((type == AUTH_GLUSTERFS_v2) ? (95 - lk_len) : (91 - lk_len))
63 #define GF_AUTH_GLUSTERFS_MAX_LKOWNER(groups_len, type) \
64  ((type == AUTH_GLUSTERFS_v2) ? (95 - groups_len) : (91 - groups_len))
65 
66 #ifdef GF_LINUX_HOST_OS
67 #define xdr_u_int32_t xdr_uint32_t
68 #define xdr_u_int64_t xdr_uint64_t
69 unsigned long
70 xdr_sizeof(xdrproc_t func, void *data);
71 #endif
72 
73 #ifdef GF_DARWIN_HOST_OS
74 #define xdr_u_quad_t xdr_u_int64_t
75 #define xdr_quad_t xdr_int64_t
76 #define xdr_uint32_t xdr_u_int32_t
77 #define xdr_uint64_t xdr_u_int64_t
78 #define uint64_t u_int64_t
79 unsigned long
80 xdr_sizeof(xdrproc_t func, void *data);
81 #endif
82 
83 #if defined(__NetBSD__)
84 #define xdr_u_quad_t xdr_u_int64_t
85 #define xdr_quad_t xdr_int64_t
86 #define xdr_uint32_t xdr_u_int32_t
87 #define xdr_uint64_t xdr_u_int64_t
88 #endif
89 
90 #ifdef GF_SOLARIS_HOST_OS
91 #define u_quad_t uint64_t
92 #define quad_t int64_t
93 #define xdr_u_quad_t xdr_uint64_t
94 #define xdr_quad_t xdr_int64_t
95 #endif
96 
97 /* Returns the address of the byte that follows the
98  * last byte used for decoding the previous xdr component.
99  * E.g. once the RPC call for NFS has been decoded, the macro will return
100  * the address from which the NFS header starts.
101  */
102 #define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private)
103 
104 /* Returns the length of the remaining record after the previous decode
105  * operation completed.
106  */
107 #define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy)
108 
109 /* Returns the number of bytes used by the last encode operation. */
110 #define xdr_encoded_length(xdr) \
111  (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base))
112 
113 #define xdr_decoded_length(xdr) \
114  (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base))
115 
116 #endif
GF_DUMP_PING
@ GF_DUMP_PING
Definition: xdr-common.h:27
GF_DUMP_NULL
@ GF_DUMP_NULL
Definition: xdr-common.h:25
GF_DUMP_MAXVALUE
@ GF_DUMP_MAXVALUE
Definition: xdr-common.h:28
GF_DUMP_DUMP
@ GF_DUMP_DUMP
Definition: xdr-common.h:26
gf_dump_procnum
gf_dump_procnum
Definition: xdr-common.h:24