diff options
Diffstat (limited to 'xlators/protocol/lib/src')
-rw-r--r-- | xlators/protocol/lib/src/Makefile.am | 11 | ||||
-rw-r--r-- | xlators/protocol/lib/src/authenticate.c | 40 | ||||
-rw-r--r-- | xlators/protocol/lib/src/authenticate.h | 6 | ||||
-rw-r--r-- | xlators/protocol/lib/src/glusterfs-xdr.c | 1847 | ||||
-rw-r--r-- | xlators/protocol/lib/src/glusterfs-xdr.h | 1337 | ||||
-rw-r--r-- | xlators/protocol/lib/src/glusterfs3.x | 755 | ||||
-rw-r--r-- | xlators/protocol/lib/src/msg-xdr.c | 1264 | ||||
-rw-r--r-- | xlators/protocol/lib/src/msg-xdr.h | 536 | ||||
-rw-r--r-- | xlators/protocol/lib/src/protocol-common.c | 109 | ||||
-rw-r--r-- | xlators/protocol/lib/src/protocol-common.h | 104 |
10 files changed, 5981 insertions, 28 deletions
diff --git a/xlators/protocol/lib/src/Makefile.am b/xlators/protocol/lib/src/Makefile.am index 6e0b5c4e0c4..ece59ef905a 100644 --- a/xlators/protocol/lib/src/Makefile.am +++ b/xlators/protocol/lib/src/Makefile.am @@ -3,12 +3,13 @@ lib_LTLIBRARIES = libgfproto1.la libgfproto1_la_CFLAGS = -fPIC -Wall -g -shared -nostartfiles $(GF_CFLAGS) $(GF_DARWIN_LIBGLUSTERFS_CFLAGS) libgfproto1_la_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D__USE_FILE_OFFSET64 -D_GNU_SOURCE \ - -D$(GF_HOST_OS) -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ - -DTRANSPORTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/transport\" \ - -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/libglusterfs/src/ + -D$(GF_HOST_OS) -DLIBDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/auth\" \ + -DTRANSPORTDIR=\"$(libdir)/glusterfs/$(PACKAGE_VERSION)/transport\" \ + -I$(CONTRIBDIR)/rbtree -I$(top_srcdir)/libglusterfs/src/ \ + -I$(top_srcdir)/xlators/protocol/rpc/rpc-lib/src/ libgfproto1_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la -libgfproto1_la_SOURCES = authenticate.c +libgfproto1_la_SOURCES = authenticate.c protocol-common.c msg-xdr.c glusterfs-xdr.c -noinst_HEADERS = authenticate.h +noinst_HEADERS = authenticate.h protocol-common.h msg-xdr.h glusterfs-xdr.h diff --git a/xlators/protocol/lib/src/authenticate.c b/xlators/protocol/lib/src/authenticate.c index ff2b58162b7..5205b54df61 100644 --- a/xlators/protocol/lib/src/authenticate.c +++ b/xlators/protocol/lib/src/authenticate.c @@ -1,5 +1,5 @@ /* - Copyright (c) 2007-2009 Gluster, Inc. <http://www.gluster.com> + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> This file is part of GlusterFS. GlusterFS is free software; you can redistribute it and/or modify @@ -68,7 +68,7 @@ init (dict_t *this, handle = dlopen (auth_file, RTLD_LAZY); if (!handle) { - gf_log ("authenticate", GF_LOG_ERROR, "dlopen(%s): %s\n", + gf_log ("authenticate", GF_LOG_ERROR, "dlopen(%s): %s\n", auth_file, dlerror ()); dict_set (this, key, data_from_dynptr (NULL, 0)); GF_FREE (auth_file); @@ -76,7 +76,7 @@ init (dict_t *this, return; } GF_FREE (auth_file); - + authenticate = dlsym (handle, "gf_auth"); if (!authenticate) { gf_log ("authenticate", GF_LOG_ERROR, @@ -100,12 +100,12 @@ init (dict_t *this, if (auth_handle->vol_opt->given_opt == NULL) { gf_log ("authenticate", GF_LOG_DEBUG, "volume option validation not specified"); - } + } auth_handle->authenticate = authenticate; auth_handle->handle = handle; - dict_set (this, key, + dict_set (this, key, data_from_dynptr (auth_handle, sizeof (*auth_handle))); } @@ -133,10 +133,10 @@ gf_auth_init (xlator_t *xl, dict_t *auth_modules) while (pair) { handle = data_to_ptr (pair->value); if (handle) { - list_add_tail (&(handle->vol_opt->list), + list_add_tail (&(handle->vol_opt->list), &(xl->volume_options)); - if (-1 == - validate_xlator_volume_options (xl, + if (-1 == + validate_xlator_volume_options (xl, handle->vol_opt->given_opt)) { gf_log ("authenticate", GF_LOG_ERROR, "volume option validation " @@ -158,7 +158,7 @@ gf_auth_init (xlator_t *xl, dict_t *auth_modules) static dict_t *__input_params; static dict_t *__config_params; -void +void map (dict_t *this, char *key, data_t *value, @@ -168,17 +168,17 @@ map (dict_t *this, auth_fn_t authenticate; auth_handle_t *handle = NULL; - if (value && (handle = data_to_ptr (value)) && + if (value && (handle = data_to_ptr (value)) && (authenticate = handle->authenticate)) { - dict_set (res, key, - int_to_data (authenticate (__input_params, + dict_set (res, key, + int_to_data (authenticate (__input_params, __config_params))); } else { dict_set (res, key, int_to_data (AUTH_DONT_CARE)); } } -void +void reduce (dict_t *this, char *key, data_t *value, @@ -206,11 +206,11 @@ reduce (dict_t *this, } } - -auth_result_t -gf_authenticate (dict_t *input_params, - dict_t *config_params, - dict_t *auth_modules) + +auth_result_t +gf_authenticate (dict_t *input_params, + dict_t *config_params, + dict_t *auth_modules) { dict_t *results = NULL; int64_t result = AUTH_DONT_CARE; @@ -235,12 +235,12 @@ gf_authenticate (dict_t *input_params, "accepting remote-client %s", name); result = AUTH_REJECT; } - + dict_destroy (results); return result; } -void +void gf_auth_fini (dict_t *auth_modules) { int32_t dummy; diff --git a/xlators/protocol/lib/src/authenticate.h b/xlators/protocol/lib/src/authenticate.h index e777146524c..93d73741b0a 100644 --- a/xlators/protocol/lib/src/authenticate.h +++ b/xlators/protocol/lib/src/authenticate.h @@ -42,7 +42,7 @@ typedef enum { AUTH_DONT_CARE } auth_result_t; -typedef auth_result_t (*auth_fn_t) (dict_t *input_params, +typedef auth_result_t (*auth_fn_t) (dict_t *input_params, dict_t *config_params); typedef struct { @@ -51,8 +51,8 @@ typedef struct { volume_opt_list_t *vol_opt; } auth_handle_t; -auth_result_t gf_authenticate (dict_t *input_params, - dict_t *config_params, +auth_result_t gf_authenticate (dict_t *input_params, + dict_t *config_params, dict_t *auth_modules); int32_t gf_auth_init (xlator_t *xl, dict_t *auth_modules); void gf_auth_fini (dict_t *auth_modules); diff --git a/xlators/protocol/lib/src/glusterfs-xdr.c b/xlators/protocol/lib/src/glusterfs-xdr.c new file mode 100644 index 00000000000..2eccff29c6e --- /dev/null +++ b/xlators/protocol/lib/src/glusterfs-xdr.c @@ -0,0 +1,1847 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#include "glusterfs-xdr.h" +#include "iatt.h" + +bool_t +xdr_gf_statfs (XDR *xdrs, gf_statfs *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->bsize)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->frsize)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->blocks)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->bfree)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->bavail)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->files)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ffree)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->favail)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->fsid)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->flag)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->namemax)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_flock (XDR *xdrs, gf_flock *objp) +{ + + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->whence)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->start)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->len)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_iatt (XDR *xdrs, gf_iatt *objp) +{ + register int32_t *buf; + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_u_quad_t (xdrs, &objp->ia_ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_gen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_dev)) + return FALSE; + buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_nlink)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_gid)) + return FALSE; + + } else { + IXDR_PUT_U_LONG(buf, objp->mode); + IXDR_PUT_U_LONG(buf, objp->ia_nlink); + IXDR_PUT_U_LONG(buf, objp->ia_uid); + IXDR_PUT_U_LONG(buf, objp->ia_gid); + } + if (!xdr_u_quad_t (xdrs, &objp->ia_rdev)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_size)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_blksize)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_blocks)) + return FALSE; + buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->ia_atime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_atime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime_nsec)) + return FALSE; + } else { + IXDR_PUT_U_LONG(buf, objp->ia_atime); + IXDR_PUT_U_LONG(buf, objp->ia_atime_nsec); + IXDR_PUT_U_LONG(buf, objp->ia_mtime); + IXDR_PUT_U_LONG(buf, objp->ia_mtime_nsec); + IXDR_PUT_U_LONG(buf, objp->ia_ctime); + IXDR_PUT_U_LONG(buf, objp->ia_ctime_nsec); + } + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_u_quad_t (xdrs, &objp->ia_ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_gen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_dev)) + return FALSE; + buf = XDR_INLINE (xdrs, 4 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_nlink)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_gid)) + return FALSE; + + } else { + objp->mode = IXDR_GET_U_LONG(buf); + objp->ia_nlink = IXDR_GET_U_LONG(buf); + objp->ia_uid = IXDR_GET_U_LONG(buf); + objp->ia_gid = IXDR_GET_U_LONG(buf); + } + if (!xdr_u_quad_t (xdrs, &objp->ia_rdev)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_size)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_blksize)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_blocks)) + return FALSE; + buf = XDR_INLINE (xdrs, 6 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->ia_atime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_atime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime_nsec)) + return FALSE; + } else { + objp->ia_atime = IXDR_GET_U_LONG(buf); + objp->ia_atime_nsec = IXDR_GET_U_LONG(buf); + objp->ia_mtime = IXDR_GET_U_LONG(buf); + objp->ia_mtime_nsec = IXDR_GET_U_LONG(buf); + objp->ia_ctime = IXDR_GET_U_LONG(buf); + objp->ia_ctime_nsec = IXDR_GET_U_LONG(buf); + } + return TRUE; + } + + if (!xdr_u_quad_t (xdrs, &objp->ia_ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_gen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_dev)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_nlink)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_gid)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_rdev)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_size)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_blksize)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ia_blocks)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_atime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_atime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_mtime_nsec)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ia_ctime_nsec)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_stat_req (XDR *xdrs, gfs3_stat_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_stat_rsp (XDR *xdrs, gfs3_stat_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readlink_req (XDR *xdrs, gfs3_readlink_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readlink_rsp (XDR *xdrs, gfs3_readlink_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->buf)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_mknod_req (XDR *xdrs, gfs3_mknod_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->dev)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_mknod_rsp (XDR *xdrs, gfs3_mknod_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_mkdir_req (XDR *xdrs, gfs3_mkdir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_mkdir_rsp (XDR *xdrs, gfs3_mkdir_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_unlink_req (XDR *xdrs, gfs3_unlink_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_unlink_rsp (XDR *xdrs, gfs3_unlink_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rmdir_req (XDR *xdrs, gfs3_rmdir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rmdir_rsp (XDR *xdrs, gfs3_rmdir_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_symlink_req (XDR *xdrs, gfs3_symlink_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->linkname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_symlink_rsp (XDR *xdrs, gfs3_symlink_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rename_req (XDR *xdrs, gfs3_rename_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->oldpar)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->oldgen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->newpar)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->newgen)) + return FALSE; + if (!xdr_string (xdrs, &objp->oldpath, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->oldbname, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->newpath, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->newbname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rename_rsp (XDR *xdrs, gfs3_rename_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preoldparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postoldparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->prenewparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postnewparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_link_req (XDR *xdrs, gfs3_link_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->oldino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->oldgen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->newpar)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->newgen)) + return FALSE; + if (!xdr_string (xdrs, &objp->oldpath, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->newpath, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->newbname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_link_rsp (XDR *xdrs, gfs3_link_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_truncate_req (XDR *xdrs, gfs3_truncate_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_truncate_rsp (XDR *xdrs, gfs3_truncate_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->prestat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->poststat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_open_req (XDR *xdrs, gfs3_open_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->wbflags)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_open_rsp (XDR *xdrs, gfs3_open_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_read_req (XDR *xdrs, gfs3_read_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_read_rsp (XDR *xdrs, gfs3_read_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + + return TRUE; +} + +bool_t +xdr_gfs3_lookup_req (XDR *xdrs, gfs3_lookup_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, + (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_lookup_rsp (XDR *xdrs, gfs3_lookup_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, + (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_write_req (XDR *xdrs, gfs3_write_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_write_rsp (XDR *xdrs, gfs3_write_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->prestat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->poststat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_statfs_req (XDR *xdrs, gfs3_statfs_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_statfs_rsp (XDR *xdrs, gfs3_statfs_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_statfs (xdrs, &objp->statfs)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_lk_req (XDR *xdrs, gfs3_lk_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_gf_flock (xdrs, &objp->flock)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_lk_rsp (XDR *xdrs, gfs3_lk_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_flock (xdrs, &objp->flock)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_inodelk_req (XDR *xdrs, gfs3_inodelk_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_gf_flock (xdrs, &objp->flock)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->volume, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_finodelk_req (XDR *xdrs, gfs3_finodelk_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_gf_flock (xdrs, &objp->flock)) + return FALSE; + if (!xdr_string (xdrs, &objp->volume, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_flush_req (XDR *xdrs, gfs3_flush_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsync_req (XDR *xdrs, gfs3_fsync_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsync_rsp (XDR *xdrs, gfs3_fsync_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->prestat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->poststat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_setxattr_req (XDR *xdrs, gfs3_setxattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsetxattr_req (XDR *xdrs, gfs3_fsetxattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_xattrop_req (XDR *xdrs, gfs3_xattrop_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_xattrop_rsp (XDR *xdrs, gfs3_xattrop_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fxattrop_req (XDR *xdrs, gfs3_fxattrop_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fxattrop_rsp (XDR *xdrs, gfs3_fxattrop_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_getxattr_req (XDR *xdrs, gfs3_getxattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->namelen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_getxattr_rsp (XDR *xdrs, gfs3_getxattr_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fgetxattr_req (XDR *xdrs, gfs3_fgetxattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->namelen)) + return FALSE; + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fgetxattr_rsp (XDR *xdrs, gfs3_fgetxattr_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_removexattr_req (XDR *xdrs, gfs3_removexattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_opendir_req (XDR *xdrs, gfs3_opendir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_opendir_rsp (XDR *xdrs, gfs3_opendir_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsyncdir_req (XDR *xdrs, gfs3_fsyncdir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_int (xdrs, &objp->data)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readdir_req (XDR *xdrs, gfs3_readdir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readdir_rsp (XDR *xdrs, gfs3_readdir_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readdirp_req (XDR *xdrs, gfs3_readdirp_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->size)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_readdirp_rsp (XDR *xdrs, gfs3_readdirp_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_setvolume_req (XDR *xdrs, gf_setvolume_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_setvolume_rsp (XDR *xdrs, gf_setvolume_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val, (u_int *) &objp->dict.dict_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_access_req (XDR *xdrs, gfs3_access_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mask)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_create_req (XDR *xdrs, gfs3_create_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->par)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->mode)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->bname, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_create_rsp (XDR *xdrs, gfs3_create_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->preparent)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->postparent)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_ftruncate_req (XDR *xdrs, gfs3_ftruncate_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_ftruncate_rsp (XDR *xdrs, gfs3_ftruncate_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->prestat)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->poststat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fstat_req (XDR *xdrs, gfs3_fstat_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fstat_rsp (XDR *xdrs, gfs3_fstat_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stat)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_entrylk_req (XDR *xdrs, gfs3_entrylk_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->namelen)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->volume, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fentrylk_req (XDR *xdrs, gfs3_fentrylk_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->cmd)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->type)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->namelen)) + return FALSE; + if (!xdr_string (xdrs, &objp->name, ~0)) + return FALSE; + if (!xdr_string (xdrs, &objp->volume, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_checksum_req (XDR *xdrs, gfs3_checksum_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flag)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_checksum_rsp (XDR *xdrs, gfs3_checksum_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->fchecksum.fchecksum_val, (u_int *) &objp->fchecksum.fchecksum_len, ~0)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->dchecksum.dchecksum_val, (u_int *) &objp->dchecksum.dchecksum_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_setattr_req (XDR *xdrs, gfs3_setattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stbuf)) + return FALSE; + if (!xdr_int (xdrs, &objp->valid)) + return FALSE; + if (!xdr_string (xdrs, &objp->path, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_setattr_rsp (XDR *xdrs, gfs3_setattr_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpre)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpost)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsetattr_req (XDR *xdrs, gfs3_fsetattr_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->stbuf)) + return FALSE; + if (!xdr_int (xdrs, &objp->valid)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_fsetattr_rsp (XDR *xdrs, gfs3_fsetattr_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpre)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpost)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rchecksum_req (XDR *xdrs, gfs3_rchecksum_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->len)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_rchecksum_rsp (XDR *xdrs, gfs3_rchecksum_rsp *objp) +{ + register int32_t *buf; + + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->weak_checksum)) + return FALSE; + + } else { + IXDR_PUT_LONG(buf, objp->op_ret); + IXDR_PUT_LONG(buf, objp->op_errno); + IXDR_PUT_U_LONG(buf, objp->weak_checksum); + } + if (!xdr_bytes (xdrs, (char **)&objp->strong_checksum.strong_checksum_val, (u_int *) &objp->strong_checksum.strong_checksum_len, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->weak_checksum)) + return FALSE; + + } else { + objp->op_ret = IXDR_GET_LONG(buf); + objp->op_errno = IXDR_GET_LONG(buf); + objp->weak_checksum = IXDR_GET_U_LONG(buf); + } + if (!xdr_bytes (xdrs, (char **)&objp->strong_checksum.strong_checksum_val, (u_int *) &objp->strong_checksum.strong_checksum_len, ~0)) + return FALSE; + return TRUE; + } + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->weak_checksum)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->strong_checksum.strong_checksum_val, (u_int *) &objp->strong_checksum.strong_checksum_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_getspec_req (XDR *xdrs, gf_getspec_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_string (xdrs, &objp->key, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_getspec_rsp (XDR *xdrs, gf_getspec_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_string (xdrs, &objp->spec, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_log_req (XDR *xdrs, gf_log_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->msg.msg_val, (u_int *) &objp->msg.msg_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_notify_req (XDR *xdrs, gf_notify_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_string (xdrs, &objp->buf, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_notify_rsp (XDR *xdrs, gf_notify_rsp *objp) +{ + register int32_t *buf; + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + + } else { + IXDR_PUT_LONG(buf, objp->op_ret); + IXDR_PUT_LONG(buf, objp->op_errno); + IXDR_PUT_U_LONG(buf, objp->flags); + } + if (!xdr_string (xdrs, &objp->buf, ~0)) + return FALSE; + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + buf = XDR_INLINE (xdrs, 3 * BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + + } else { + objp->op_ret = IXDR_GET_LONG(buf); + objp->op_errno = IXDR_GET_LONG(buf); + objp->flags = IXDR_GET_U_LONG(buf); + } + if (!xdr_string (xdrs, &objp->buf, ~0)) + return FALSE; + return TRUE; + } + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_string (xdrs, &objp->buf, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_releasedir_req (XDR *xdrs, gfs3_releasedir_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gfs3_release_req (XDR *xdrs, gfs3_release_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->ino)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->gen)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_common_rsp (XDR *xdrs, gf_common_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + return TRUE; +} + + +bool_t +xdr_gf_dump_version_req (XDR *xdrs, gf_dump_version_req *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_string (xdrs, &objp->key, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_gf_dump_version_rsp (XDR *xdrs, gf_dump_version_rsp *objp) +{ + + if (!xdr_u_quad_t (xdrs, &objp->gfs_id)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->flags)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->msg.msg_val, (u_int *) &objp->msg.msg_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t +xdr_auth_glusterfs_parms (XDR *xdrs, auth_glusterfs_parms *objp) +{ + register int32_t *buf; + + int i; + + if (xdrs->x_op == XDR_ENCODE) { + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + buf = XDR_INLINE (xdrs, (4 + 16 )* BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + } else { + IXDR_PUT_U_LONG(buf, objp->pid); + IXDR_PUT_U_LONG(buf, objp->uid); + IXDR_PUT_U_LONG(buf, objp->gid); + IXDR_PUT_U_LONG(buf, objp->ngrps); + { + register u_int *genp; + + for (i = 0, genp = objp->groups; + i < 16; ++i) { + IXDR_PUT_U_LONG(buf, *genp++); + } + } + } + return TRUE; + } else if (xdrs->x_op == XDR_DECODE) { + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + buf = XDR_INLINE (xdrs, (4 + 16 )* BYTES_PER_XDR_UNIT); + if (buf == NULL) { + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + } else { + objp->pid = IXDR_GET_U_LONG(buf); + objp->uid = IXDR_GET_U_LONG(buf); + objp->gid = IXDR_GET_U_LONG(buf); + objp->ngrps = IXDR_GET_U_LONG(buf); + { + register u_int *genp; + + for (i = 0, genp = objp->groups; + i < 16; ++i) { + *genp++ = IXDR_GET_U_LONG(buf); + } + } + } + return TRUE; + } + + if (!xdr_u_quad_t (xdrs, &objp->lk_owner)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->pid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->uid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->gid)) + return FALSE; + if (!xdr_u_int (xdrs, &objp->ngrps)) + return FALSE; + if (!xdr_vector (xdrs, (char *)objp->groups, 16, + sizeof (u_int), (xdrproc_t) xdr_u_int)) + return FALSE; + return TRUE; +} diff --git a/xlators/protocol/lib/src/glusterfs-xdr.h b/xlators/protocol/lib/src/glusterfs-xdr.h new file mode 100644 index 00000000000..3fb6d0bd355 --- /dev/null +++ b/xlators/protocol/lib/src/glusterfs-xdr.h @@ -0,0 +1,1337 @@ +/* + * Please do not edit this file. + * It was generated using rpcgen. + */ + +#ifndef _GLUSTERFS3_H_RPCGEN +#define _GLUSTERFS3_H_RPCGEN + +#include <rpc/rpc.h> +#include "iatt.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define GF_O_ACCMODE 003 +#define GF_O_RDONLY 00 +#define GF_O_WRONLY 01 +#define GF_O_RDWR 02 +#define GF_O_CREAT 0100 +#define GF_O_EXCL 0200 +#define GF_O_NOCTTY 0400 +#define GF_O_TRUNC 01000 +#define GF_O_APPEND 02000 +#define GF_O_NONBLOCK 04000 +#define GF_O_SYNC 010000 +#define GF_O_ASYNC 020000 + +#define GF_O_DIRECT 040000 +#define GF_O_DIRECTORY 0200000 +#define GF_O_NOFOLLOW 0400000 +#define GF_O_NOATIME 01000000 +#define GF_O_CLOEXEC 02000000 + +#define GF_O_LARGEFILE 0100000 + +#define XLATE_BIT(from, to, bit) do { \ + if (from & bit) \ + to = to | GF_##bit; \ + } while (0) + +#define UNXLATE_BIT(from, to, bit) do { \ + if (from & GF_##bit) \ + to = to | bit; \ + } while (0) + +#define XLATE_ACCESSMODE(from, to) do { \ + switch (from & O_ACCMODE) { \ + case O_RDONLY: to |= GF_O_RDONLY; \ + break; \ + case O_WRONLY: to |= GF_O_WRONLY; \ + break; \ + case O_RDWR: to |= GF_O_RDWR; \ + break; \ + } \ + } while (0) + +#define UNXLATE_ACCESSMODE(from, to) do { \ + switch (from & GF_O_ACCMODE) { \ + case GF_O_RDONLY: to |= O_RDONLY; \ + break; \ + case GF_O_WRONLY: to |= O_WRONLY; \ + break; \ + case GF_O_RDWR: to |= O_RDWR; \ + break; \ + } \ + } while (0) + +static inline uint32_t +gf_flags_from_flags (uint32_t flags) +{ + uint32_t gf_flags = 0; + + XLATE_ACCESSMODE (flags, gf_flags); + + XLATE_BIT (flags, gf_flags, O_CREAT); + XLATE_BIT (flags, gf_flags, O_EXCL); + XLATE_BIT (flags, gf_flags, O_NOCTTY); + XLATE_BIT (flags, gf_flags, O_TRUNC); + XLATE_BIT (flags, gf_flags, O_APPEND); + XLATE_BIT (flags, gf_flags, O_NONBLOCK); + XLATE_BIT (flags, gf_flags, O_SYNC); + XLATE_BIT (flags, gf_flags, O_ASYNC); + + XLATE_BIT (flags, gf_flags, O_DIRECT); + XLATE_BIT (flags, gf_flags, O_DIRECTORY); + XLATE_BIT (flags, gf_flags, O_NOFOLLOW); +#ifdef O_NOATIME + XLATE_BIT (flags, gf_flags, O_NOATIME); +#endif +#ifdef O_CLOEXEC + XLATE_BIT (flags, gf_flags, O_CLOEXEC); +#endif + XLATE_BIT (flags, gf_flags, O_LARGEFILE); + + return gf_flags; +} + +static inline uint32_t +gf_flags_to_flags (uint32_t gf_flags) +{ + uint32_t flags = 0; + + UNXLATE_ACCESSMODE (gf_flags, flags); + + UNXLATE_BIT (gf_flags, flags, O_CREAT); + UNXLATE_BIT (gf_flags, flags, O_EXCL); + UNXLATE_BIT (gf_flags, flags, O_NOCTTY); + UNXLATE_BIT (gf_flags, flags, O_TRUNC); + UNXLATE_BIT (gf_flags, flags, O_APPEND); + UNXLATE_BIT (gf_flags, flags, O_NONBLOCK); + UNXLATE_BIT (gf_flags, flags, O_SYNC); + UNXLATE_BIT (gf_flags, flags, O_ASYNC); + + UNXLATE_BIT (gf_flags, flags, O_DIRECT); + UNXLATE_BIT (gf_flags, flags, O_DIRECTORY); + UNXLATE_BIT (gf_flags, flags, O_NOFOLLOW); +#ifdef O_NOATIME + UNXLATE_BIT (gf_flags, flags, O_NOATIME); +#endif +#ifdef O_CLOEXEC + UNXLATE_BIT (gf_flags, flags, O_CLOEXEC); +#endif + UNXLATE_BIT (gf_flags, flags, O_LARGEFILE); + + return flags; +} + + +struct gf_statfs { + u_quad_t bsize; + u_quad_t frsize; + u_quad_t blocks; + u_quad_t bfree; + u_quad_t bavail; + u_quad_t files; + u_quad_t ffree; + u_quad_t favail; + u_quad_t fsid; + u_quad_t flag; + u_quad_t namemax; +}; +typedef struct gf_statfs gf_statfs; + +static inline void +gf_statfs_to_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +{ + if (!stat || !gf_stat) + return; + + stat->f_bsize = (gf_stat->bsize); + stat->f_frsize = (gf_stat->frsize); + stat->f_blocks = (gf_stat->blocks); + stat->f_bfree = (gf_stat->bfree); + stat->f_bavail = (gf_stat->bavail); + stat->f_files = (gf_stat->files); + stat->f_ffree = (gf_stat->ffree); + stat->f_favail = (gf_stat->favail); + stat->f_fsid = (gf_stat->fsid); + stat->f_flag = (gf_stat->flag); + stat->f_namemax = (gf_stat->namemax); +} + + +static inline void +gf_statfs_from_statfs (struct gf_statfs *gf_stat, struct statvfs *stat) +{ + if (!stat || !gf_stat) + return; + + gf_stat->bsize = stat->f_bsize; + gf_stat->frsize = stat->f_frsize; + gf_stat->blocks = stat->f_blocks; + gf_stat->bfree = stat->f_bfree; + gf_stat->bavail = stat->f_bavail; + gf_stat->files = stat->f_files; + gf_stat->ffree = stat->f_ffree; + gf_stat->favail = stat->f_favail; + gf_stat->fsid = stat->f_fsid; + gf_stat->flag = stat->f_flag; + gf_stat->namemax = stat->f_namemax; +} + +struct gf_flock { + u_int type; + u_int whence; + u_quad_t start; + u_quad_t len; + u_int pid; +}; +typedef struct gf_flock gf_flock; + + +static inline void +gf_flock_to_flock (struct gf_flock *gf_flock, struct flock *flock) +{ + if (!flock || !gf_flock) + return; + + flock->l_type = gf_flock->type; + flock->l_whence = gf_flock->whence; + flock->l_start = gf_flock->start; + flock->l_len = gf_flock->len; + flock->l_pid = gf_flock->pid; +} + + +static inline void +gf_flock_from_flock (struct gf_flock *gf_flock, struct flock *flock) +{ + if (!flock || !gf_flock) + return; + + gf_flock->type = (flock->l_type); + gf_flock->whence = (flock->l_whence); + gf_flock->start = (flock->l_start); + gf_flock->len = (flock->l_len); + gf_flock->pid = (flock->l_pid); +} + +struct gf_iatt { + u_quad_t ia_ino; + u_quad_t ia_gen; + u_quad_t ia_dev; + u_int mode; + u_int ia_nlink; + u_int ia_uid; + u_int ia_gid; + u_quad_t ia_rdev; + u_quad_t ia_size; + u_int ia_blksize; + u_quad_t ia_blocks; + u_int ia_atime; + u_int ia_atime_nsec; + u_int ia_mtime; + u_int ia_mtime_nsec; + u_int ia_ctime; + u_int ia_ctime_nsec; +} __attribute__((packed)); +typedef struct gf_iatt gf_iatt; + + +static inline void +gf_stat_to_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +{ + if (!iatt || !gf_stat) + return; + + iatt->ia_ino = gf_stat->ia_ino ; + iatt->ia_gen = gf_stat->ia_gen ; + iatt->ia_dev = gf_stat->ia_dev ; + iatt->ia_type = ia_type_from_st_mode (gf_stat->mode) ; + iatt->ia_prot = ia_prot_from_st_mode (gf_stat->mode) ; + iatt->ia_nlink = gf_stat->ia_nlink ; + iatt->ia_uid = gf_stat->ia_uid ; + iatt->ia_gid = gf_stat->ia_gid ; + iatt->ia_rdev = gf_stat->ia_rdev ; + iatt->ia_size = gf_stat->ia_size ; + iatt->ia_blksize = gf_stat->ia_blksize ; + iatt->ia_blocks = gf_stat->ia_blocks ; + iatt->ia_atime = gf_stat->ia_atime ; + iatt->ia_atime_nsec = gf_stat->ia_atime_nsec ; + iatt->ia_mtime = gf_stat->ia_mtime ; + iatt->ia_mtime_nsec = gf_stat->ia_mtime_nsec ; + iatt->ia_ctime = gf_stat->ia_ctime ; + iatt->ia_ctime_nsec = gf_stat->ia_ctime_nsec ; +} + + +static inline void +gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt) +{ + if (!iatt || !gf_stat) + return; + + gf_stat->ia_ino = iatt->ia_ino ; + gf_stat->ia_gen = iatt->ia_gen ; + gf_stat->ia_dev = iatt->ia_dev ; + gf_stat->mode = st_mode_from_ia (iatt->ia_prot, iatt->ia_type); + gf_stat->ia_nlink = iatt->ia_nlink ; + gf_stat->ia_uid = iatt->ia_uid ; + gf_stat->ia_gid = iatt->ia_gid ; + gf_stat->ia_rdev = iatt->ia_rdev ; + gf_stat->ia_size = iatt->ia_size ; + gf_stat->ia_blksize = iatt->ia_blksize ; + gf_stat->ia_blocks = iatt->ia_blocks ; + gf_stat->ia_atime = iatt->ia_atime ; + gf_stat->ia_atime_nsec = iatt->ia_atime_nsec ; + gf_stat->ia_mtime = iatt->ia_mtime ; + gf_stat->ia_mtime_nsec = iatt->ia_mtime_nsec ; + gf_stat->ia_ctime = iatt->ia_ctime ; + gf_stat->ia_ctime_nsec = iatt->ia_ctime_nsec ; +} + + +struct gf_dirent_nb { + uint64_t d_ino; + uint64_t d_off; + uint32_t d_len; + uint32_t d_type; + struct gf_iatt d_stat; + char d_name[0]; +} __attribute__((packed)); + + +/* Gluster FS Payload structures */ + +struct gfs3_stat_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + char *path; +}; +typedef struct gfs3_stat_req gfs3_stat_req; + +struct gfs3_stat_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; +}; +typedef struct gfs3_stat_rsp gfs3_stat_rsp; + +struct gfs3_readlink_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int size; + char *path; +}; +typedef struct gfs3_readlink_req gfs3_readlink_req; + +struct gfs3_readlink_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt buf; + char *path; +}; +typedef struct gfs3_readlink_rsp gfs3_readlink_rsp; + +struct gfs3_mknod_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + u_quad_t dev; + u_int mode; + char *path; + char *bname; +}; +typedef struct gfs3_mknod_req gfs3_mknod_req; + +struct gfs3_mknod_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_mknod_rsp gfs3_mknod_rsp; + +struct gfs3_mkdir_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + u_int mode; + char *path; + char *bname; +}; +typedef struct gfs3_mkdir_req gfs3_mkdir_req; + +struct gfs3_mkdir_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_mkdir_rsp gfs3_mkdir_rsp; + +struct gfs3_unlink_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + char *path; + char *bname; +}; +typedef struct gfs3_unlink_req gfs3_unlink_req; + +struct gfs3_unlink_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_unlink_rsp gfs3_unlink_rsp; + +struct gfs3_rmdir_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + char *path; + char *bname; +}; +typedef struct gfs3_rmdir_req gfs3_rmdir_req; + +struct gfs3_rmdir_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_rmdir_rsp gfs3_rmdir_rsp; + +struct gfs3_symlink_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + char *path; + char *bname; + char *linkname; +}; +typedef struct gfs3_symlink_req gfs3_symlink_req; + +struct gfs3_symlink_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_symlink_rsp gfs3_symlink_rsp; + +struct gfs3_rename_req { + u_quad_t gfs_id; + u_quad_t oldpar; + u_quad_t oldgen; + u_quad_t newpar; + u_quad_t newgen; + char *oldpath; + char *oldbname; + char *newpath; + char *newbname; +}; +typedef struct gfs3_rename_req gfs3_rename_req; + +struct gfs3_rename_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preoldparent; + struct gf_iatt postoldparent; + struct gf_iatt prenewparent; + struct gf_iatt postnewparent; +}; +typedef struct gfs3_rename_rsp gfs3_rename_rsp; + +struct gfs3_link_req { + u_quad_t gfs_id; + u_quad_t oldino; + u_quad_t oldgen; + u_quad_t newpar; + u_quad_t newgen; + char *oldpath; + char *newpath; + char *newbname; +}; +typedef struct gfs3_link_req gfs3_link_req; + +struct gfs3_link_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_link_rsp gfs3_link_rsp; + +struct gfs3_truncate_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_quad_t offset; + char *path; +}; +typedef struct gfs3_truncate_req gfs3_truncate_req; + +struct gfs3_truncate_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; +typedef struct gfs3_truncate_rsp gfs3_truncate_rsp; + +struct gfs3_open_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int flags; + u_int wbflags; + char *path; +}; +typedef struct gfs3_open_req gfs3_open_req; + +struct gfs3_open_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + quad_t fd; +}; +typedef struct gfs3_open_rsp gfs3_open_rsp; + +struct gfs3_read_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_quad_t offset; + u_int size; +}; +typedef struct gfs3_read_req gfs3_read_req; + +struct gfs3_read_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + u_int size; +} __attribute__((packed)); +typedef struct gfs3_read_rsp gfs3_read_rsp; + +struct gfs3_lookup_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t par; + u_quad_t gen; + u_int flags; + char *path; + char *bname; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_lookup_req gfs3_lookup_req; + +struct gfs3_lookup_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt postparent; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_lookup_rsp gfs3_lookup_rsp; + +struct gfs3_write_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_quad_t offset; + u_int size; +} __attribute__((packed)); +typedef struct gfs3_write_req gfs3_write_req; + +struct gfs3_write_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; +typedef struct gfs3_write_rsp gfs3_write_rsp; + +struct gfs3_statfs_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + char *path; +}; +typedef struct gfs3_statfs_req gfs3_statfs_req; + +struct gfs3_statfs_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_statfs statfs; +}; +typedef struct gfs3_statfs_rsp gfs3_statfs_rsp; + +struct gfs3_lk_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int cmd; + u_int type; + struct gf_flock flock; +}; +typedef struct gfs3_lk_req gfs3_lk_req; + +struct gfs3_lk_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_flock flock; +}; +typedef struct gfs3_lk_rsp gfs3_lk_rsp; + +struct gfs3_inodelk_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int cmd; + u_int type; + struct gf_flock flock; + char *path; + char *volume; +}; +typedef struct gfs3_inodelk_req gfs3_inodelk_req; + +struct gfs3_finodelk_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int cmd; + u_int type; + struct gf_flock flock; + char *volume; +}; +typedef struct gfs3_finodelk_req gfs3_finodelk_req; + +struct gfs3_flush_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; +}; +typedef struct gfs3_flush_req gfs3_flush_req; + +struct gfs3_fsync_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int data; +}; +typedef struct gfs3_fsync_req gfs3_fsync_req; + +struct gfs3_fsync_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; +typedef struct gfs3_fsync_rsp gfs3_fsync_rsp; + +struct gfs3_setxattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int flags; + struct { + u_int dict_len; + char *dict_val; + } dict; + char *path; +}; +typedef struct gfs3_setxattr_req gfs3_setxattr_req; + +struct gfs3_fsetxattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int flags; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_fsetxattr_req gfs3_fsetxattr_req; + +struct gfs3_xattrop_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int flags; + struct { + u_int dict_len; + char *dict_val; + } dict; + char *path; +}; +typedef struct gfs3_xattrop_req gfs3_xattrop_req; + +struct gfs3_xattrop_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_xattrop_rsp gfs3_xattrop_rsp; + +struct gfs3_fxattrop_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int flags; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_fxattrop_req gfs3_fxattrop_req; + +struct gfs3_fxattrop_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_fxattrop_rsp gfs3_fxattrop_rsp; + +struct gfs3_getxattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int namelen; + char *path; + char *name; +}; +typedef struct gfs3_getxattr_req gfs3_getxattr_req; + +struct gfs3_getxattr_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_getxattr_rsp gfs3_getxattr_rsp; + +struct gfs3_fgetxattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int namelen; + char *name; +}; +typedef struct gfs3_fgetxattr_req gfs3_fgetxattr_req; + +struct gfs3_fgetxattr_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gfs3_fgetxattr_rsp gfs3_fgetxattr_rsp; + +struct gfs3_removexattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + char *path; + char *name; +}; +typedef struct gfs3_removexattr_req gfs3_removexattr_req; + +struct gfs3_opendir_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + char *path; +}; +typedef struct gfs3_opendir_req gfs3_opendir_req; + +struct gfs3_opendir_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + quad_t fd; +}; +typedef struct gfs3_opendir_rsp gfs3_opendir_rsp; + +struct gfs3_fsyncdir_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + int data; +}; +typedef struct gfs3_fsyncdir_req gfs3_fsyncdir_req; + +struct gfs3_readdir_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_quad_t offset; + u_int size; +}; +typedef struct gfs3_readdir_req gfs3_readdir_req; + +struct gfs3_readdir_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int buf_len; + char *buf_val; + } buf; +}; +typedef struct gfs3_readdir_rsp gfs3_readdir_rsp; + +struct gfs3_readdirp_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_quad_t offset; + u_int size; +}; +typedef struct gfs3_readdirp_req gfs3_readdirp_req; + +struct gfs3_readdirp_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int buf_len; + char *buf_val; + } buf; +}; +typedef struct gfs3_readdirp_rsp gfs3_readdirp_rsp; + +struct gf_setvolume_req { + u_quad_t gfs_id; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_setvolume_req gf_setvolume_req; + +struct gf_setvolume_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int dict_len; + char *dict_val; + } dict; +}; +typedef struct gf_setvolume_rsp gf_setvolume_rsp; + +struct gfs3_access_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int mask; + char *path; +}; +typedef struct gfs3_access_req gfs3_access_req; + +struct gfs3_create_req { + u_quad_t gfs_id; + u_quad_t par; + u_quad_t gen; + u_int flags; + u_int mode; + char *path; + char *bname; +}; +typedef struct gfs3_create_req gfs3_create_req; + +struct gfs3_create_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + u_quad_t fd; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; +typedef struct gfs3_create_rsp gfs3_create_rsp; + +struct gfs3_ftruncate_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_quad_t offset; +}; +typedef struct gfs3_ftruncate_req gfs3_ftruncate_req; + +struct gfs3_ftruncate_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; +typedef struct gfs3_ftruncate_rsp gfs3_ftruncate_rsp; + +struct gfs3_fstat_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; +}; +typedef struct gfs3_fstat_req gfs3_fstat_req; + +struct gfs3_fstat_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; +}; +typedef struct gfs3_fstat_rsp gfs3_fstat_rsp; + +struct gfs3_entrylk_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int cmd; + u_int type; + u_quad_t namelen; + char *path; + char *name; + char *volume; +}; +typedef struct gfs3_entrylk_req gfs3_entrylk_req; + +struct gfs3_fentrylk_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; + u_int cmd; + u_int type; + u_quad_t namelen; + char *name; + char *volume; +}; +typedef struct gfs3_fentrylk_req gfs3_fentrylk_req; + +struct gfs3_checksum_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + u_int flag; + char *path; +}; +typedef struct gfs3_checksum_req gfs3_checksum_req; + +struct gfs3_checksum_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct { + u_int fchecksum_len; + char *fchecksum_val; + } fchecksum; + struct { + u_int dchecksum_len; + char *dchecksum_val; + } dchecksum; +}; +typedef struct gfs3_checksum_rsp gfs3_checksum_rsp; + +struct gfs3_setattr_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + struct gf_iatt stbuf; + int valid; + char *path; +}; +typedef struct gfs3_setattr_req gfs3_setattr_req; + +struct gfs3_setattr_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +}; +typedef struct gfs3_setattr_rsp gfs3_setattr_rsp; + +struct gfs3_fsetattr_req { + u_quad_t gfs_id; + quad_t fd; + struct gf_iatt stbuf; + int valid; +}; +typedef struct gfs3_fsetattr_req gfs3_fsetattr_req; + +struct gfs3_fsetattr_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +}; +typedef struct gfs3_fsetattr_rsp gfs3_fsetattr_rsp; + +struct gfs3_rchecksum_req { + u_quad_t gfs_id; + quad_t fd; + u_quad_t offset; + u_int len; +}; +typedef struct gfs3_rchecksum_req gfs3_rchecksum_req; + +struct gfs3_rchecksum_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + u_int weak_checksum; + struct { + u_int strong_checksum_len; + char *strong_checksum_val; + } strong_checksum; +}; +typedef struct gfs3_rchecksum_rsp gfs3_rchecksum_rsp; + +struct gf_getspec_req { + u_quad_t gfs_id; + u_int flags; + char *key; +}; +typedef struct gf_getspec_req gf_getspec_req; + +struct gf_getspec_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + char *spec; +}; +typedef struct gf_getspec_rsp gf_getspec_rsp; + +struct gf_log_req { + u_quad_t gfs_id; + struct { + u_int msg_len; + char *msg_val; + } msg; +}; +typedef struct gf_log_req gf_log_req; + +struct gf_notify_req { + u_quad_t gfs_id; + u_int flags; + char *buf; +}; +typedef struct gf_notify_req gf_notify_req; + +struct gf_notify_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + u_int flags; + char *buf; +}; +typedef struct gf_notify_rsp gf_notify_rsp; + +struct gfs3_releasedir_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; +}; +typedef struct gfs3_releasedir_req gfs3_releasedir_req; + +struct gfs3_release_req { + u_quad_t gfs_id; + u_quad_t ino; + u_quad_t gen; + quad_t fd; +}; +typedef struct gfs3_release_req gfs3_release_req; + +struct gf_common_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; +}; +typedef struct gf_common_rsp gf_common_rsp; + +struct gf_dump_version_req { + u_quad_t gfs_id; + u_int flags; + char *key; +}; +typedef struct gf_dump_version_req gf_dump_version_req; + +struct gf_dump_version_rsp { + u_quad_t gfs_id; + int op_ret; + int op_errno; + u_int flags; + struct { + u_int msg_len; + char *msg_val; + } msg; +}; +typedef struct gf_dump_version_rsp gf_dump_version_rsp; + +struct auth_glusterfs_parms { + u_quad_t lk_owner; + u_int pid; + u_int uid; + u_int gid; + u_int ngrps; + u_int groups[16]; +}; +typedef struct auth_glusterfs_parms auth_glusterfs_parms; + +/* the xdr functions */ + +#if defined(__STDC__) || defined(__cplusplus) +extern bool_t xdr_gf_statfs (XDR *, gf_statfs*); +extern bool_t xdr_gf_flock (XDR *, gf_flock*); +extern bool_t xdr_gf_iatt (XDR *, gf_iatt*); +extern bool_t xdr_gfs3_stat_req (XDR *, gfs3_stat_req*); +extern bool_t xdr_gfs3_stat_rsp (XDR *, gfs3_stat_rsp*); +extern bool_t xdr_gfs3_readlink_req (XDR *, gfs3_readlink_req*); +extern bool_t xdr_gfs3_readlink_rsp (XDR *, gfs3_readlink_rsp*); +extern bool_t xdr_gfs3_mknod_req (XDR *, gfs3_mknod_req*); +extern bool_t xdr_gfs3_mknod_rsp (XDR *, gfs3_mknod_rsp*); +extern bool_t xdr_gfs3_mkdir_req (XDR *, gfs3_mkdir_req*); +extern bool_t xdr_gfs3_mkdir_rsp (XDR *, gfs3_mkdir_rsp*); +extern bool_t xdr_gfs3_unlink_req (XDR *, gfs3_unlink_req*); +extern bool_t xdr_gfs3_unlink_rsp (XDR *, gfs3_unlink_rsp*); +extern bool_t xdr_gfs3_rmdir_req (XDR *, gfs3_rmdir_req*); +extern bool_t xdr_gfs3_rmdir_rsp (XDR *, gfs3_rmdir_rsp*); +extern bool_t xdr_gfs3_symlink_req (XDR *, gfs3_symlink_req*); +extern bool_t xdr_gfs3_symlink_rsp (XDR *, gfs3_symlink_rsp*); +extern bool_t xdr_gfs3_rename_req (XDR *, gfs3_rename_req*); +extern bool_t xdr_gfs3_rename_rsp (XDR *, gfs3_rename_rsp*); +extern bool_t xdr_gfs3_link_req (XDR *, gfs3_link_req*); +extern bool_t xdr_gfs3_link_rsp (XDR *, gfs3_link_rsp*); +extern bool_t xdr_gfs3_truncate_req (XDR *, gfs3_truncate_req*); +extern bool_t xdr_gfs3_truncate_rsp (XDR *, gfs3_truncate_rsp*); +extern bool_t xdr_gfs3_open_req (XDR *, gfs3_open_req*); +extern bool_t xdr_gfs3_open_rsp (XDR *, gfs3_open_rsp*); +extern bool_t xdr_gfs3_read_req (XDR *, gfs3_read_req*); +extern bool_t xdr_gfs3_read_rsp (XDR *, gfs3_read_rsp*); +extern bool_t xdr_gfs3_lookup_req (XDR *, gfs3_lookup_req*); +extern bool_t xdr_gfs3_lookup_rsp (XDR *, gfs3_lookup_rsp*); +extern bool_t xdr_gfs3_write_req (XDR *, gfs3_write_req*); +extern bool_t xdr_gfs3_write_rsp (XDR *, gfs3_write_rsp*); +extern bool_t xdr_gfs3_statfs_req (XDR *, gfs3_statfs_req*); +extern bool_t xdr_gfs3_statfs_rsp (XDR *, gfs3_statfs_rsp*); +extern bool_t xdr_gfs3_lk_req (XDR *, gfs3_lk_req*); +extern bool_t xdr_gfs3_lk_rsp (XDR *, gfs3_lk_rsp*); +extern bool_t xdr_gfs3_inodelk_req (XDR *, gfs3_inodelk_req*); +extern bool_t xdr_gfs3_finodelk_req (XDR *, gfs3_finodelk_req*); +extern bool_t xdr_gfs3_flush_req (XDR *, gfs3_flush_req*); +extern bool_t xdr_gfs3_fsync_req (XDR *, gfs3_fsync_req*); +extern bool_t xdr_gfs3_fsync_rsp (XDR *, gfs3_fsync_rsp*); +extern bool_t xdr_gfs3_setxattr_req (XDR *, gfs3_setxattr_req*); +extern bool_t xdr_gfs3_fsetxattr_req (XDR *, gfs3_fsetxattr_req*); +extern bool_t xdr_gfs3_xattrop_req (XDR *, gfs3_xattrop_req*); +extern bool_t xdr_gfs3_xattrop_rsp (XDR *, gfs3_xattrop_rsp*); +extern bool_t xdr_gfs3_fxattrop_req (XDR *, gfs3_fxattrop_req*); +extern bool_t xdr_gfs3_fxattrop_rsp (XDR *, gfs3_fxattrop_rsp*); +extern bool_t xdr_gfs3_getxattr_req (XDR *, gfs3_getxattr_req*); +extern bool_t xdr_gfs3_getxattr_rsp (XDR *, gfs3_getxattr_rsp*); +extern bool_t xdr_gfs3_fgetxattr_req (XDR *, gfs3_fgetxattr_req*); +extern bool_t xdr_gfs3_fgetxattr_rsp (XDR *, gfs3_fgetxattr_rsp*); +extern bool_t xdr_gfs3_removexattr_req (XDR *, gfs3_removexattr_req*); +extern bool_t xdr_gfs3_opendir_req (XDR *, gfs3_opendir_req*); +extern bool_t xdr_gfs3_opendir_rsp (XDR *, gfs3_opendir_rsp*); +extern bool_t xdr_gfs3_fsyncdir_req (XDR *, gfs3_fsyncdir_req*); +extern bool_t xdr_gfs3_readdir_req (XDR *, gfs3_readdir_req*); +extern bool_t xdr_gfs3_readdir_rsp (XDR *, gfs3_readdir_rsp*); +extern bool_t xdr_gfs3_readdirp_req (XDR *, gfs3_readdirp_req*); +extern bool_t xdr_gfs3_readdirp_rsp (XDR *, gfs3_readdirp_rsp*); +extern bool_t xdr_gf_setvolume_req (XDR *, gf_setvolume_req*); +extern bool_t xdr_gf_setvolume_rsp (XDR *, gf_setvolume_rsp*); +extern bool_t xdr_gfs3_access_req (XDR *, gfs3_access_req*); +extern bool_t xdr_gfs3_create_req (XDR *, gfs3_create_req*); +extern bool_t xdr_gfs3_create_rsp (XDR *, gfs3_create_rsp*); +extern bool_t xdr_gfs3_ftruncate_req (XDR *, gfs3_ftruncate_req*); +extern bool_t xdr_gfs3_ftruncate_rsp (XDR *, gfs3_ftruncate_rsp*); +extern bool_t xdr_gfs3_fstat_req (XDR *, gfs3_fstat_req*); +extern bool_t xdr_gfs3_fstat_rsp (XDR *, gfs3_fstat_rsp*); +extern bool_t xdr_gfs3_entrylk_req (XDR *, gfs3_entrylk_req*); +extern bool_t xdr_gfs3_fentrylk_req (XDR *, gfs3_fentrylk_req*); +extern bool_t xdr_gfs3_checksum_req (XDR *, gfs3_checksum_req*); +extern bool_t xdr_gfs3_checksum_rsp (XDR *, gfs3_checksum_rsp*); +extern bool_t xdr_gfs3_setattr_req (XDR *, gfs3_setattr_req*); +extern bool_t xdr_gfs3_setattr_rsp (XDR *, gfs3_setattr_rsp*); +extern bool_t xdr_gfs3_fsetattr_req (XDR *, gfs3_fsetattr_req*); +extern bool_t xdr_gfs3_fsetattr_rsp (XDR *, gfs3_fsetattr_rsp*); +extern bool_t xdr_gfs3_rchecksum_req (XDR *, gfs3_rchecksum_req*); +extern bool_t xdr_gfs3_rchecksum_rsp (XDR *, gfs3_rchecksum_rsp*); +extern bool_t xdr_gf_getspec_req (XDR *, gf_getspec_req*); +extern bool_t xdr_gf_getspec_rsp (XDR *, gf_getspec_rsp*); +extern bool_t xdr_gf_log_req (XDR *, gf_log_req*); +extern bool_t xdr_gf_notify_req (XDR *, gf_notify_req*); +extern bool_t xdr_gf_notify_rsp (XDR *, gf_notify_rsp*); +extern bool_t xdr_gfs3_releasedir_req (XDR *, gfs3_releasedir_req*); +extern bool_t xdr_gfs3_release_req (XDR *, gfs3_release_req*); +extern bool_t xdr_gf_common_rsp (XDR *, gf_common_rsp*); +extern bool_t xdr_gf_dump_version_req (XDR *, gf_dump_version_req *); +extern bool_t xdr_gf_dump_version_rsp (XDR *, gf_dump_version_rsp *); +extern bool_t xdr_auth_glusterfs_parms (XDR *, auth_glusterfs_parms*); + +#else /* K&R C */ +extern bool_t xdr_gf_statfs (); +extern bool_t xdr_gf_flock (); +extern bool_t xdr_gf_iatt (); +extern bool_t xdr_gfs3_stat_req (); +extern bool_t xdr_gfs3_stat_rsp (); +extern bool_t xdr_gfs3_readlink_req (); +extern bool_t xdr_gfs3_readlink_rsp (); +extern bool_t xdr_gfs3_mknod_req (); +extern bool_t xdr_gfs3_mknod_rsp (); +extern bool_t xdr_gfs3_mkdir_req (); +extern bool_t xdr_gfs3_mkdir_rsp (); +extern bool_t xdr_gfs3_unlink_req (); +extern bool_t xdr_gfs3_unlink_rsp (); +extern bool_t xdr_gfs3_rmdir_req (); +extern bool_t xdr_gfs3_rmdir_rsp (); +extern bool_t xdr_gfs3_symlink_req (); +extern bool_t xdr_gfs3_symlink_rsp (); +extern bool_t xdr_gfs3_rename_req (); +extern bool_t xdr_gfs3_rename_rsp (); +extern bool_t xdr_gfs3_link_req (); +extern bool_t xdr_gfs3_link_rsp (); +extern bool_t xdr_gfs3_truncate_req (); +extern bool_t xdr_gfs3_truncate_rsp (); +extern bool_t xdr_gfs3_open_req (); +extern bool_t xdr_gfs3_open_rsp (); +extern bool_t xdr_gfs3_read_req (); +extern bool_t xdr_gfs3_read_rsp (); +extern bool_t xdr_gfs3_lookup_req (); +extern bool_t xdr_gfs3_lookup_rsp (); +extern bool_t xdr_gfs3_write_req (); +extern bool_t xdr_gfs3_write_rsp (); +extern bool_t xdr_gfs3_statfs_req (); +extern bool_t xdr_gfs3_statfs_rsp (); +extern bool_t xdr_gfs3_lk_req (); +extern bool_t xdr_gfs3_lk_rsp (); +extern bool_t xdr_gfs3_inodelk_req (); +extern bool_t xdr_gfs3_finodelk_req (); +extern bool_t xdr_gfs3_flush_req (); +extern bool_t xdr_gfs3_fsync_req (); +extern bool_t xdr_gfs3_fsync_rsp (); +extern bool_t xdr_gfs3_setxattr_req (); +extern bool_t xdr_gfs3_fsetxattr_req (); +extern bool_t xdr_gfs3_xattrop_req (); +extern bool_t xdr_gfs3_xattrop_rsp (); +extern bool_t xdr_gfs3_fxattrop_req (); +extern bool_t xdr_gfs3_fxattrop_rsp (); +extern bool_t xdr_gfs3_getxattr_req (); +extern bool_t xdr_gfs3_getxattr_rsp (); +extern bool_t xdr_gfs3_fgetxattr_req (); +extern bool_t xdr_gfs3_fgetxattr_rsp (); +extern bool_t xdr_gfs3_removexattr_req (); +extern bool_t xdr_gfs3_opendir_req (); +extern bool_t xdr_gfs3_opendir_rsp (); +extern bool_t xdr_gfs3_fsyncdir_req (); +extern bool_t xdr_gfs3_readdir_req (); +extern bool_t xdr_gfs3_readdir_rsp (); +extern bool_t xdr_gfs3_readdirp_req (); +extern bool_t xdr_gfs3_readdirp_rsp (); +extern bool_t xdr_gf_setvolume_req (); +extern bool_t xdr_gf_setvolume_rsp (); +extern bool_t xdr_gfs3_access_req (); +extern bool_t xdr_gfs3_create_req (); +extern bool_t xdr_gfs3_create_rsp (); +extern bool_t xdr_gfs3_ftruncate_req (); +extern bool_t xdr_gfs3_ftruncate_rsp (); +extern bool_t xdr_gfs3_fstat_req (); +extern bool_t xdr_gfs3_fstat_rsp (); +extern bool_t xdr_gfs3_entrylk_req (); +extern bool_t xdr_gfs3_fentrylk_req (); +extern bool_t xdr_gfs3_checksum_req (); +extern bool_t xdr_gfs3_checksum_rsp (); +extern bool_t xdr_gfs3_setattr_req (); +extern bool_t xdr_gfs3_setattr_rsp (); +extern bool_t xdr_gfs3_fsetattr_req (); +extern bool_t xdr_gfs3_fsetattr_rsp (); +extern bool_t xdr_gfs3_rchecksum_req (); +extern bool_t xdr_gfs3_rchecksum_rsp (); +extern bool_t xdr_gfs3_releasedir_req (); +extern bool_t xdr_gfs3_release_req (); +extern bool_t xdr_gf_getspec_req (); +extern bool_t xdr_gf_getspec_rsp (); +extern bool_t xdr_gf_log_req (); +extern bool_t xdr_gf_notify_req (); +extern bool_t xdr_gf_notify_rsp (); +extern bool_t xdr_gf_common_rsp (); +extern bool_t xdr_gf_dump_version_req (); +extern bool_t xdr_gf_dump_version_rsp (); +extern bool_t xdr_auth_glusterfs_parms (); + +#endif /* K&R C */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_GLUSTERFS3_H_RPCGEN */ diff --git a/xlators/protocol/lib/src/glusterfs3.x b/xlators/protocol/lib/src/glusterfs3.x new file mode 100644 index 00000000000..b6cc6e6abad --- /dev/null +++ b/xlators/protocol/lib/src/glusterfs3.x @@ -0,0 +1,755 @@ +#define GF_REQUEST_MAXGROUPS 16 +struct gf_statfs { + unsigned hyper bsize; + unsigned hyper frsize; + unsigned hyper blocks; + unsigned hyper bfree; + unsigned hyper bavail; + unsigned hyper files; + unsigned hyper ffree; + unsigned hyper favail; + unsigned hyper fsid; + unsigned hyper flag; + unsigned hyper namemax; +}; + +struct gf_flock { + unsigned int type; + unsigned int whence; + unsigned hyper start; + unsigned hyper len; + unsigned int pid; +} ; + + +struct gf_iatt { + unsigned hyper ia_ino; /* inode number */ + unsigned hyper ia_gen; /* generation number */ + unsigned hyper ia_dev; /* backing device ID */ + unsigned int mode; /* mode (type + protection )*/ + unsigned int ia_nlink; /* Link count */ + unsigned int ia_uid; /* user ID of owner */ + unsigned int ia_gid; /* group ID of owner */ + unsigned hyper ia_rdev; /* device ID (if special file) */ + unsigned hyper ia_size; /* file size in bytes */ + unsigned int ia_blksize; /* blocksize for filesystem I/O */ + unsigned hyper ia_blocks; /* number of 512B blocks allocated */ + unsigned int ia_atime; /* last access time */ + unsigned int ia_atime_nsec; + unsigned int ia_mtime; /* last modification time */ + unsigned int ia_mtime_nsec; + unsigned int ia_ctime; /* last status change time */ + unsigned int ia_ctime_nsec; +}; + +struct gfs3_stat_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + string path<>; /* NULL terminated */ +}; +struct gfs3_stat_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; +} ; + + +struct gfs3_readlink_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int size; + string path<>; /* NULL terminated */ +} ; + struct gfs3_readlink_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt buf; + string path<>; /* NULL terminated */ +} ; + + + struct gfs3_mknod_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + unsigned hyper dev; + unsigned int mode; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ +} ; + struct gfs3_mknod_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_mkdir_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + unsigned int mode; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ +} ; + struct gfs3_mkdir_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +} ; + + + struct gfs3_unlink_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + string path<>; /* NULL terminated */ + string bname<>; /* NULL terminated */ +}; + struct gfs3_unlink_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_rmdir_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + string path<>; + string bname<>; /* NULL terminated */ +}; + struct gfs3_rmdir_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_symlink_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + string path<>; + string bname<>; + string linkname<>; +}; + struct gfs3_symlink_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + + struct gfs3_rename_req { + unsigned hyper gfs_id; + unsigned hyper oldpar; + unsigned hyper oldgen; + unsigned hyper newpar; + unsigned hyper newgen; + string oldpath<>; + string oldbname<>; /* NULL terminated */ + string newpath<>; + string newbname<>; /* NULL terminated */ +}; + struct gfs3_rename_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preoldparent; + struct gf_iatt postoldparent; + struct gf_iatt prenewparent; + struct gf_iatt postnewparent; +}; + + + struct gfs3_link_req { + unsigned hyper gfs_id; + unsigned hyper oldino; + unsigned hyper oldgen; + unsigned hyper newpar; + unsigned hyper newgen; + string oldpath<>; + string newpath<>; + string newbname<>; +}; + struct gfs3_link_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt preparent; + struct gf_iatt postparent; +}; + + struct gfs3_truncate_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned hyper offset; + string path<>; +}; + struct gfs3_truncate_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +}; + + + struct gfs3_open_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int flags; + unsigned int wbflags; + string path<>; +}; + struct gfs3_open_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + hyper fd; +}; + + + struct gfs3_read_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; + struct gfs3_read_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + string buf<>; +} ; + +struct gfs3_lookup_req { + unsigned hyper gfs_id; + unsigned hyper ino; /* NOTE: used only in case of 'root' lookup */ + unsigned hyper par; + unsigned hyper gen; + unsigned int flags; + string path<>; + string bname<>; + opaque dict<>; +}; + struct gfs3_lookup_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + struct gf_iatt postparent; + opaque dict<>; +} ; + + + + struct gfs3_write_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; + struct gfs3_write_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + + struct gfs3_statfs_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + string path<>; +} ; + struct gfs3_statfs_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_statfs statfs; +} ; + + struct gfs3_lk_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int cmd; + unsigned int type; + struct gf_flock flock; +} ; + struct gfs3_lk_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_flock flock; +} ; + + struct gfs3_inodelk_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int cmd; + unsigned int type; + struct gf_flock flock; + string path<>; + string volume<>; +} ; + +struct gfs3_finodelk_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int cmd; + unsigned int type; + struct gf_flock flock; + string volume<>; +} ; + + + struct gfs3_flush_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; +} ; + + + struct gfs3_fsync_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int data; +} ; + struct gfs3_fsync_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + + struct gfs3_setxattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int flags; + opaque dict<>; + string path<>; +} ; + + + + struct gfs3_fsetxattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int flags; + opaque dict<>; +} ; + + + + struct gfs3_xattrop_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int flags; + opaque dict<>; + string path<>; +} ; + + struct gfs3_xattrop_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_fxattrop_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int flags; + opaque dict<>; +} ; + + struct gfs3_fxattrop_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_getxattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int namelen; + string path<>; + string name<>; +} ; + struct gfs3_getxattr_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_fgetxattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int namelen; + string name<>; +} ; + struct gfs3_fgetxattr_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque dict<>; +} ; + + + struct gfs3_removexattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + string path<>; + string name<>; +} ; + + + + struct gfs3_opendir_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + string path<>; +} ; + struct gfs3_opendir_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + hyper fd; +} ; + + + struct gfs3_fsyncdir_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + int data; +} ; + + struct gfs3_readdir_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned hyper offset; + unsigned int size; +}; +struct gfs3_readdir_res { + unsigned hyper gfs_id; + opaque buf<>; +} ; + + + struct gfs3_readdirp_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned hyper offset; + unsigned int size; +} ; + struct gfs3_readdirp_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque buf<>; +} ; + + + struct gf_setvolume_req { + unsigned hyper gfs_id; + opaque dict<>; +} ; + struct gf_setvolume_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque dict<>; +} ; + +struct gfs3_access_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int mask; + string path<>; +} ; + + +struct gfs3_create_req { + unsigned hyper gfs_id; + unsigned hyper par; + unsigned hyper gen; + unsigned int flags; + unsigned int mode; + string path<>; + string bname<>; +} ; +struct gfs3_create_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; + unsigned hyper fd; + struct gf_iatt preparent; + struct gf_iatt postparent; +} ; + + + +struct gfs3_ftruncate_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned hyper offset; +} ; +struct gfs3_ftruncate_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt prestat; + struct gf_iatt poststat; +} ; + + +struct gfs3_fstat_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; +} ; + struct gfs3_fstat_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt stat; +} ; + + + + struct gfs3_entrylk_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int cmd; + unsigned int type; + unsigned hyper namelen; + string path<>; + string name<>; + string volume<>; +}; + + struct gfs3_fentrylk_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; + unsigned int cmd; + unsigned int type; + unsigned hyper namelen; + string name<>; + string volume<>; +}; + + +struct gfs3_checksum_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + unsigned int flag; + string path<>; +}; + struct gfs3_checksum_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + opaque fchecksum<>; + opaque dchecksum<>; +} ; + + struct gfs3_setattr_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + struct gf_iatt stbuf; + int valid; + string path<>; +} ; + struct gfs3_setattr_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +} ; + + struct gfs3_fsetattr_req { + unsigned hyper gfs_id; + hyper fd; + struct gf_iatt stbuf; + int valid; +} ; + struct gfs3_fsetattr_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; +} ; + + struct gfs3_rchecksum_req { + unsigned hyper gfs_id; + hyper fd; + unsigned hyper offset; + unsigned int len; +} ; + struct gfs3_rchecksum_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + unsigned int weak_checksum; + opaque strong_checksum<>; +} ; + struct gfs3_releasedir_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; +} ; + +struct gfs3_release_req { + unsigned hyper gfs_id; + unsigned hyper ino; + unsigned hyper gen; + hyper fd; +} ; + + + struct gf_getspec_req { + unsigned hyper gfs_id; + unsigned int flags; + string key<>; +} ; + struct gf_getspec_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + string spec<>; +} ; + + + struct gf_log_req { + unsigned hyper gfs_id; + opaque msg<>; +}; + + struct gf_notify_req { + unsigned hyper gfs_id; + unsigned int flags; + string buf<>; +} ; + struct gf_notify_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + unsigned int flags; + string buf<>; +} ; + + + +struct gf_common_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; +} ; + + +struct gf_dump_version_req { + unsigned hyper gfs_id; + unsigned int flags; + string key<>; +}; + + +struct gf_dump_version_rsp { + unsigned hyper gfs_id; + int op_ret; + int op_errno; + unsigned int flags; + opaque msg<>; +}; + +struct auth_glusterfs_parms { + unsigned int pid; + unsigned int uid; + unsigned int gid; + + /* Number of groups being sent through the array above. */ + unsigned int ngrps; + + /* Array of groups to which the uid belongs apart from the primary group + * in gid. + */ + unsigned int groups[GF_REQUEST_MAXGROUPS]; + + unsigned hyper lk_owner; +}; diff --git a/xlators/protocol/lib/src/msg-xdr.c b/xlators/protocol/lib/src/msg-xdr.c new file mode 100644 index 00000000000..8cab3726c3d --- /dev/null +++ b/xlators/protocol/lib/src/msg-xdr.c @@ -0,0 +1,1264 @@ +/* + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + + +#include "msg-xdr.h" + + +ssize_t +xdr_serialize_generic (struct iovec outmsg, void *res, xdrproc_t proc) +{ + ssize_t ret = -1; + XDR xdr; + + if ((!outmsg.iov_base) || (!res) || (!proc)) + return -1; + + xdrmem_create (&xdr, outmsg.iov_base, (unsigned int)outmsg.iov_len, + XDR_ENCODE); + + if (!proc (&xdr, res)) { + ret = -1; + goto ret; + } + + ret = xdr_encoded_length (xdr); + +ret: + return ret; +} + + +ssize_t +xdr_to_generic (struct iovec inmsg, void *args, xdrproc_t proc) +{ + XDR xdr; + ssize_t ret = -1; + + if ((!inmsg.iov_base) || (!args) || (!proc)) + return -1; + + xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, + XDR_DECODE); + + if (!proc (&xdr, args)) { + ret = -1; + goto ret; + } + + ret = xdr_decoded_length (xdr); +ret: + return ret; +} + + +ssize_t +xdr_to_generic_payload (struct iovec inmsg, void *args, xdrproc_t proc, + struct iovec *pendingpayload) +{ + XDR xdr; + ssize_t ret = -1; + + if ((!inmsg.iov_base) || (!args) || (!proc)) + return -1; + + xdrmem_create (&xdr, inmsg.iov_base, (unsigned int)inmsg.iov_len, + XDR_DECODE); + + if (!proc (&xdr, args)) { + ret = -1; + goto ret; + } + + ret = xdr_decoded_length (xdr); + + if (pendingpayload) { + pendingpayload->iov_base = xdr_decoded_remaining_addr (xdr); + pendingpayload->iov_len = xdr_decoded_remaining_len (xdr); + } + +ret: + return ret; +} + +/* Encode */ + +ssize_t +xdr_serialize_getspec_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_getspec_rsp); + +} + +ssize_t +xdr_serialize_lookup_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_lookup_rsp); + +} + +ssize_t +xdr_serialize_common_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_common_rsp); + +} + +ssize_t +xdr_serialize_setvolume_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_setvolume_rsp); + +} +ssize_t +xdr_serialize_statfs_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_statfs_rsp); + +} +ssize_t +xdr_serialize_stat_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_stat_rsp); + +} +ssize_t +xdr_serialize_fstat_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fstat_rsp); + +} +ssize_t +xdr_serialize_open_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_open_rsp); + +} +ssize_t +xdr_serialize_read_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_read_rsp); + +} +ssize_t +xdr_serialize_write_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_write_rsp); + +} +ssize_t +xdr_serialize_rename_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rename_rsp); + +} +ssize_t +xdr_serialize_fsync_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fsync_rsp); + +} +ssize_t +xdr_serialize_rmdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rmdir_rsp); +} +ssize_t +xdr_serialize_unlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_unlink_rsp); +} +ssize_t +xdr_serialize_writev_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_write_rsp); +} +ssize_t +xdr_serialize_readv_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_read_rsp); +} +ssize_t +xdr_serialize_readdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readdir_rsp); +} +ssize_t +xdr_serialize_readdirp_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readdirp_rsp); +} +ssize_t +xdr_serialize_rchecksum_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rchecksum_rsp); +} +ssize_t +xdr_serialize_setattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_setattr_rsp); +} +ssize_t +xdr_serialize_fsetattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fsetattr_rsp); +} + +ssize_t +xdr_serialize_readlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readlink_rsp); + +} +ssize_t +xdr_serialize_symlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_symlink_rsp); + +} +ssize_t +xdr_serialize_create_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_create_rsp); + +} +ssize_t +xdr_serialize_link_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_link_rsp); + +} +ssize_t +xdr_serialize_mkdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_mkdir_rsp); + +} +ssize_t +xdr_serialize_mknod_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_mknod_rsp); + +} +ssize_t +xdr_serialize_getxattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_getxattr_rsp); + +} +ssize_t +xdr_serialize_fgetxattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fgetxattr_rsp); + +} +ssize_t +xdr_serialize_xattrop_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_xattrop_rsp); + +} +ssize_t +xdr_serialize_fxattrop_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fxattrop_rsp); +} + +ssize_t +xdr_serialize_truncate_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_truncate_rsp); +} + +ssize_t +xdr_serialize_lk_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_lk_rsp); +} + +ssize_t +xdr_serialize_opendir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_opendir_rsp); +} + +ssize_t +xdr_serialize_checksum_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_checksum_rsp); +} + +ssize_t +xdr_serialize_ftruncate_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_ftruncate_rsp); +} + + +ssize_t +xdr_serialize_dump_version_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_serialize_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_dump_version_rsp); +} + + +/* Decode */ + + +ssize_t +xdr_to_dump_version_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf_dump_version_req); +} + +ssize_t +xdr_to_lookup_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_lookup_req); +} + +ssize_t +xdr_to_getspec_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf_getspec_req); + +} + +ssize_t +xdr_to_setvolume_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gf_setvolume_req); + +} + +ssize_t +xdr_to_statfs_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_statfs_req); + +} + +ssize_t +xdr_to_fsync_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fsync_req); + +} + +ssize_t +xdr_to_flush_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_flush_req); + +} + +ssize_t +xdr_to_xattrop_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_xattrop_req); + +} + +ssize_t +xdr_to_fxattrop_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fxattrop_req); + +} + +ssize_t +xdr_to_getxattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_getxattr_req); + +} +ssize_t +xdr_to_fgetxattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fgetxattr_req); + +} +ssize_t +xdr_to_open_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_open_req); + +} +ssize_t +xdr_to_create_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_create_req); + +} +ssize_t +xdr_to_symlink_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_symlink_req); +} +ssize_t +xdr_to_link_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_link_req); +} +ssize_t +xdr_to_readlink_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_readlink_req); +} +ssize_t +xdr_to_rename_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_rename_req); +} +ssize_t +xdr_to_mkdir_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_mkdir_req); +} +ssize_t +xdr_to_mknod_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_mknod_req); +} +ssize_t +xdr_to_readv_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_read_req); +} +ssize_t +xdr_to_writev_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_write_req); +} + +ssize_t +xdr_to_readdir_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_readdir_req); +} + +ssize_t +xdr_to_opendir_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_opendir_req); +} + +ssize_t +xdr_to_rmdir_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_rmdir_req); +} + +ssize_t +xdr_to_fsetxattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fsetxattr_req); +} +ssize_t +xdr_to_setattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_setattr_req); +} +ssize_t +xdr_to_fsetattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fsetattr_req); +} + +ssize_t +xdr_to_finodelk_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_finodelk_req); +} + +ssize_t +xdr_to_inodelk_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_inodelk_req); +} + +ssize_t +xdr_to_ftruncate_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_ftruncate_req); +} + +ssize_t +xdr_to_fsyncdir_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fsyncdir_req); +} + +ssize_t +xdr_to_fstat_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fstat_req); +} + +ssize_t +xdr_to_checksum_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_checksum_req); +} +ssize_t +xdr_to_rchecksum_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_rchecksum_req); +} +ssize_t +xdr_to_removexattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_removexattr_req); +} +ssize_t +xdr_to_setxattr_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_setxattr_req); +} + +ssize_t +xdr_to_fentrylk_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_fentrylk_req); +} + +ssize_t +xdr_to_entrylk_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_entrylk_req); +} + +ssize_t +xdr_to_lk_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_lk_req); +} + +ssize_t +xdr_to_stat_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_stat_req); +} + +ssize_t +xdr_to_release_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_release_req); +} + +ssize_t +xdr_to_readdirp_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_readdirp_req); +} +ssize_t +xdr_to_truncate_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_truncate_req); +} +ssize_t +xdr_to_access_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_access_req); +} +ssize_t +xdr_to_unlink_req (struct iovec inmsg, void *args) +{ + return xdr_to_generic (inmsg, (void *)args, + (xdrproc_t)xdr_gfs3_unlink_req); +} + +ssize_t +xdr_from_lookup_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_lookup_req); + +} + +ssize_t +xdr_from_stat_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_stat_req); + +} + +ssize_t +xdr_from_fstat_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fstat_req); + +} + +ssize_t +xdr_from_mkdir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_mkdir_req); + +} + +ssize_t +xdr_from_mknod_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_mknod_req); + +} + +ssize_t +xdr_from_symlink_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_symlink_req); + +} + +ssize_t +xdr_from_readlink_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_readlink_req); + +} + +ssize_t +xdr_from_rename_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_rename_req); + +} + +ssize_t +xdr_from_link_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_link_req); + +} + +ssize_t +xdr_from_create_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_create_req); + +} + +ssize_t +xdr_from_open_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_open_req); + +} + +ssize_t +xdr_from_opendir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_opendir_req); + +} + +ssize_t +xdr_from_readdir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_readdir_req); + +} + +ssize_t +xdr_from_readdirp_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_readdirp_req); + +} + +ssize_t +xdr_from_fsyncdir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fsyncdir_req); + +} +ssize_t +xdr_from_releasedir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_releasedir_req); + +} +ssize_t +xdr_from_release_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_release_req); + +} +ssize_t +xdr_from_lk_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_lk_req); + +} +ssize_t +xdr_from_entrylk_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_entrylk_req); + +} +ssize_t +xdr_from_fentrylk_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fentrylk_req); + +} +ssize_t +xdr_from_inodelk_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_inodelk_req); + +} +ssize_t +xdr_from_finodelk_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_finodelk_req); + +} +ssize_t +xdr_from_setxattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_setxattr_req); + +} +ssize_t +xdr_from_fsetxattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fsetxattr_req); + +} +ssize_t +xdr_from_getxattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_getxattr_req); + +} +ssize_t +xdr_from_fgetxattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fgetxattr_req); + +} +ssize_t +xdr_from_removexattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_removexattr_req); + +} +ssize_t +xdr_from_xattrop_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_xattrop_req); + +} +ssize_t +xdr_from_fxattrop_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fxattrop_req); + +} +ssize_t +xdr_from_access_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_access_req); + +} +ssize_t +xdr_from_setattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_setattr_req); + +} +ssize_t +xdr_from_truncate_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_truncate_req); + +} +ssize_t +xdr_from_ftruncate_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_ftruncate_req); + +} +ssize_t +xdr_from_fsetattr_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fsetattr_req); + +} +ssize_t +xdr_from_readv_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_read_req); + +} +ssize_t +xdr_from_writev_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_write_req); + +} +ssize_t +xdr_from_fsync_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_fsync_req); + +} +ssize_t +xdr_from_flush_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_flush_req); + +} +ssize_t +xdr_from_statfs_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_statfs_req); + +} +ssize_t +xdr_from_checksum_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_checksum_req); + +} +ssize_t +xdr_from_rchecksum_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_rchecksum_req); + +} +ssize_t +xdr_from_getspec_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gf_getspec_req); + +} +ssize_t +xdr_from_setvolume_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gf_setvolume_req); + +} +ssize_t +xdr_from_dump_version_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gf_dump_version_req); + +} +ssize_t +xdr_from_rmdir_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_rmdir_req); + +} +ssize_t +xdr_from_unlink_req (struct iovec outmsg, void *req) +{ + return xdr_serialize_generic (outmsg, (void *)req, + (xdrproc_t)xdr_gfs3_unlink_req); + +} + +/* Client decode */ + +ssize_t +xdr_to_lookup_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_lookup_rsp); + +} + +ssize_t +xdr_to_stat_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_stat_rsp); + +} + +ssize_t +xdr_to_fstat_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fstat_rsp); + +} + +ssize_t +xdr_to_mkdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_mkdir_rsp); + +} + +ssize_t +xdr_to_mknod_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_mknod_rsp); + +} + +ssize_t +xdr_to_symlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_symlink_rsp); + +} + +ssize_t +xdr_to_readlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readlink_rsp); + +} + +ssize_t +xdr_to_rename_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rename_rsp); + +} + +ssize_t +xdr_to_link_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_link_rsp); + +} + +ssize_t +xdr_to_create_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_create_rsp); + +} + +ssize_t +xdr_to_open_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_open_rsp); + +} + +ssize_t +xdr_to_opendir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_opendir_rsp); + +} + +ssize_t +xdr_to_readdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readdir_rsp); + +} + +ssize_t +xdr_to_readdirp_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_readdirp_rsp); + +} +ssize_t +xdr_to_lk_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_lk_rsp); + +} +ssize_t +xdr_to_getxattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_getxattr_rsp); + +} +ssize_t +xdr_to_fgetxattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fgetxattr_rsp); + +} +ssize_t +xdr_to_xattrop_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_xattrop_rsp); + +} +ssize_t +xdr_to_fxattrop_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fxattrop_rsp); + +} +ssize_t +xdr_to_setattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_setattr_rsp); + +} +ssize_t +xdr_to_truncate_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_truncate_rsp); + +} +ssize_t +xdr_to_ftruncate_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_ftruncate_rsp); + +} +ssize_t +xdr_to_fsetattr_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fsetattr_rsp); + +} +ssize_t +xdr_to_readv_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_read_rsp); + +} +ssize_t +xdr_to_writev_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_write_rsp); + +} +ssize_t +xdr_to_fsync_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_fsync_rsp); + +} +ssize_t +xdr_to_statfs_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_statfs_rsp); + +} +ssize_t +xdr_to_checksum_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_checksum_rsp); + +} +ssize_t +xdr_to_rchecksum_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rchecksum_rsp); + +} +ssize_t +xdr_to_getspec_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_getspec_rsp); + +} +ssize_t +xdr_to_setvolume_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_setvolume_rsp); + +} +ssize_t +xdr_to_dump_version_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_dump_version_rsp); + +} +ssize_t +xdr_to_rmdir_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_rmdir_rsp); + +} +ssize_t +xdr_to_unlink_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gfs3_unlink_rsp); + +} +ssize_t +xdr_to_common_rsp (struct iovec outmsg, void *rsp) +{ + return xdr_to_generic (outmsg, (void *)rsp, + (xdrproc_t)xdr_gf_common_rsp); + +} diff --git a/xlators/protocol/lib/src/msg-xdr.h b/xlators/protocol/lib/src/msg-xdr.h new file mode 100644 index 00000000000..4c383e5a52a --- /dev/null +++ b/xlators/protocol/lib/src/msg-xdr.h @@ -0,0 +1,536 @@ +/* + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + + +#ifndef _MSG_XDR_H +#define _MSG_XDR_H + +#include <sys/uio.h> + +#include "glusterfs-xdr.h" + +#define xdr_decoded_remaining_addr(xdr) ((&xdr)->x_private) +#define xdr_decoded_remaining_len(xdr) ((&xdr)->x_handy) +#define xdr_encoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) +#define xdr_decoded_length(xdr) (((size_t)(&xdr)->x_private) - ((size_t)(&xdr)->x_base)) + + +/* FOPS */ +ssize_t +xdr_serialize_lookup_rsp (struct iovec outmsg, void *resp); + +ssize_t +xdr_serialize_getspec_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_common_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_setvolume_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_open_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_create_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_mknod_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_mkdir_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_symlink_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_link_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_rename_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_writev_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_readv_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_readdir_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_readdirp_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_opendir_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_setattr_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_fsetattr_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_truncate_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_ftruncate_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_checksum_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_statfs_rsp (struct iovec outmsg, void *rsp); + + +ssize_t +xdr_serialize_lk_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_xattrop_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_fxattrop_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_getxattr_rsp (struct iovec outmsg, void *rsp); + + +ssize_t +xdr_serialize_fgetxattr_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_unlink_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_rmdir_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_rchecksum_rsp (struct iovec outmsg, void *rsp); + + +ssize_t +xdr_serialize_fstat_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_fsync_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_readlink_rsp (struct iovec outmsg, void *rsp); + +ssize_t +xdr_serialize_stat_rsp (struct iovec outmsg, void *rsp); + + +ssize_t +xdr_to_lookup_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_getspec_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_setvolume_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_statfs_req (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_stat_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_getattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fstat_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_setattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsetattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readv_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_writev_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsetattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readlink_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_create_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_open_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_release_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_xattrop_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fxattrop_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_setxattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsetxattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_flush_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_unlink_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsync_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_ftruncate_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_truncate_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_getxattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fgetxattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_removexattr_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_entrylk_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fentrylk_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_inodelk_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_finodelk_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_lk_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_access_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_opendir_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readdirp_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readdir_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsyncdir_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_mknod_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_mkdir_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_symlink_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_rmdir_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_checksum_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_rchecksum_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_rename_req (struct iovec inmsg, void *args); + +ssize_t +xdr_to_link_req (struct iovec inmsg, void *args); + +ssize_t +xdr_from_lookup_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_getspec_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_stat_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_access_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_truncate_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_ftruncate_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_readlink_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_writev_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_readv_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_flush_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fstat_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fsync_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_open_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_unlink_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_rmdir_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fsyncdir_req (struct iovec outmsg, void *args); + + +ssize_t +xdr_from_fsetxattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_setxattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_getxattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fgetxattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_statfs_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_opendir_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_lk_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_inodelk_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_finodelk_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_entrylk_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fentrylk_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_removexattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_xattrop_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fxattrop_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_checksum_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_rchecksum_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_readdir_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_readdirp_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_setattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_fsetattr_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_symlink_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_rename_req (struct iovec outmsg, void *args); + + +ssize_t +xdr_from_link_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_rename_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_create_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_mkdir_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_mknod_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_releasedir_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_release_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_dump_version_req (struct iovec outmsg, void *args); + +ssize_t +xdr_from_setvolume_req (struct iovec outmsg, void *args); + +ssize_t +xdr_to_setvolume_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_dump_version_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_serialize_dump_version_rsp (struct iovec outmsg, void *args); + +ssize_t +xdr_to_dump_version_req (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_statfs_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_stat_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fstat_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_rename_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readlink_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_link_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_access_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_truncate_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_ftruncate_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_unlink_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_rmdir_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_open_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_create_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_mkdir_rsp (struct iovec inmsg, void *args); + + +ssize_t +xdr_to_mknod_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_setattr_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fsetattr_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_common_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_getxattr_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fxattrop_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_xattrop_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_symlink_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_fgetxattr_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_checksum_rsp (struct iovec inmsg, void *args); +ssize_t +xdr_to_rchecksum_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_lk_rsp (struct iovec inmsg, void *args); +ssize_t +xdr_to_readdirp_rsp (struct iovec inmsg, void *args); + +ssize_t +xdr_to_readdir_rsp (struct iovec inmsg, void *args); +ssize_t +xdr_to_opendir_rsp (struct iovec inmsg, void *args); +ssize_t +xdr_to_lookup_rsp (struct iovec inmsg, void *args); +ssize_t +xdr_to_readv_rsp (struct iovec inmsg, void *args); + +#endif /* !_MSG_XDR_H */ diff --git a/xlators/protocol/lib/src/protocol-common.c b/xlators/protocol/lib/src/protocol-common.c new file mode 100644 index 00000000000..4a9845e082d --- /dev/null +++ b/xlators/protocol/lib/src/protocol-common.c @@ -0,0 +1,109 @@ +/* + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + + +#include "globals.h" +#include "compat.h" +#include "protocol-common.h" +#include "glusterfs-xdr.h" + + +static int +gf_dirent_nb_size (gf_dirent_t *entries) +{ + return (sizeof (struct gf_dirent_nb) + strlen (entries->d_name) + 1); +} + +int +gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size) +{ + struct gf_dirent_nb *entry_nb = NULL; + gf_dirent_t *entry = NULL; + int size = 0; + int entry_size = 0; + + + list_for_each_entry (entry, &entries->list, list) { + entry_size = gf_dirent_nb_size (entry); + + if (buf && (size + entry_size <= buf_size)) { + entry_nb = (void *) (buf + size); + + entry_nb->d_ino = entry->d_ino; + entry_nb->d_off = entry->d_off; + entry_nb->d_len = entry->d_len; + entry_nb->d_type = entry->d_type; + + gf_stat_from_iatt (&entry_nb->d_stat, &entry->d_stat); + + strcpy (entry_nb->d_name, entry->d_name); + } + size += entry_size; + } + + return size; +} + + +int +gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size) +{ + struct gf_dirent_nb *entry_nb = NULL; + int remaining_size = 0; + int least_dirent_size = 0; + int count = 0; + gf_dirent_t *entry = NULL; + int entry_strlen = 0; + int entry_len = 0; + + + remaining_size = buf_size; + least_dirent_size = (sizeof (struct gf_dirent_nb) + 2); + + while (remaining_size >= least_dirent_size) { + entry_nb = (void *)(buf + (buf_size - remaining_size)); + + entry_strlen = strnlen (entry_nb->d_name, remaining_size); + if (entry_strlen == remaining_size) { + break; + } + + entry_len = sizeof (gf_dirent_t) + entry_strlen + 1; + entry = GF_CALLOC (1, entry_len, gf_common_mt_gf_dirent_t); + if (!entry) { + break; + } + + entry->d_ino = entry_nb->d_ino; + entry->d_off = entry_nb->d_off; + entry->d_len = entry_nb->d_len; + entry->d_type = entry_nb->d_type; + + gf_stat_to_iatt (&entry_nb->d_stat, &entry->d_stat); + + strcpy (entry->d_name, entry_nb->d_name); + + list_add_tail (&entry->list, &entries->list); + + remaining_size -= (sizeof (*entry_nb) + entry_strlen + 1); + count++; + } + + return count; +} diff --git a/xlators/protocol/lib/src/protocol-common.h b/xlators/protocol/lib/src/protocol-common.h new file mode 100644 index 00000000000..98a79d0fa17 --- /dev/null +++ b/xlators/protocol/lib/src/protocol-common.h @@ -0,0 +1,104 @@ +/* + Copyright (c) 2007-2010 Gluster, Inc. <http://www.gluster.com> + This file is part of GlusterFS. + + GlusterFS is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + GlusterFS is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + <http://www.gnu.org/licenses/>. +*/ + +#ifndef _PROTOCOL_COMMON_H +#define _PROTOCOL_COMMON_H + +#define GF_PROTOCOL_DEFAULT_PORT 6971 + +#define GF_LOCAL_IOV 1 /* All headers are here */ +#define GF_EXTRA_IOV 2 /* needed for write/read etc */ + +enum gf_fop_procnum { + GFS3_OP_NULL, /* 0 */ + GFS3_OP_STAT, + GFS3_OP_READLINK, + GFS3_OP_MKNOD, + GFS3_OP_MKDIR, + GFS3_OP_UNLINK, + GFS3_OP_RMDIR, + GFS3_OP_SYMLINK, + GFS3_OP_RENAME, + GFS3_OP_LINK, + GFS3_OP_TRUNCATE, + GFS3_OP_OPEN, + GFS3_OP_READ, + GFS3_OP_WRITE, + GFS3_OP_STATFS, + GFS3_OP_FLUSH, + GFS3_OP_FSYNC, + GFS3_OP_SETXATTR, + GFS3_OP_GETXATTR, + GFS3_OP_REMOVEXATTR, + GFS3_OP_OPENDIR, + GFS3_OP_FSYNCDIR, + GFS3_OP_ACCESS, + GFS3_OP_CREATE, + GFS3_OP_FTRUNCATE, + GFS3_OP_FSTAT, + GFS3_OP_LK, + GFS3_OP_LOOKUP, + GFS3_OP_READDIR, + GFS3_OP_INODELK, + GFS3_OP_FINODELK, + GFS3_OP_ENTRYLK, + GFS3_OP_FENTRYLK, + GFS3_OP_CHECKSUM, + GFS3_OP_XATTROP, + GFS3_OP_FXATTROP, + GFS3_OP_FGETXATTR, + GFS3_OP_FSETXATTR, + GFS3_OP_RCHECKSUM, + GFS3_OP_SETATTR, + GFS3_OP_FSETATTR, + GFS3_OP_READDIRP, + GFS3_OP_RELEASE, + GFS3_OP_RELEASEDIR, + GFS3_OP_MAXVALUE, +} ; + +enum gf_handshake_procnum { + GF_HNDSK_NULL, + GF_HNDSK_DUMP_VERSION, + GF_HNDSK_SETVOLUME, + GF_HNDSK_GETSPEC, + GF_HNDSK_PING, +}; + +enum gf_mgmt_procnum { + GF1_MGMT_NULL, /* 0 */ +}; + + +#define GLUSTER3_1_FOP_PROGRAM 1298437 /* Completely random */ +#define GLUSTER3_1_FOP_VERSION 310 /* 3.1.0 */ +#define GLUSTER3_1_FOP_PROCCNT GFS3_OP_MAXVALUE + +#define GLUSTER1_MGMT_PROGRAM 1298433 /* Completely random */ +#define GLUSTER1_MGMT_VERSION 1 /* 0.0.1 */ + +#define GLUSTER_HNDSK_PROGRAM 14398633 /* Completely random */ +#define GLUSTER_HNDSK_VERSION 1 /* 0.0.1 */ + +int +gf_dirent_unserialize (gf_dirent_t *entries, const char *buf, size_t buf_size); +int +gf_dirent_serialize (gf_dirent_t *entries, char *buf, size_t buf_size); + +#endif /* !_PROTOCOL_COMMON_H */ |