summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server/src/server-helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/server/src/server-helpers.c')
-rw-r--r--xlators/protocol/server/src/server-helpers.c2439
1 files changed, 2439 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index dc127a6..09183e8 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -13,6 +13,9 @@
#include "gidcache.h"
#include "server-messages.h"
#include "syscall.h"
+#include "defaults.h"
+#include "default-args.h"
+#include "server-common.h"
#include <fnmatch.h>
#include <pwd.h>
@@ -1345,3 +1348,2439 @@ unserialize_req_locklist (gfs3_setactivelk_req *req,
out:
return ret;
}
+
+int
+server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
+ default_args_t *this_args,
+ int index)
+{
+ int op_errno = 0;
+ int ret = -1;
+ struct iovec req_iovec[MAX_IOVEC] = { {0,} };
+ compound_req *this_req = NULL;
+ server_state_t *state = CALL_STATE (frame);
+
+ this_req = &req->compound_req_array.compound_req_array_val[index];
+
+ switch (this_req->fop_enum) {
+ case GF_FOP_STAT:
+ {
+ gfs3_stat_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_stat_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_stat_store (this_args, &state->loc, this_args->xdata);
+ break;
+ }
+ case GF_FOP_READLINK:
+ {
+ gfs3_readlink_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_readlink_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_readlink_store (this_args, &state->loc,
+ args->size, this_args->xdata);
+ break;
+ }
+ case GF_FOP_MKNOD:
+ {
+ gfs3_mknod_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_mknod_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_mknod_store (this_args, &state->loc, args->mode,
+ args->dev, args->umask,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_MKDIR:
+ {
+ gfs3_mkdir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_mkdir_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_mkdir_store (this_args, &state->loc, args->mode,
+ args->umask, this_args->xdata);
+ break;
+ }
+ case GF_FOP_UNLINK:
+ {
+ gfs3_unlink_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_unlink_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_unlink_store (this_args, &state->loc,
+ args->xflags, this_args->xdata);
+ break;
+ }
+ case GF_FOP_RMDIR:
+ {
+ gfs3_rmdir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_rmdir_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_rmdir_store (this_args, &state->loc,
+ args->xflags, this_args->xdata);
+ break;
+ }
+ case GF_FOP_SYMLINK:
+ {
+ gfs3_symlink_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_symlink_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_symlink_store (this_args, args->linkname,
+ &state->loc,
+ args->umask, this_args->xdata);
+
+ this_args->loc.inode = inode_new (state->itable);
+
+ break;
+ }
+ case GF_FOP_RENAME:
+ {
+ gfs3_rename_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_rename_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_rename_store (this_args, &state->loc,
+ &state->loc2, this_args->xdata);
+ break;
+ }
+ case GF_FOP_LINK:
+ {
+ gfs3_link_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_link_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_link_store (this_args, &state->loc,
+ &state->loc2, this_args->xdata);
+
+ this_args->loc2.inode = inode_ref (this_args->loc.inode);
+
+ break;
+ }
+ case GF_FOP_TRUNCATE:
+ {
+ gfs3_truncate_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_truncate_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_truncate_store (this_args, &state->loc,
+ args->offset, this_args->xdata);
+ break;
+ }
+ case GF_FOP_OPEN:
+ {
+ gfs3_open_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_open_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_open_store (this_args, &state->loc,
+ args->flags, state->fd, this_args->xdata);
+
+ this_args->fd = fd_create (this_args->loc.inode,
+ frame->root->pid);
+ this_args->fd->flags = this_args->flags;
+
+ break;
+ }
+ case GF_FOP_READ:
+ {
+ gfs3_read_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_read_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_readv_store (this_args, state->fd, args->size,
+ args->offset, args->flag,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_WRITE:
+ {
+ gfs3_write_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_write_req;
+
+ /*TODO : What happens when payload count is more than one? */
+ req_iovec[0].iov_base = state->payload_vector[0].iov_base +
+ state->write_length;
+ req_iovec[0].iov_len = args->size;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_writev_store (this_args, state->fd,
+ req_iovec,
+ args->size, args->offset,
+ args->flag,
+ this_args->iobref, this_args->xdata);
+ state->write_length += args->size;
+ break;
+ }
+ case GF_FOP_STATFS:
+ {
+ gfs3_statfs_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_statfs_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_statfs_store (this_args, &state->loc,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_FLUSH:
+ {
+ gfs3_flush_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_flush_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_flush_store (this_args, state->fd, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FSYNC:
+ {
+ gfs3_fsync_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fsync_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_fsync_store (this_args, state->fd,
+ args->data, this_args->xdata);
+ break;
+ }
+ case GF_FOP_SETXATTR:
+ {
+ gfs3_setxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_setxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xattr,
+ args->dict.dict_val,
+ args->dict.dict_len, ret,
+ op_errno, out);
+ args_setxattr_store (this_args, &state->loc,
+ this_args->xattr, args->flags,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ {
+ gfs3_getxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_getxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ gf_server_check_getxattr_cmd (frame, args->name);
+
+ args_getxattr_store (this_args, &state->loc,
+ args->name, this_args->xdata);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR:
+ {
+ gfs3_removexattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_removexattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_removexattr_store (this_args, &state->loc,
+ args->name,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_OPENDIR:
+ {
+ gfs3_opendir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_opendir_req;
+
+ this_args->fd = fd_create (this_args->loc.inode,
+ frame->root->pid);
+ if (!this_args->fd) {
+ gf_msg ("server", GF_LOG_ERROR, 0,
+ PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
+ goto out;
+ }
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_opendir_store (this_args, &state->loc,
+ state->fd, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FSYNCDIR:
+ {
+ gfs3_fsyncdir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fsyncdir_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_fsyncdir_store (this_args, state->fd,
+ args->data, this_args->xdata);
+ break;
+ }
+ case GF_FOP_ACCESS:
+ {
+ gfs3_access_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_access_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_access_store (this_args, &state->loc,
+ args->mask, this_args->xdata);
+ break;
+ }
+ case GF_FOP_CREATE:
+ {
+ gfs3_create_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_create_req;
+
+ state->loc.inode = inode_new (state->itable);
+
+ state->fd = fd_create (state->loc.inode, frame->root->pid);
+ if (!state->fd) {
+ gf_msg ("server", GF_LOG_ERROR, 0,
+ PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ?
+ uuid_utoa (state->loc.inode->gfid):NULL);
+ goto out;
+ }
+ state->fd->flags = state->flags;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_create_store (this_args, &state->loc,
+ args->flags, args->mode,
+ args->umask, state->fd,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_FTRUNCATE:
+ {
+ gfs3_ftruncate_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_ftruncate_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_ftruncate_store (this_args, state->fd,
+ args->offset,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_FSTAT:
+ {
+ gfs3_fstat_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fstat_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_fstat_store (this_args, state->fd, this_args->xdata);
+ break;
+ }
+ case GF_FOP_LK:
+ {
+ gfs3_lk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_lk_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ switch (args->cmd) {
+ case GF_LK_GETLK:
+ this_args->cmd = F_GETLK;
+ break;
+ case GF_LK_SETLK:
+ this_args->cmd = F_SETLK;
+ break;
+ case GF_LK_SETLKW:
+ this_args->cmd = F_SETLKW;
+ break;
+ case GF_LK_RESLK_LCK:
+ this_args->cmd = F_RESLK_LCK;
+ break;
+ case GF_LK_RESLK_LCKW:
+ this_args->cmd = F_RESLK_LCKW;
+ break;
+ case GF_LK_RESLK_UNLCK:
+ this_args->cmd = F_RESLK_UNLCK;
+ break;
+ case GF_LK_GETLK_FD:
+ this_args->cmd = F_GETLK_FD;
+ break;
+ }
+
+ gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+
+ switch (args->type) {
+ case GF_LK_F_RDLCK:
+ this_args->lock.l_type = F_RDLCK;
+ break;
+ case GF_LK_F_WRLCK:
+ this_args->lock.l_type = F_WRLCK;
+ break;
+ case GF_LK_F_UNLCK:
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ default:
+ gf_msg (frame->root->client->bound_xl->name,
+ GF_LOG_ERROR,
+ 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s):"
+ " Unknown "
+ "lock type: %"PRId32"!", state->resolve.fd_no,
+ uuid_utoa (state->fd->inode->gfid),
+ args->type);
+ break;
+ }
+ args_lk_store (this_args, state->fd, this_args->cmd,
+ &this_args->lock, this_args->xdata);
+ break;
+ }
+ case GF_FOP_LOOKUP:
+ {
+ gfs3_lookup_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_lookup_req;
+
+ if (this_args->loc.inode)
+ this_args->loc.inode = server_inode_new (state->itable,
+ state->loc.gfid);
+ else
+ state->is_revalidate = 1;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_lookup_store (this_args, &state->loc, this_args->xdata);
+ break;
+ }
+ case GF_FOP_READDIR:
+ {
+ gfs3_readdir_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_readdir_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_readdir_store (this_args, state->fd, args->size,
+ args->offset, this_args->xdata);
+ break;
+ }
+ case GF_FOP_INODELK:
+ {
+ gfs3_inodelk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_inodelk_req;
+
+ switch (args->cmd) {
+ case GF_LK_GETLK:
+ this_args->cmd = F_GETLK;
+ break;
+ case GF_LK_SETLK:
+ this_args->cmd = F_SETLK;
+ break;
+ case GF_LK_SETLKW:
+ this_args->cmd = F_SETLKW;
+ break;
+ }
+
+ gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+
+ switch (args->type) {
+ case GF_LK_F_RDLCK:
+ this_args->lock.l_type = F_RDLCK;
+ break;
+ case GF_LK_F_WRLCK:
+ this_args->lock.l_type = F_WRLCK;
+ break;
+ case GF_LK_F_UNLCK:
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_inodelk_store (this_args, args->volume, &state->loc,
+ this_args->cmd,
+ &this_args->lock, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FINODELK:
+ {
+ gfs3_finodelk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_finodelk_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ switch (args->cmd) {
+ case GF_LK_GETLK:
+ this_args->cmd = F_GETLK;
+ break;
+ case GF_LK_SETLK:
+ this_args->cmd = F_SETLK;
+ break;
+ case GF_LK_SETLKW:
+ this_args->cmd = F_SETLKW;
+ break;
+ }
+
+ gf_proto_flock_to_flock (&args->flock, &this_args->lock);
+
+ switch (args->type) {
+ case GF_LK_F_RDLCK:
+ this_args->lock.l_type = F_RDLCK;
+ break;
+ case GF_LK_F_WRLCK:
+ this_args->lock.l_type = F_WRLCK;
+ break;
+ case GF_LK_F_UNLCK:
+ this_args->lock.l_type = F_UNLCK;
+ break;
+ }
+ args_finodelk_store (this_args, args->volume, state->fd,
+ this_args->cmd,
+ &this_args->lock, this_args->xdata);
+ break;
+ }
+ case GF_FOP_ENTRYLK:
+ {
+ gfs3_entrylk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_entrylk_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_entrylk_store (this_args, args->volume, &state->loc,
+ args->name, args->cmd, args->type,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_FENTRYLK:
+ {
+ gfs3_fentrylk_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fentrylk_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_fentrylk_store (this_args, args->volume, state->fd,
+ args->name, args->cmd, args->type,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_XATTROP:
+ {
+ gfs3_xattrop_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_xattrop_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xattr,
+ (args->dict.dict_val),
+ (args->dict.dict_len), ret,
+ op_errno, out);
+ args_xattrop_store (this_args, &state->loc, args->flags,
+ this_args->xattr, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ gfs3_fxattrop_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fxattrop_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xattr,
+ (args->dict.dict_val),
+ (args->dict.dict_len), ret,
+ op_errno, out);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_fxattrop_store (this_args, state->fd, args->flags,
+ this_args->xattr, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ {
+ gfs3_fgetxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fgetxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_fgetxattr_store (this_args, state->fd,
+ args->name, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FSETXATTR:
+ {
+ gfs3_fsetxattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fsetxattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xattr,
+ (args->dict.dict_val),
+ (args->dict.dict_len), ret,
+ op_errno, out);
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_fsetxattr_store (this_args, state->fd, this_args->xattr,
+ args->flags, this_args->xdata);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ {
+ gfs3_rchecksum_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_rchecksum_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_rchecksum_store (this_args, state->fd, args->offset,
+ args->len, this_args->xdata);
+ break;
+ }
+ case GF_FOP_SETATTR:
+ {
+ gfs3_setattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_setattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ gf_stat_to_iatt (&args->stbuf, &this_args->stat);
+
+ args_setattr_store (this_args, &state->loc, &this_args->stat,
+ args->valid, this_args->xdata);
+ break;
+ }
+ case GF_FOP_FSETATTR:
+ {
+ gfs3_fsetattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fsetattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ gf_stat_to_iatt (&args->stbuf, &this_args->stat);
+
+ args_fsetattr_store (this_args, state->fd, &this_args->stat,
+ args->valid, this_args->xdata);
+ break;
+ }
+ case GF_FOP_READDIRP:
+ {
+ gfs3_readdirp_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_readdirp_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xattr,
+ (args->dict.dict_val),
+ (args->dict.dict_len), ret,
+ op_errno, out);
+
+ args_readdirp_store (this_args, state->fd, args->size,
+ args->offset, this_args->xattr);
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR:
+ {
+ gfs3_fremovexattr_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fremovexattr_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_fremovexattr_store (this_args, state->fd, args->name,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_FALLOCATE:
+ {
+ gfs3_fallocate_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_fallocate_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_fallocate_store (this_args, state->fd, args->flags,
+ args->offset, args->size,
+ this_args->xdata);
+ break;
+ }
+ case GF_FOP_DISCARD:
+ {
+ gfs3_discard_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_discard_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ args_discard_store (this_args, state->fd, args->offset,
+ args->size, this_args->xdata);
+ break;
+ }
+ case GF_FOP_ZEROFILL:
+ {
+ gfs3_zerofill_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_zerofill_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_zerofill_store (this_args, state->fd, args->offset,
+ args->size, this_args->xdata);
+ break;
+ }
+ case GF_FOP_SEEK:
+ {
+ gfs3_seek_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_seek_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+ args_seek_store (this_args, state->fd, args->offset,
+ args->what, this_args->xdata);
+ break;
+ }
+ case GF_FOP_LEASE:
+ {
+ gfs3_lease_req *args = NULL;
+
+ args = &this_req->compound_req_u.compound_lease_req;
+
+ GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
+ this_args->xdata,
+ args->xdata.xdata_val,
+ args->xdata.xdata_len, ret,
+ op_errno, out);
+
+ gf_proto_lease_to_lease (&args->lease, &state->lease);
+
+ args_lease_store (this_args, &state->loc, &state->lease,
+ this_args->xdata);
+ break;
+ }
+ default:
+ return ENOTSUP;
+ }
+out:
+ return op_errno;
+}
+
+int
+server_populate_compound_response (xlator_t *this, gfs3_compound_rsp *rsp,
+ call_frame_t *frame,
+ compound_args_cbk_t *args_cbk, int index)
+{
+ int op_errno = ENOMEM;
+ int op_ret = -1;
+ default_args_cbk_t *this_args_cbk = NULL;
+ compound_rsp *this_rsp = NULL;
+ server_state_t *state = NULL;
+ int ret = 0;
+
+ state = CALL_STATE (frame);
+ rsp->compound_rsp_array.compound_rsp_array_val = GF_CALLOC
+ (args_cbk->fop_length,
+ sizeof (compound_rsp),
+ gf_server_mt_compound_rsp_t);
+
+ rsp->compound_rsp_array.compound_rsp_array_len = args_cbk->fop_length;
+
+ this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[index];
+
+ this_args_cbk = &args_cbk->rsp_list[index];
+ switch (this_rsp->fop_enum) {
+ case GF_FOP_STAT:
+ {
+ gfs3_stat_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_stat_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_stat (rsp_args,
+ &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READLINK:
+ {
+ gfs3_readlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readlink_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_readlink (rsp_args, &this_args_cbk->stat,
+ this_args_cbk->buf);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_MKNOD:
+ {
+ gfs3_mknod_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_mknod_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_mknod (state, rsp_args,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ this_args_cbk->inode);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_MKDIR:
+ {
+ gfs3_mkdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_mkdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_mkdir (state, rsp_args,
+ this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_UNLINK:
+ {
+ gfs3_unlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_unlink_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_unlink (state, rsp_args,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RMDIR:
+ {
+ gfs3_rmdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rmdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_rmdir (state, rsp_args,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SYMLINK:
+ {
+ gfs3_symlink_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_symlink_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_symlink (state, rsp_args,
+ this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RENAME:
+ {
+ gfs3_rename_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rename_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_rename (frame, state, rsp_args,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ &this_args_cbk->preparent2,
+ &this_args_cbk->postparent2);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_LINK:
+ {
+ gfs3_link_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_link_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_link (state, rsp_args,
+ this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent,
+ this_args_cbk->xdata);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_TRUNCATE:
+ {
+ gfs3_truncate_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_truncate_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_truncate (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_OPEN:
+ {
+ gfs3_open_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_open_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_open (frame, this, rsp_args,
+ this_args_cbk->fd);
+
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READ:
+ {
+ gfs3_read_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_read_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_readv (rsp_args, &this_args_cbk->stat,
+ this_args_cbk->op_ret);
+
+ if (!state->rsp_iobref) {
+ state->rsp_iobref = this_args_cbk->iobref;
+ state->rsp_count = 0;
+ }
+ iobref_merge (state->rsp_iobref,
+ this_args_cbk->iobref);
+ memcpy (&state->rsp_vector[state->rsp_count],
+ this_args_cbk->vector,
+ (this_args_cbk->count *
+ sizeof(state->rsp_vector[0])));
+ state->rsp_count += this_args_cbk->count;
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_WRITE:
+ {
+ gfs3_write_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_write_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret >= 0) {
+ server_post_writev (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_STATFS:
+ {
+ gfs3_statfs_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_statfs_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_statfs (rsp_args,
+ &this_args_cbk->statvfs);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FLUSH:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_flush_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSYNC:
+ {
+ gfs3_fsync_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsync_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_fsync (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SETXATTR:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ {
+ gfs3_getxattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_getxattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (-1 != this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE (this,
+ this_args_cbk->xattr,
+ &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len,
+ rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_removexattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_OPENDIR:
+ {
+ gfs3_opendir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_opendir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_opendir (frame, this, rsp_args,
+ this_args_cbk->fd);
+
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSYNCDIR:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsyncdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_ACCESS:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_access_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_CREATE:
+ {
+ gfs3_create_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_create_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+
+ if (!this_args_cbk->op_ret) {
+ rsp_args->op_ret = server_post_create (frame,
+ rsp_args, state, this,
+ this_args_cbk->fd,
+ this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->preparent,
+ &this_args_cbk->postparent);
+ if (rsp_args->op_ret) {
+ rsp_args->op_errno = -rsp_args->op_ret;
+ rsp_args->op_ret = -1;
+ }
+ }
+ break;
+ }
+ case GF_FOP_FTRUNCATE:
+ {
+ gfs3_ftruncate_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_ftruncate_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_ftruncate (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSTAT:
+ {
+ gfs3_fstat_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fstat_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ if (!this_args_cbk->op_ret) {
+ server_post_fstat (rsp_args,
+ &this_args_cbk->stat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_LK:
+ {
+ gfs3_lk_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_lk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_lk (this, rsp_args, &this_args_cbk->lock);
+ }
+
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_LOOKUP:
+ {
+ gfs3_lookup_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_lookup_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_lookup (rsp_args, frame, state,
+ this_args_cbk->inode,
+ &this_args_cbk->stat,
+ &this_args_cbk->postparent);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READDIR:
+ {
+ gfs3_readdir_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readdir_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+
+ if (this_args_cbk->op_ret > 0) {
+ ret = server_post_readdir (rsp_args,
+ &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
+ }
+ }
+ break;
+ }
+ case GF_FOP_INODELK:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_inodelk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FINODELK:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_finodelk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_ENTRYLK:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_entrylk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FENTRYLK:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fentrylk_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_XATTROP:
+ {
+ gfs3_xattrop_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_xattrop_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE (this,
+ this_args_cbk->xattr,
+ &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len,
+ rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ gfs3_fxattrop_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fxattrop_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE (this,
+ this_args_cbk->xattr,
+ &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len,
+ rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ {
+ gfs3_fgetxattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fgetxattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (-1 != this_args_cbk->op_ret) {
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xattr,
+ &rsp_args->dict.dict_val,
+ rsp_args->dict.dict_len,
+ rsp_args->op_errno, out);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSETXATTR:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setxattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ {
+ gfs3_rchecksum_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_rchecksum_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_rchecksum (rsp_args,
+ this_args_cbk->weak_checksum,
+ this_args_cbk->strong_checksum);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SETATTR:
+ {
+ gfs3_setattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_setattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_setattr (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FSETATTR:
+ {
+ gfs3_fsetattr_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fsetattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_fsetattr (rsp_args, &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_READDIRP:
+ {
+ gfs3_readdirp_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_readdirp_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (this_args_cbk->op_ret > 0) {
+ ret = server_post_readdirp (rsp_args,
+ &this_args_cbk->entries);
+ if (ret < 0) {
+ rsp_args->op_ret = ret;
+ rsp_args->op_errno = ENOMEM;
+ goto out;
+ }
+ gf_link_inodes_from_dirent (this, state->fd->inode,
+ &this_args_cbk->entries);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR:
+ {
+ gf_common_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fremovexattr_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_FALLOCATE:
+ {
+ gfs3_fallocate_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_fallocate_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_fallocate (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_DISCARD:
+ {
+ gfs3_discard_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_discard_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_discard (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_ZEROFILL:
+ {
+ gfs3_zerofill_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_zerofill_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_zerofill (rsp_args,
+ &this_args_cbk->prestat,
+ &this_args_cbk->poststat);
+ }
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_SEEK:
+ {
+ gfs3_seek_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_seek_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ case GF_FOP_LEASE:
+ {
+ gfs3_lease_rsp *rsp_args = NULL;
+
+ rsp_args = &this_rsp->compound_rsp_u.compound_lease_rsp;
+
+ GF_PROTOCOL_DICT_SERIALIZE (this, this_args_cbk->xdata,
+ &rsp_args->xdata.xdata_val,
+ rsp_args->xdata.xdata_len,
+ rsp_args->op_errno, out);
+
+ if (!this_args_cbk->op_ret) {
+ server_post_lease (rsp_args, &this_args_cbk->lease);
+ }
+
+ rsp_args->op_ret = this_args_cbk->op_ret;
+ rsp_args->op_errno = gf_errno_to_error
+ (this_args_cbk->op_errno);
+ break;
+ }
+ default:
+ return ENOTSUP;
+ }
+out:
+ return op_errno;
+}
+/* This works only when the compound fop acts on one loc/inode/gfid.
+ * If compound fops on more than one inode is required, multiple
+ * resolve and resumes will have to be done. This will have to change.
+ * Right now, multiple unlinks, rmdirs etc is are not supported.
+ * This can be added for future enhancements.
+ */
+int
+server_get_compound_resolve (server_state_t *state, gfs3_compound_req *req)
+{
+ int i = 0;
+ compound_req *array = &req->compound_req_array.compound_req_array_val[i];
+
+ switch (array->fop_enum) {
+ case GF_FOP_STAT:
+ {
+ gfs3_stat_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_stat_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_READLINK:
+ {
+ gfs3_readlink_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_readlink_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_MKNOD:
+ {
+ gfs3_mknod_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_mknod_req;
+
+ state->resolve.type = RESOLVE_NOT;
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_MKDIR:
+ {
+ gfs3_mkdir_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_mkdir_req;
+
+ state->resolve.type = RESOLVE_NOT;
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_UNLINK:
+ {
+ gfs3_unlink_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_unlink_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_RMDIR:
+ {
+ gfs3_rmdir_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_rmdir_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_SYMLINK:
+ {
+ gfs3_symlink_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_symlink_req;
+
+ state->resolve.type = RESOLVE_NOT;
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_RENAME:
+ {
+ gfs3_rename_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_rename_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.bname = gf_strdup
+ (this_req.oldbname);
+ memcpy (state->resolve.pargfid, this_req.oldgfid, 16);
+
+ state->resolve2.type = RESOLVE_MAY;
+ state->resolve2.bname = gf_strdup
+ (this_req.newbname);
+ memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
+ }
+ case GF_FOP_LINK:
+ {
+ gfs3_link_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_link_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid, this_req.oldgfid, 16);
+
+ state->resolve2.type = RESOLVE_NOT;
+ state->resolve2.bname = gf_strdup
+ (this_req.newbname);
+ memcpy (state->resolve2.pargfid, this_req.newgfid, 16);
+ break;
+ }
+ case GF_FOP_TRUNCATE:
+ {
+ gfs3_truncate_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_truncate_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_OPEN:
+ {
+ gfs3_open_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_open_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_READ:
+ {
+ gfs3_read_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_read_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_WRITE:
+ {
+ gfs3_write_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_write_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_STATFS:
+ {
+ gfs3_statfs_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_statfs_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FLUSH:
+ {
+ gfs3_flush_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_flush_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FSYNC:
+ {
+ gfs3_fsync_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fsync_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_SETXATTR:
+ {
+ gfs3_setxattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_setxattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_GETXATTR:
+ {
+ gfs3_getxattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_getxattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_REMOVEXATTR:
+ {
+ gfs3_removexattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_removexattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_OPENDIR:
+ {
+ gfs3_opendir_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_opendir_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FSYNCDIR:
+ {
+ gfs3_fsyncdir_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fsyncdir_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_ACCESS:
+ {
+ gfs3_access_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_access_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_CREATE:
+ {
+ gfs3_create_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_create_req;
+
+ state->flags = gf_flags_to_flags (this_req.flags);
+ if (state->flags & O_EXCL) {
+ state->resolve.type = RESOLVE_NOT;
+ } else {
+ state->resolve.type = RESOLVE_DONTCARE;
+ }
+
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ break;
+ }
+ case GF_FOP_FTRUNCATE:
+ {
+ gfs3_ftruncate_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_ftruncate_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FSTAT:
+ {
+ gfs3_fstat_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fstat_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_LK:
+ {
+ gfs3_lk_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_lk_req;
+
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_LOOKUP:
+ {
+ gfs3_lookup_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_lookup_req;
+ state->resolve.type = RESOLVE_DONTCARE;
+
+ if (this_req.bname && strcmp (this_req.bname, "")) {
+ memcpy (state->resolve.pargfid, this_req.pargfid, 16);
+ state->resolve.bname = gf_strdup
+ (this_req.bname);
+ } else {
+ memcpy (state->resolve.gfid, this_req.gfid, 16);
+ }
+ break;
+ }
+ case GF_FOP_READDIR:
+ {
+ gfs3_readdir_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_readdir_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_INODELK:
+ {
+ gfs3_inodelk_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_inodelk_req;
+
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FINODELK:
+ {
+ gfs3_finodelk_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_finodelk_req;
+
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_ENTRYLK:
+ {
+ gfs3_entrylk_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_entrylk_req;
+
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FENTRYLK:
+ {
+ gfs3_fentrylk_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fentrylk_req;
+
+ state->resolve.type = RESOLVE_EXACT;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_XATTROP:
+ {
+ gfs3_xattrop_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_xattrop_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FXATTROP:
+ {
+ gfs3_fxattrop_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fxattrop_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FGETXATTR:
+ {
+ gfs3_fgetxattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fgetxattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FSETXATTR:
+ {
+ gfs3_fsetxattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fsetxattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_RCHECKSUM:
+ {
+ gfs3_rchecksum_req this_req = {0,};
+
+ this_req = array[i].compound_req_u.compound_rchecksum_req;
+
+ state->resolve.type = RESOLVE_MAY;
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_SETATTR:
+ {
+ gfs3_setattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_setattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ break;
+ }
+ case GF_FOP_FSETATTR:
+ {
+ gfs3_fsetattr_req this_req = {0,};
+
+ this_req = array[i].compound_req_u.compound_fsetattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_READDIRP:
+ {
+ gfs3_readdirp_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_readdirp_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FREMOVEXATTR:
+ {
+ gfs3_fremovexattr_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fremovexattr_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_FALLOCATE:
+ {
+ gfs3_fallocate_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_fallocate_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_DISCARD:
+ {
+ gfs3_discard_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_discard_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_ZEROFILL:
+ {
+ gfs3_zerofill_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_zerofill_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_SEEK:
+ {
+ gfs3_seek_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_seek_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid,
+ this_req.gfid, 16);
+ state->resolve.fd_no = this_req.fd;
+ break;
+ }
+ case GF_FOP_LEASE:
+ {
+ gfs3_lease_req this_req = { {0,} };
+
+ this_req = array[i].compound_req_u.compound_lease_req;
+
+ state->resolve.type = RESOLVE_MUST;
+ memcpy (state->resolve.gfid, this_req.gfid, 16);
+ break;
+ }
+ default:
+ return ENOTSUP;
+ }
+ return 0;
+}