summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/protocol.h
Commit message (Expand)AuthorAgeFilesLines
* Add extra 'volume' parameter to inodelk/entrylk callsVikas Gorur2009-03-121-0/+4
* added fgetxattr and fsetxattr FOPsVikas Gorur2009-03-071-0/+23
* updated copyright header to extend copyright upto 2009Basavanagowda Kanur2009-02-261-1/+1
* added lock_notify and lock_fnotify FOPs to everywhere necessary in libgluster...Vikas Gorur2009-02-231-0/+14
* Added all filesVikas Gorur2009-02-181-0/+777
otocol/client: whitespace cleanup
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client-protocol.c7228
-rw-r--r--xlators/protocol/client/src/client-protocol.h34
2 files changed, 3631 insertions, 3631 deletions
diff --git a/xlators/protocol/client/src/client-protocol.c b/xlators/protocol/client/src/client-protocol.c
index e82caeb5d6e..38a36e28fd3 100644
--- a/xlators/protocol/client/src/client-protocol.c
+++ b/xlators/protocol/client/src/client-protocol.c
@@ -93,83 +93,83 @@ ret:
client_fd_ctx_t *
this_fd_del_ctx (fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO ("client", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, file, out);
- dict_ret = fd_ctx_del (file, this, &ctxaddr);
+ dict_ret = fd_ctx_del (file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (client_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (client_fd_ctx_t *)(unsigned long)ctxaddr;
}
client_fd_ctx_t *
this_fd_get_ctx (fd_t *file, xlator_t *this)
{
- int dict_ret = -1;
- uint64_t ctxaddr = 0;
+ int dict_ret = -1;
+ uint64_t ctxaddr = 0;
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
+ GF_VALIDATE_OR_GOTO ("client", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, file, out);
- dict_ret = fd_ctx_get (file, this, &ctxaddr);
+ dict_ret = fd_ctx_get (file, this, &ctxaddr);
- if (dict_ret < 0) {
- ctxaddr = 0;
- }
+ if (dict_ret < 0) {
+ ctxaddr = 0;
+ }
out:
- return (client_fd_ctx_t *)(unsigned long)ctxaddr;
+ return (client_fd_ctx_t *)(unsigned long)ctxaddr;
}
static void
this_fd_set_ctx (fd_t *file, xlator_t *this, loc_t *loc, client_fd_ctx_t *ctx)
{
- uint64_t oldaddr = 0;
- int32_t ret = -1;
-
- GF_VALIDATE_OR_GOTO ("client", this, out);
- GF_VALIDATE_OR_GOTO (this->name, file, out);
-
- ret = fd_ctx_get (file, this, &oldaddr);
- if (ret >= 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s (%"PRId64"): trying duplicate remote fd set. ",
- loc->path, loc->inode->ino);
- }
-
- ret = fd_ctx_set (file, this, (uint64_t)(unsigned long)ctx);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s (%"PRId64"): failed to set remote fd",
- loc->path, loc->inode->ino);
- }
+ uint64_t oldaddr = 0;
+ int32_t ret = -1;
+
+ GF_VALIDATE_OR_GOTO ("client", this, out);
+ GF_VALIDATE_OR_GOTO (this->name, file, out);
+
+ ret = fd_ctx_get (file, this, &oldaddr);
+ if (ret >= 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "%s (%"PRId64"): trying duplicate remote fd set. ",
+ loc->path, loc->inode->ino);
+ }
+
+ ret = fd_ctx_set (file, this, (uint64_t)(unsigned long)ctx);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "%s (%"PRId64"): failed to set remote fd",
+ loc->path, loc->inode->ino);
+ }
out:
- return;
+ return;
}
-static int
+static int
client_local_wipe (client_local_t *local)
{
- if (local) {
- loc_wipe (&local->loc);
+ if (local) {
+ loc_wipe (&local->loc);
+
+ if (local->fd)
+ fd_unref (local->fd);
- if (local->fd)
- fd_unref (local->fd);
+ free (local);
+ }
- free (local);
- }
-
- return 0;
+ return 0;
}
/*
@@ -183,192 +183,192 @@ client_local_wipe (client_local_t *local)
static call_frame_t *
lookup_frame (transport_t *trans, int32_t op, int8_t type, int64_t callid)
{
- client_connection_t *conn = NULL;
- call_frame_t *frame = NULL;
+ client_connection_t *conn = NULL;
+ call_frame_t *frame = NULL;
- conn = trans->xl_private;
+ conn = trans->xl_private;
- pthread_mutex_lock (&conn->lock);
- {
- frame = saved_frames_get (conn->saved_frames,
- op, type, callid);
- }
- pthread_mutex_unlock (&conn->lock);
+ pthread_mutex_lock (&conn->lock);
+ {
+ frame = saved_frames_get (conn->saved_frames,
+ op, type, callid);
+ }
+ pthread_mutex_unlock (&conn->lock);
- return frame;
+ return frame;
}
static void
call_bail (void *data)
{
- client_connection_t *conn = NULL;
- struct timeval current;
- transport_t *trans = NULL;
- struct list_head list;
- struct saved_frame *saved_frame = NULL;
- struct saved_frame *trav = NULL;
- struct saved_frame *tmp = NULL;
- call_frame_t *frame = NULL;
- gf_hdr_common_t hdr = {0, };
- char **gf_op_list = NULL;
- gf_op_t *gf_ops = NULL;
- struct tm frame_sent_tm;
- char frame_sent[32] = {0,};
+ client_connection_t *conn = NULL;
+ struct timeval current;
+ transport_t *trans = NULL;
+ struct list_head list;
+ struct saved_frame *saved_frame = NULL;
+ struct saved_frame *trav = NULL;
+ struct saved_frame *tmp = NULL;
+ call_frame_t *frame = NULL;
+ gf_hdr_common_t hdr = {0, };
+ char **gf_op_list = NULL;
+ gf_op_t *gf_ops = NULL;
+ struct tm frame_sent_tm;
+ char frame_sent[32] = {0,};
struct timeval timeout = {0,};
gf_timer_cbk_t timer_cbk = NULL;
- GF_VALIDATE_OR_GOTO("client", data, out);
- trans = data;
-
- conn = trans->xl_private;
-
- gettimeofday (&current, NULL);
- INIT_LIST_HEAD (&list);
-
- pthread_mutex_lock (&conn->lock);
- {
- /* Chaining to get call-always functionality from
- call-once timer */
- if (conn->timer) {
- timer_cbk = conn->timer->cbk;
-
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
-
- gf_timer_call_cancel (trans->xl->ctx, conn->timer);
- conn->timer = gf_timer_call_after (trans->xl->ctx,
- timeout,
- timer_cbk,
- trans);
- if (conn->timer == NULL) {
- gf_log (trans->xl->name, GF_LOG_DEBUG,
- "Cannot create bailout timer");
- }
- }
-
- do {
- saved_frame =
- saved_frames_get_timedout (conn->saved_frames,
- GF_OP_TYPE_MOP_REQUEST,
- conn->frame_timeout,
- &current);
- if (saved_frame)
- list_add (&saved_frame->list, &list);
-
- } while (saved_frame);
-
- do {
- saved_frame =
- saved_frames_get_timedout (conn->saved_frames,
- GF_OP_TYPE_FOP_REQUEST,
- conn->frame_timeout,
- &current);
- if (saved_frame)
- list_add (&saved_frame->list, &list);
- } while (saved_frame);
-
- do {
- saved_frame =
- saved_frames_get_timedout (conn->saved_frames,
- GF_OP_TYPE_CBK_REQUEST,
- conn->frame_timeout,
- &current);
- if (saved_frame)
- list_add (&saved_frame->list, &list);
- } while (saved_frame);
- }
- pthread_mutex_unlock (&conn->lock);
-
- hdr.rsp.op_ret = hton32 (-1);
- hdr.rsp.op_errno = hton32 (ENOTCONN);
-
- list_for_each_entry_safe (trav, tmp, &list, list) {
- switch (trav->type)
- {
- case GF_OP_TYPE_FOP_REQUEST:
- gf_ops = gf_fops;
- gf_op_list = gf_fop_list;
- break;
- case GF_OP_TYPE_MOP_REQUEST:
- gf_ops = gf_mops;
- gf_op_list = gf_mop_list;
- break;
- case GF_OP_TYPE_CBK_REQUEST:
- gf_ops = gf_cbks;
- gf_op_list = gf_cbk_list;
- break;
- }
-
- localtime_r (&trav->saved_at.tv_sec, &frame_sent_tm);
- strftime (frame_sent, 32, "%Y-%m-%d %H:%M:%S", &frame_sent_tm);
-
- gf_log (trans->xl->name, GF_LOG_ERROR,
- "bailing out frame %s(%d) "
- "frame sent = %s. frame-timeout = %d",
+ GF_VALIDATE_OR_GOTO ("client", data, out);
+ trans = data;
+
+ conn = trans->xl_private;
+
+ gettimeofday (&current, NULL);
+ INIT_LIST_HEAD (&list);
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ /* Chaining to get call-always functionality from
+ call-once timer */
+ if (conn->timer) {
+ timer_cbk = conn->timer->cbk;
+
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
+
+ gf_timer_call_cancel (trans->xl->ctx, conn->timer);
+ conn->timer = gf_timer_call_after (trans->xl->ctx,
+ timeout,
+ timer_cbk,
+ trans);
+ if (conn->timer == NULL) {
+ gf_log (trans->xl->name, GF_LOG_DEBUG,
+ "Cannot create bailout timer");
+ }
+ }
+
+ do {
+ saved_frame =
+ saved_frames_get_timedout (conn->saved_frames,
+ GF_OP_TYPE_MOP_REQUEST,
+ conn->frame_timeout,
+ &current);
+ if (saved_frame)
+ list_add (&saved_frame->list, &list);
+
+ } while (saved_frame);
+
+ do {
+ saved_frame =
+ saved_frames_get_timedout (conn->saved_frames,
+ GF_OP_TYPE_FOP_REQUEST,
+ conn->frame_timeout,
+ &current);
+ if (saved_frame)
+ list_add (&saved_frame->list, &list);
+ } while (saved_frame);
+
+ do {
+ saved_frame =
+ saved_frames_get_timedout (conn->saved_frames,
+ GF_OP_TYPE_CBK_REQUEST,
+ conn->frame_timeout,
+ &current);
+ if (saved_frame)
+ list_add (&saved_frame->list, &list);
+ } while (saved_frame);
+ }
+ pthread_mutex_unlock (&conn->lock);
+
+ hdr.rsp.op_ret = hton32 (-1);
+ hdr.rsp.op_errno = hton32 (ENOTCONN);
+
+ list_for_each_entry_safe (trav, tmp, &list, list) {
+ switch (trav->type)
+ {
+ case GF_OP_TYPE_FOP_REQUEST:
+ gf_ops = gf_fops;
+ gf_op_list = gf_fop_list;
+ break;
+ case GF_OP_TYPE_MOP_REQUEST:
+ gf_ops = gf_mops;
+ gf_op_list = gf_mop_list;
+ break;
+ case GF_OP_TYPE_CBK_REQUEST:
+ gf_ops = gf_cbks;
+ gf_op_list = gf_cbk_list;
+ break;
+ }
+
+ localtime_r (&trav->saved_at.tv_sec, &frame_sent_tm);
+ strftime (frame_sent, 32, "%Y-%m-%d %H:%M:%S", &frame_sent_tm);
+
+ gf_log (trans->xl->name, GF_LOG_ERROR,
+ "bailing out frame %s(%d) "
+ "frame sent = %s. frame-timeout = %d",
gf_op_list[trav->op], trav->op,
- frame_sent, conn->frame_timeout);
+ frame_sent, conn->frame_timeout);
- hdr.type = hton32 (trav->type);
- hdr.op = hton32 (trav->op);
+ hdr.type = hton32 (trav->type);
+ hdr.op = hton32 (trav->op);
- frame = trav->frame;
+ frame = trav->frame;
- gf_ops[trav->op] (frame, &hdr, sizeof (hdr), NULL);
+ gf_ops[trav->op] (frame, &hdr, sizeof (hdr), NULL);
- list_del_init (&trav->list);
- FREE (trav);
- }
+ list_del_init (&trav->list);
+ FREE (trav);
+ }
out:
- return;
+ return;
}
void
save_frame (transport_t *trans, call_frame_t *frame,
- int32_t op, int8_t type, uint64_t callid)
+ int32_t op, int8_t type, uint64_t callid)
{
- client_connection_t *conn = NULL;
- struct timeval timeout = {0, };
+ client_connection_t *conn = NULL;
+ struct timeval timeout = {0, };
- conn = trans->xl_private;
+ conn = trans->xl_private;
- saved_frames_put (conn->saved_frames, frame, op, type, callid);
+ saved_frames_put (conn->saved_frames, frame, op, type, callid);
- if (conn->timer == NULL) {
- timeout.tv_sec = 10;
- timeout.tv_usec = 0;
- conn->timer = gf_timer_call_after (trans->xl->ctx, timeout,
- call_bail, (void *) trans);
- }
+ if (conn->timer == NULL) {
+ timeout.tv_sec = 10;
+ timeout.tv_usec = 0;
+ conn->timer = gf_timer_call_after (trans->xl->ctx, timeout,
+ call_bail, (void *) trans);
+ }
}
-void
+void
client_ping_timer_expired (void *data)
{
- xlator_t *this = NULL;
- transport_t *trans = NULL;
- client_conf_t *conf = NULL;
- client_connection_t *conn = NULL;
- int disconnect = 0;
- int transport_activity = 0;
- struct timeval timeout = {0, };
- struct timeval current = {0, };
-
- trans = data;
- this = trans->xl;
- conf = this->private;
- conn = trans->xl_private;
-
- pthread_mutex_lock (&conn->lock);
- {
- if (conn->ping_timer)
- gf_timer_call_cancel (trans->xl->ctx,
- conn->ping_timer);
- gettimeofday (&current, NULL);
+ xlator_t *this = NULL;
+ transport_t *trans = NULL;
+ client_conf_t *conf = NULL;
+ client_connection_t *conn = NULL;
+ int disconnect = 0;
+ int transport_activity = 0;
+ struct timeval timeout = {0, };
+ struct timeval current = {0, };
+
+ trans = data;
+ this = trans->xl;
+ conf = this->private;
+ conn = trans->xl_private;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ if (conn->ping_timer)
+ gf_timer_call_cancel (trans->xl->ctx,
+ conn->ping_timer);
+ gettimeofday (&current, NULL);
pthread_mutex_lock (&conf->mutex);
{
@@ -381,158 +381,158 @@ client_ping_timer_expired (void *data)
}
pthread_mutex_unlock (&conf->mutex);
- if (transport_activity) {
- gf_log (this->name, GF_LOG_TRACE,
- "ping timer expired but transport activity "
- "detected - not bailing transport");
- conn->transport_activity = 0;
- timeout.tv_sec = conn->ping_timeout;
- timeout.tv_usec = 0;
-
- conn->ping_timer =
- gf_timer_call_after (trans->xl->ctx, timeout,
- client_ping_timer_expired,
- (void *) trans);
- if (conn->ping_timer == NULL)
- gf_log (this->name, GF_LOG_DEBUG,
- "unable to setup timer");
-
- } else {
- conn->ping_started = 0;
- conn->ping_timer = NULL;
- disconnect = 1;
- }
- }
- pthread_mutex_unlock (&conn->lock);
- if (disconnect) {
- gf_log (this->name, GF_LOG_ERROR,
- "Server %s has not responded in the last %d "
+ if (transport_activity) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "ping timer expired but transport activity "
+ "detected - not bailing transport");
+ conn->transport_activity = 0;
+ timeout.tv_sec = conn->ping_timeout;
+ timeout.tv_usec = 0;
+
+ conn->ping_timer =
+ gf_timer_call_after (trans->xl->ctx, timeout,
+ client_ping_timer_expired,
+ (void *) trans);
+ if (conn->ping_timer == NULL)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "unable to setup timer");
+
+ } else {
+ conn->ping_started = 0;
+ conn->ping_timer = NULL;
+ disconnect = 1;
+ }
+ }
+ pthread_mutex_unlock (&conn->lock);
+ if (disconnect) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "Server %s has not responded in the last %d "
"seconds, disconnecting.",
conf->transport[0]->peerinfo.identifier,
conn->ping_timeout);
-
- transport_disconnect (conf->transport[0]);
- transport_disconnect (conf->transport[1]);
- }
+
+ transport_disconnect (conf->transport[0]);
+ transport_disconnect (conf->transport[1]);
+ }
}
void
client_start_ping (void *data)
{
- xlator_t *this = NULL;
- transport_t *trans = NULL;
- client_conf_t *conf = NULL;
- client_connection_t *conn = NULL;
- int32_t ret = -1;
- gf_hdr_common_t *hdr = NULL;
- struct timeval timeout = {0, };
- call_frame_t *dummy_frame = NULL;
- size_t hdrlen = -1;
- gf_mop_ping_req_t *req = NULL;
-
-
- trans = data;
- this = trans->xl;
- conf = this->private;
- conn = trans->xl_private;
-
- pthread_mutex_lock (&conn->lock);
- {
- if ((conn->saved_frames->count == 0) ||
- !conn->connected) {
- /* using goto looked ugly here,
- * hence getting out this way */
- if (conn->ping_timer)
- gf_timer_call_cancel (trans->xl->ctx,
- conn->ping_timer);
- conn->ping_timer = NULL;
- conn->ping_started = 0;
- /* unlock */
- pthread_mutex_unlock (&conn->lock);
- return;
- }
-
- if (conn->saved_frames->count < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "saved_frames->count is %"PRId64,
- conn->saved_frames->count);
- conn->saved_frames->count = 0;
- }
- timeout.tv_sec = conn->ping_timeout;
- timeout.tv_usec = 0;
+ xlator_t *this = NULL;
+ transport_t *trans = NULL;
+ client_conf_t *conf = NULL;
+ client_connection_t *conn = NULL;
+ int32_t ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ struct timeval timeout = {0, };
+ call_frame_t *dummy_frame = NULL;
+ size_t hdrlen = -1;
+ gf_mop_ping_req_t *req = NULL;
+
+
+ trans = data;
+ this = trans->xl;
+ conf = this->private;
+ conn = trans->xl_private;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ if ((conn->saved_frames->count == 0) ||
+ !conn->connected) {
+ /* using goto looked ugly here,
+ * hence getting out this way */
+ if (conn->ping_timer)
+ gf_timer_call_cancel (trans->xl->ctx,
+ conn->ping_timer);
+ conn->ping_timer = NULL;
+ conn->ping_started = 0;
+ /* unlock */
+ pthread_mutex_unlock (&conn->lock);
+ return;
+ }
+
+ if (conn->saved_frames->count < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "saved_frames->count is %"PRId64,
+ conn->saved_frames->count);
+ conn->saved_frames->count = 0;
+ }
+ timeout.tv_sec = conn->ping_timeout;
+ timeout.tv_usec = 0;
if (conn->ping_timer)
gf_timer_call_cancel (trans->xl->ctx,
conn->ping_timer);
- conn->ping_timer =
- gf_timer_call_after (trans->xl->ctx, timeout,
- client_ping_timer_expired,
- (void *) trans);
-
- if (conn->ping_timer == NULL) {
- gf_log (this->name, GF_LOG_DEBUG,
- "unable to setup timer");
- } else {
- conn->ping_started = 1;
- }
- }
- pthread_mutex_unlock (&conn->lock);
-
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
-
- dummy_frame = create_frame (this, this->ctx->pool);
- dummy_frame->local = trans;
-
- ret = protocol_client_xfer (dummy_frame, this, trans,
- GF_OP_TYPE_MOP_REQUEST, GF_MOP_PING,
- hdr, hdrlen, NULL, 0, NULL);
+ conn->ping_timer =
+ gf_timer_call_after (trans->xl->ctx, timeout,
+ client_ping_timer_expired,
+ (void *) trans);
+
+ if (conn->ping_timer == NULL) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "unable to setup timer");
+ } else {
+ conn->ping_started = 1;
+ }
+ }
+ pthread_mutex_unlock (&conn->lock);
+
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+
+ dummy_frame = create_frame (this, this->ctx->pool);
+ dummy_frame->local = trans;
+
+ ret = protocol_client_xfer (dummy_frame, this, trans,
+ GF_OP_TYPE_MOP_REQUEST, GF_MOP_PING,
+ hdr, hdrlen, NULL, 0, NULL);
}
int
client_ping_cbk (call_frame_t *frame, gf_hdr_common_t *hdr, size_t hdrlen,
- struct iobuf *iobuf)
+ struct iobuf *iobuf)
{
- xlator_t *this = NULL;
- transport_t *trans = NULL;
- client_connection_t *conn = NULL;
- struct timeval timeout = {0, };
- int op_ret = 0;
-
- trans = frame->local; frame->local = NULL;
- this = trans->xl;
- conn = trans->xl_private;
-
- op_ret = ntoh32 (hdr->rsp.op_ret);
-
- if (op_ret == -1) {
- /* timer expired and transport bailed out */
- gf_log (this->name, GF_LOG_DEBUG, "timer must have expired");
- goto out;
- }
-
- pthread_mutex_lock (&conn->lock);
- {
- timeout.tv_sec = conn->ping_timeout;
- timeout.tv_usec = 0;
-
- gf_timer_call_cancel (trans->xl->ctx,
- conn->ping_timer);
-
- conn->ping_timer =
- gf_timer_call_after (trans->xl->ctx, timeout,
- client_start_ping, (void *)trans);
- if (conn->ping_timer == NULL)
- gf_log (this->name, GF_LOG_DEBUG,
- "gf_timer_call_after() returned NULL");
- }
- pthread_mutex_unlock (&conn->lock);
+ xlator_t *this = NULL;
+ transport_t *trans = NULL;
+ client_connection_t *conn = NULL;
+ struct timeval timeout = {0, };
+ int op_ret = 0;
+
+ trans = frame->local; frame->local = NULL;
+ this = trans->xl;
+ conn = trans->xl_private;
+
+ op_ret = ntoh32 (hdr->rsp.op_ret);
+
+ if (op_ret == -1) {
+ /* timer expired and transport bailed out */
+ gf_log (this->name, GF_LOG_DEBUG, "timer must have expired");
+ goto out;
+ }
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ timeout.tv_sec = conn->ping_timeout;
+ timeout.tv_usec = 0;
+
+ gf_timer_call_cancel (trans->xl->ctx,
+ conn->ping_timer);
+
+ conn->ping_timer =
+ gf_timer_call_after (trans->xl->ctx, timeout,
+ client_start_ping, (void *)trans);
+ if (conn->ping_timer == NULL)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "gf_timer_call_after() returned NULL");
+ }
+ pthread_mutex_unlock (&conn->lock);
out:
- STACK_DESTROY (frame->root);
- return 0;
+ STACK_DESTROY (frame->root);
+ return 0;
}
@@ -543,85 +543,85 @@ protocol_client_xfer (call_frame_t *frame, xlator_t *this, transport_t *trans,
struct iovec *vector, int count,
struct iobref *iobref)
{
- client_conf_t *conf = NULL;
- client_connection_t *conn = NULL;
- uint64_t callid = 0;
- int32_t ret = -1;
- int start_ping = 0;
- gf_hdr_common_t rsphdr = {0, };
-
- conf = this->private;
-
- if (!trans) {
- /* default to bulk op since it is 'safer' */
- trans = conf->transport[CHANNEL_BULK];
- }
- conn = trans->xl_private;
-
- pthread_mutex_lock (&conn->lock);
- {
- callid = ++conn->callid;
-
- hdr->callid = hton64 (callid);
- hdr->op = hton32 (op);
- hdr->type = hton32 (type);
-
- if (frame) {
- hdr->req.uid = hton32 (frame->root->uid);
- hdr->req.gid = hton32 (frame->root->gid);
- hdr->req.pid = hton32 (frame->root->pid);
- }
-
- if (conn->connected == 0)
- transport_connect (trans);
-
- ret = -1;
-
- if (conn->connected ||
- ((type == GF_OP_TYPE_MOP_REQUEST) &&
- (op == GF_MOP_SETVOLUME))) {
- ret = transport_submit (trans, (char *)hdr, hdrlen,
- vector, count, iobref);
- }
-
- if ((ret >= 0) && frame) {
+ client_conf_t *conf = NULL;
+ client_connection_t *conn = NULL;
+ uint64_t callid = 0;
+ int32_t ret = -1;
+ int start_ping = 0;
+ gf_hdr_common_t rsphdr = {0, };
+
+ conf = this->private;
+
+ if (!trans) {
+ /* default to bulk op since it is 'safer' */
+ trans = conf->transport[CHANNEL_BULK];
+ }
+ conn = trans->xl_private;
+
+ pthread_mutex_lock (&conn->lock);
+ {
+ callid = ++conn->callid;
+
+ hdr->callid = hton64 (callid);
+ hdr->op = hton32 (op);
+ hdr->type = hton32 (type);
+
+ if (frame) {
+ hdr->req.uid = hton32 (frame->root->uid);
+ hdr->req.gid = hton32 (frame->root->gid);
+ hdr->req.pid = hton32 (frame->root->pid);
+ }
+
+ if (conn->connected == 0)
+ transport_connect (trans);
+
+ ret = -1;
+
+ if (conn->connected ||
+ ((type == GF_OP_TYPE_MOP_REQUEST) &&
+ (op == GF_MOP_SETVOLUME))) {
+ ret = transport_submit (trans, (char *)hdr, hdrlen,
+ vector, count, iobref);
+ }
+
+ if ((ret >= 0) && frame) {
pthread_mutex_lock (&conf->mutex);
{
gettimeofday (&conf->last_sent, NULL);
}
pthread_mutex_unlock (&conf->mutex);
- save_frame (trans, frame, op, type, callid);
- }
-
- if (!conn->ping_started && (ret >= 0)) {
- start_ping = 1;
- }
- }
- pthread_mutex_unlock (&conn->lock);
-
- if (start_ping)
- client_start_ping ((void *) trans);
-
- if (frame && (ret < 0)) {
- rsphdr.op = op;
- rsphdr.rsp.op_ret = hton32 (-1);
- rsphdr.rsp.op_errno = hton32 (ENOTCONN);
-
- if (type == GF_OP_TYPE_FOP_REQUEST) {
- rsphdr.type = GF_OP_TYPE_FOP_REPLY;
- gf_fops[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
- } else if (type == GF_OP_TYPE_MOP_REQUEST) {
- rsphdr.type = GF_OP_TYPE_MOP_REPLY;
- gf_mops[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
- } else {
- rsphdr.type = GF_OP_TYPE_CBK_REPLY;
- gf_cbks[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
- }
+ save_frame (trans, frame, op, type, callid);
+ }
+
+ if (!conn->ping_started && (ret >= 0)) {
+ start_ping = 1;
+ }
+ }
+ pthread_mutex_unlock (&conn->lock);
+
+ if (start_ping)
+ client_start_ping ((void *) trans);
+
+ if (frame && (ret < 0)) {
+ rsphdr.op = op;
+ rsphdr.rsp.op_ret = hton32 (-1);
+ rsphdr.rsp.op_errno = hton32 (ENOTCONN);
+
+ if (type == GF_OP_TYPE_FOP_REQUEST) {
+ rsphdr.type = GF_OP_TYPE_FOP_REPLY;
+ gf_fops[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
+ } else if (type == GF_OP_TYPE_MOP_REQUEST) {
+ rsphdr.type = GF_OP_TYPE_MOP_REPLY;
+ gf_mops[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
+ } else {
+ rsphdr.type = GF_OP_TYPE_CBK_REPLY;
+ gf_cbks[op] (frame, &rsphdr, sizeof (rsphdr), NULL);
+ }
FREE (hdr);
- }
+ }
- return ret;
+ return ret;
}
@@ -641,59 +641,59 @@ int
client_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
mode_t mode, fd_t *fd)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_create_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t pathlen = 0;
- size_t baselen = 0;
- int32_t ret = -1;
- ino_t par = 0;
- uint64_t gen = 0;
- client_local_t *local = NULL;
-
-
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
-
- local->fd = fd_ref (fd);
- loc_copy (&local->loc, loc);
-
- frame->local = local;
-
- pathlen = STRLEN_0(loc->path);
- baselen = STRLEN_0(loc->name);
-
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CREATE %"PRId64"/%s (%s): failed to get remote inode "
- "number for parent inode",
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_create_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t pathlen = 0;
+ size_t baselen = 0;
+ int32_t ret = -1;
+ ino_t par = 0;
+ uint64_t gen = 0;
+ client_local_t *local = NULL;
+
+
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
+
+ local->fd = fd_ref (fd);
+ loc_copy (&local->loc, loc);
+
+ frame->local = local;
+
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "CREATE %"PRId64"/%s (%s): failed to get remote inode "
+ "number for parent inode",
loc->parent->ino, loc->name, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen + baselen);
- hdr = gf_hdr_new (req, pathlen + baselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->flags = hton32 (gf_flags_from_flags (flags));
- req->mode = hton32 (mode);
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_CREATE,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ }
+
+ hdrlen = gf_hdr_len (req, pathlen + baselen);
+ hdr = gf_hdr_new (req, pathlen + baselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->flags = hton32 (gf_flags_from_flags (flags));
+ req->mode = hton32 (mode);
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_CREATE,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, fd, NULL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, fd, NULL, NULL);
+ return 0;
}
@@ -712,56 +712,56 @@ int
client_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
fd_t *fd, int32_t wbflags)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- size_t hdrlen = 0;
- gf_fop_open_req_t *req = NULL;
- size_t pathlen = 0;
- ino_t ino = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ size_t hdrlen = 0;
+ gf_fop_open_req_t *req = NULL;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- client_local_t *local = NULL;
+ client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
- local->fd = fd_ref (fd);
- loc_copy (&local->loc, loc);
+ local->fd = fd_ref (fd);
+ loc_copy (&local->loc, loc);
- frame->local = local;
+ frame->local = local;
- pathlen = STRLEN_0(loc->path);
+ pathlen = STRLEN_0 (loc->path);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "OPEN %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "OPEN %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
- req->gen = hton64 (gen);
- req->flags = hton32 (gf_flags_from_flags (flags));
+ req->ino = hton64 (ino);
+ req->gen = hton64 (gen);
+ req->flags = hton32 (gf_flags_from_flags (flags));
req->wbflags = hton32 (wbflags);
- strcpy (req->path, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPEN,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
+ strcpy (req->path, loc->path);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPEN,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, fd);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, fd);
+ return 0;
}
@@ -778,45 +778,45 @@ unwind:
int
client_stat (call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_stat_req_t *req = NULL;
- size_t hdrlen = -1;
- int32_t ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
- ino_t gen = 0;
-
- pathlen = STRLEN_0(loc->path);
-
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_stat_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int32_t ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
+ ino_t gen = 0;
+
+ pathlen = STRLEN_0 (loc->path);
+
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "STAT %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
+ req->ino = hton64 (ino);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_STAT,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_STAT,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND (frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -833,46 +833,46 @@ unwind:
int
client_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_readlink_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_readlink_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- pathlen = STRLEN_0(loc->path);
+ pathlen = STRLEN_0 (loc->path);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "READLINK %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "READLINK %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
- req->gen = hton64 (gen);
- req->size = hton32 (size);
- strcpy (req->path, loc->path);
+ req->ino = hton64 (ino);
+ req->gen = hton64 (gen);
+ req->size = hton32 (size);
+ strcpy (req->path, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_READLINK,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_READLINK,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -891,57 +891,57 @@ int
client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
dev_t dev)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_mknod_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- size_t baselen = 0;
- ino_t par = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_mknod_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ size_t baselen = 0;
+ ino_t par = 0;
uint64_t gen = 0;
- client_local_t *local = NULL;
+ client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
- loc_copy (&local->loc, loc);
+ loc_copy (&local->loc, loc);
- frame->local = local;
+ frame->local = local;
- pathlen = STRLEN_0(loc->path);
- baselen = STRLEN_0(loc->name);
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "MKNOD %"PRId64"/%s (%s): failed to get remote inode "
- "number for parent",
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "MKNOD %"PRId64"/%s (%s): failed to get remote inode "
+ "number for parent",
loc->parent->ino, loc->name, loc->path);
- }
+ }
- hdrlen = gf_hdr_len (req, pathlen + baselen);
- hdr = gf_hdr_new (req, pathlen + baselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen + baselen);
+ hdr = gf_hdr_new (req, pathlen + baselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- req->mode = hton32 (mode);
- req->dev = hton64 (dev);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ req->mode = hton32 (mode);
+ req->dev = hton64 (dev);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKNOD,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKNOD,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, loc->inode, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
+ return 0;
}
@@ -958,56 +958,56 @@ unwind:
int
client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_mkdir_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- size_t baselen = 0;
- ino_t par = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_mkdir_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ size_t baselen = 0;
+ ino_t par = 0;
uint64_t gen = 0;
- client_local_t *local = NULL;
-
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
-
- loc_copy (&local->loc, loc);
-
- frame->local = local;
-
- pathlen = STRLEN_0(loc->path);
- baselen = STRLEN_0(loc->name);
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "MKDIR %"PRId64"/%s (%s): failed to get remote inode "
- "number for parent",
+ client_local_t *local = NULL;
+
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
+
+ loc_copy (&local->loc, loc);
+
+ frame->local = local;
+
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "MKDIR %"PRId64"/%s (%s): failed to get remote inode "
+ "number for parent",
loc->parent->ino, loc->name, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen + baselen);
- hdr = gf_hdr_new (req, pathlen + baselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- req->mode = hton32 (mode);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKDIR,
- hdr, hdrlen, NULL, 0, NULL);
-
- return ret;
+ }
+
+ hdrlen = gf_hdr_len (req, pathlen + baselen);
+ hdr = gf_hdr_new (req, pathlen + baselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ req->mode = hton32 (mode);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_MKDIR,
+ hdr, hdrlen, NULL, 0, NULL);
+
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, loc->inode, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
+ return 0;
}
@@ -1023,47 +1023,47 @@ unwind:
int
client_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_unlink_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- size_t baselen = 0;
- ino_t par = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_unlink_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ size_t baselen = 0;
+ ino_t par = 0;
uint64_t gen = 0;
- pathlen = STRLEN_0(loc->path);
- baselen = STRLEN_0(loc->name);
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "UNLINK %"PRId64"/%s (%s): failed to get remote inode "
- "number for parent",
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "UNLINK %"PRId64"/%s (%s): failed to get remote inode "
+ "number for parent",
loc->parent->ino, loc->name, loc->path);
- }
+ }
- hdrlen = gf_hdr_len (req, pathlen + baselen);
- hdr = gf_hdr_new (req, pathlen + baselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen + baselen);
+ hdr = gf_hdr_new (req, pathlen + baselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_UNLINK,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_UNLINK,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
@@ -1079,47 +1079,47 @@ unwind:
int
client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_rmdir_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- size_t baselen = 0;
- ino_t par = 0;
- uint64_t gen = 0;
-
- pathlen = STRLEN_0(loc->path);
- baselen = STRLEN_0(loc->name);
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "RMDIR %"PRId64"/%s (%s): failed to get remote inode "
- "number for parent",
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_rmdir_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ size_t baselen = 0;
+ ino_t par = 0;
+ uint64_t gen = 0;
+
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "RMDIR %"PRId64"/%s (%s): failed to get remote inode "
+ "number for parent",
loc->parent->ino, loc->name, loc->path);
- }
+ }
- hdrlen = gf_hdr_len (req, pathlen + baselen);
- hdr = gf_hdr_new (req, pathlen + baselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen + baselen);
+ hdr = gf_hdr_new (req, pathlen + baselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_RMDIR,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_RMDIR,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
@@ -1138,57 +1138,57 @@ int
client_symlink (call_frame_t *frame, xlator_t *this, const char *linkname,
loc_t *loc)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_symlink_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t pathlen = 0;
- size_t newlen = 0;
- size_t baselen = 0;
- ino_t par = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_symlink_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t pathlen = 0;
+ size_t newlen = 0;
+ size_t baselen = 0;
+ ino_t par = 0;
uint64_t gen = 0;
- client_local_t *local = NULL;
-
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
-
- loc_copy (&local->loc, loc);
-
- frame->local = local;
-
- pathlen = STRLEN_0 (loc->path);
- baselen = STRLEN_0 (loc->name);
- newlen = STRLEN_0 (linkname);
- ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
- if (loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
+ client_local_t *local = NULL;
+
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
+
+ loc_copy (&local->loc, loc);
+
+ frame->local = local;
+
+ pathlen = STRLEN_0 (loc->path);
+ baselen = STRLEN_0 (loc->name);
+ newlen = STRLEN_0 (linkname);
+ ret = inode_ctx_get2 (loc->parent, this, &par, &gen);
+ if (loc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
" number parent",
loc->parent->ino, loc->name, loc->path);
- }
-
- hdrlen = gf_hdr_len (req, pathlen + baselen + newlen);
- hdr = gf_hdr_new (req, pathlen + baselen + newlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->par = hton64 (par);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
- strcpy (req->bname + pathlen, loc->name);
- strcpy (req->linkname + pathlen + baselen, linkname);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_SYMLINK,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ }
+
+ hdrlen = gf_hdr_len (req, pathlen + baselen + newlen);
+ hdr = gf_hdr_new (req, pathlen + baselen + newlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->par = hton64 (par);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
+ strcpy (req->bname + pathlen, loc->name);
+ strcpy (req->linkname + pathlen + baselen, linkname);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_SYMLINK,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, loc->inode, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, loc->inode, NULL);
+ return 0;
}
@@ -1206,69 +1206,69 @@ int
client_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc,
loc_t *newloc)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_rename_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t oldpathlen = 0;
- size_t oldbaselen = 0;
- size_t newpathlen = 0;
- size_t newbaselen = 0;
- ino_t oldpar = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_rename_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t oldpathlen = 0;
+ size_t oldbaselen = 0;
+ size_t newpathlen = 0;
+ size_t newbaselen = 0;
+ ino_t oldpar = 0;
uint64_t oldgen = 0;
- ino_t newpar = 0;
+ ino_t newpar = 0;
uint64_t newgen = 0;
- oldpathlen = STRLEN_0(oldloc->path);
- oldbaselen = STRLEN_0(oldloc->name);
- newpathlen = STRLEN_0(newloc->path);
- newbaselen = STRLEN_0(newloc->name);
- ret = inode_ctx_get2 (oldloc->parent, this, &oldpar, &oldgen);
- if (oldloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "RENAME %"PRId64"/%s (%s): failed to get remote inode "
- "number for source parent",
+ oldpathlen = STRLEN_0 (oldloc->path);
+ oldbaselen = STRLEN_0 (oldloc->name);
+ newpathlen = STRLEN_0 (newloc->path);
+ newbaselen = STRLEN_0 (newloc->name);
+ ret = inode_ctx_get2 (oldloc->parent, this, &oldpar, &oldgen);
+ if (oldloc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "RENAME %"PRId64"/%s (%s): failed to get remote inode "
+ "number for source parent",
oldloc->parent->ino, oldloc->name, oldloc->path);
- }
+ }
- ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen);
- if (newloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CREATE %"PRId64"/%s (%s): failed to get remote inode "
- "number for destination parent",
+ ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen);
+ if (newloc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "CREATE %"PRId64"/%s (%s): failed to get remote inode "
+ "number for destination parent",
newloc->parent->ino, newloc->name, newloc->path);
- }
+ }
- hdrlen = gf_hdr_len (req, (oldpathlen + oldbaselen +
- newpathlen + newbaselen));
- hdr = gf_hdr_new (req, (oldpathlen + oldbaselen +
- newpathlen + newbaselen));
+ hdrlen = gf_hdr_len (req, (oldpathlen + oldbaselen +
+ newpathlen + newbaselen));
+ hdr = gf_hdr_new (req, (oldpathlen + oldbaselen +
+ newpathlen + newbaselen));
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->oldpar = hton64 (oldpar);
+ req->oldpar = hton64 (oldpar);
req->oldgen = hton64 (oldgen);
- req->newpar = hton64 (newpar);
+ req->newpar = hton64 (newpar);
req->newgen = hton64 (newgen);
- strcpy (req->oldpath, oldloc->path);
- strcpy (req->oldbname + oldpathlen, oldloc->name);
- strcpy (req->newpath + oldpathlen + oldbaselen, newloc->path);
- strcpy (req->newbname + oldpathlen + oldbaselen + newpathlen,
- newloc->name);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_RENAME,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ strcpy (req->oldpath, oldloc->path);
+ strcpy (req->oldbname + oldpathlen, oldloc->name);
+ strcpy (req->newpath + oldpathlen + oldbaselen, newloc->path);
+ strcpy (req->newbname + oldpathlen + oldbaselen + newpathlen,
+ newloc->name);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_RENAME,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -1285,73 +1285,73 @@ unwind:
int
client_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_link_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t oldpathlen = 0;
- size_t newpathlen = 0;
- size_t newbaselen = 0;
- ino_t oldino = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_link_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t oldpathlen = 0;
+ size_t newpathlen = 0;
+ size_t newbaselen = 0;
+ ino_t oldino = 0;
uint64_t oldgen = 0;
- ino_t newpar = 0;
+ ino_t newpar = 0;
uint64_t newgen = 0;
- client_local_t *local = NULL;
+ client_local_t *local = NULL;
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
- loc_copy (&local->loc, oldloc);
+ loc_copy (&local->loc, oldloc);
- frame->local = local;
+ frame->local = local;
- oldpathlen = STRLEN_0(oldloc->path);
- newpathlen = STRLEN_0(newloc->path);
- newbaselen = STRLEN_0(newloc->name);
+ oldpathlen = STRLEN_0 (oldloc->path);
+ newpathlen = STRLEN_0 (newloc->path);
+ newbaselen = STRLEN_0 (newloc->name);
- ret = inode_ctx_get2 (oldloc->inode, this, &oldino, &oldgen);
- if (oldloc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "LINK %"PRId64"/%s (%s) ==> %"PRId64" (%s): "
+ ret = inode_ctx_get2 (oldloc->inode, this, &oldino, &oldgen);
+ if (oldloc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "LINK %"PRId64"/%s (%s) ==> %"PRId64" (%s): "
"failed to get remote inode number for source inode",
- newloc->parent->ino, newloc->name, newloc->path,
+ newloc->parent->ino, newloc->name, newloc->path,
oldloc->ino, oldloc->path);
- }
+ }
- ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen);
- if (newloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "LINK %"PRId64"/%s (%s) ==> %"PRId64" (%s): "
- "failed to get remote inode number destination parent",
+ ret = inode_ctx_get2 (newloc->parent, this, &newpar, &newgen);
+ if (newloc->parent->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "LINK %"PRId64"/%s (%s) ==> %"PRId64" (%s): "
+ "failed to get remote inode number destination parent",
newloc->parent->ino, newloc->name, newloc->path,
oldloc->ino, oldloc->path);
- }
+ }
- hdrlen = gf_hdr_len (req, oldpathlen + newpathlen + newbaselen);
- hdr = gf_hdr_new (req, oldpathlen + newpathlen + newbaselen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, oldpathlen + newpathlen + newbaselen);
+ hdr = gf_hdr_new (req, oldpathlen + newpathlen + newbaselen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- strcpy (req->oldpath, oldloc->path);
- strcpy (req->newpath + oldpathlen, newloc->path);
- strcpy (req->newbname + oldpathlen + newpathlen, newloc->name);
+ strcpy (req->oldpath, oldloc->path);
+ strcpy (req->newpath + oldpathlen, newloc->path);
+ strcpy (req->newbname + oldpathlen + newpathlen, newloc->name);
- req->oldino = hton64 (oldino);
- req->oldgen = hton64 (oldgen);
- req->newpar = hton64 (newpar);
- req->newgen = hton64 (newgen);
+ req->oldino = hton64 (oldino);
+ req->oldgen = hton64 (oldgen);
+ req->newpar = hton64 (newpar);
+ req->newgen = hton64 (newgen);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_LINK,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_LINK,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, oldloc->inode, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, oldloc->inode, NULL);
+ return 0;
}
@@ -1368,45 +1368,45 @@ unwind:
int
client_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_truncate_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_truncate_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- pathlen = STRLEN_0(loc->path);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "TRUNCATE %"PRId64" (%s): "
+ pathlen = STRLEN_0 (loc->path);
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "TRUNCATE %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- req->offset = hton64 (offset);
- strcpy (req->path, loc->path);
+ req->offset = hton64 (offset);
+ strcpy (req->path, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_TRUNCATE,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_TRUNCATE,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -1426,51 +1426,51 @@ int
client_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_read_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_read_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int ret = -1;
client_fd_ctx_t *fdctx = NULL;
- client_conf_t *conf = NULL;
+ client_conf_t *conf = NULL;
conf = this->private;
-
+
pthread_mutex_lock (&conf->mutex);
{
fdctx = this_fd_get_ctx (fd, this);
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx, EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD, NULL, 0, NULL);
- return 0;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx, EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD, NULL, 0, NULL);
+ return 0;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->fd = hton64 (remote_fd);
- req->size = hton32 (size);
- req->offset = hton64 (offset);
+ req->fd = hton64 (remote_fd);
+ req->size = hton32 (size);
+ req->offset = hton64 (offset);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_READ,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_READ,
+ hdr, hdrlen, NULL, 0, NULL);
- return 0;
+ return 0;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL, 0, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL, 0, NULL);
+ return 0;
}
@@ -1491,11 +1491,11 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int32_t count, off_t offset,
struct iobref *iobref)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_write_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_write_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int ret = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
@@ -1507,34 +1507,34 @@ client_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD, NULL);
- return 0;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD, NULL);
+ return 0;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->fd = hton64 (remote_fd);
- req->size = hton32 (iov_length (vector, count));
- req->offset = hton64 (offset);
+ req->fd = hton64 (remote_fd);
+ req->size = hton32 (iov_length (vector, count));
+ req->offset = hton64 (offset);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_WRITE,
- hdr, hdrlen, vector, count, iobref);
- return ret;
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_WRITE,
+ hdr, hdrlen, vector, count, iobref);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -1551,16 +1551,16 @@ unwind:
int
client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_statfs_req_t *req = NULL;
- size_t hdrlen = -1;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
- ino_t gen = 0;
-
- pathlen = STRLEN_0(loc->path);
-
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_statfs_req_t *req = NULL;
+ size_t hdrlen = -1;
+ int ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
+ ino_t gen = 0;
+
+ pathlen = STRLEN_0 (loc->path);
+
if (loc->inode) {
ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
if (loc->inode->ino && ret < 0) {
@@ -1571,27 +1571,27 @@ client_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc)
}
}
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
- req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
+ req->ino = hton64 (ino);
+ req->gen = hton64 (gen);
+ strcpy (req->path, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_STATFS,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_STATFS,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -1608,11 +1608,11 @@ unwind:
int
client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_flush_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_flush_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int ret = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
@@ -1624,33 +1624,33 @@ client_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD);
- return 0;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD);
+ return 0;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->fd = hton64 (remote_fd);
+ req->fd = hton64 (remote_fd);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FLUSH,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FLUSH,
+ hdr, hdrlen, NULL, 0, NULL);
- return 0;
+ return 0;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
@@ -1667,11 +1667,11 @@ unwind:
int
client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fsync_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int32_t ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fsync_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int32_t ret = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
@@ -1683,181 +1683,181 @@ client_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags)
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND(frame, -1, EBADFD);
- return 0;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD);
+ return 0;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->fd = hton64 (remote_fd);
- req->data = hton32 (flags);
+ req->fd = hton64 (remote_fd);
+ req->data = hton32 (flags);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSYNC,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSYNC,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
int
client_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
- gf_xattrop_flags_t flags, dict_t *dict)
+ gf_xattrop_flags_t flags, dict_t *dict)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_xattrop_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t dict_len = 0;
- int32_t ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_xattrop_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t dict_len = 0;
+ int32_t ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
char *buf = NULL;
- GF_VALIDATE_OR_GOTO("client", this, unwind);
+ GF_VALIDATE_OR_GOTO ("client", this, unwind);
- GF_VALIDATE_OR_GOTO(this->name, loc, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, loc, unwind);
- if (dict) {
- ret = dict_allocate_and_serialize (dict, &buf, &dict_len);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to get serialized length of dict(%p)",
- dict);
- goto unwind;
- }
- }
+ if (dict) {
+ ret = dict_allocate_and_serialize (dict, &buf, &dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict(%p)",
+ dict);
+ goto unwind;
+ }
+ }
- pathlen = STRLEN_0(loc->path);
+ pathlen = STRLEN_0 (loc->path);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "XATTROP %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "XATTROP %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, dict_len + pathlen);
- hdr = gf_hdr_new (req, dict_len + pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, dict_len + pathlen);
+ hdr = gf_hdr_new (req, dict_len + pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->flags = hton32 (flags);
- req->dict_len = hton32 (dict_len);
- if (dict) {
+ req->flags = hton32 (flags);
+ req->dict_len = hton32 (dict_len);
+ if (dict) {
memcpy (req->dict, buf, dict_len);
FREE (buf);
}
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- strcpy (req->path + dict_len, loc->path);
+ strcpy (req->path + dict_len, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_XATTROP,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_XATTROP,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
int
client_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
- gf_xattrop_flags_t flags, dict_t *dict)
+ gf_xattrop_flags_t flags, dict_t *dict)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fxattrop_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t dict_len = 0;
- int64_t remote_fd = -1;
- int32_t ret = -1;
- ino_t ino = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fxattrop_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t dict_len = 0;
+ int64_t remote_fd = -1;
+ int32_t ret = -1;
+ ino_t ino = 0;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
conf = this->private;
- if (dict) {
- dict_len = dict_serialized_length (dict);
- if (dict_len < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to get serialized length of dict(%p)",
- dict);
- goto unwind;
- }
- }
-
- if (fd) {
+ if (dict) {
+ dict_len = dict_serialized_length (dict);
+ if (dict_len < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict(%p)",
+ dict);
+ goto unwind;
+ }
+ }
+
+ if (fd) {
pthread_mutex_lock (&conf->mutex);
{
fdctx = this_fd_get_ctx (fd, this);
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. "
- "returning EBADFD",
- fd->inode->ino);
- goto unwind;
- }
- ino = fd->inode->ino;
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. "
+ "returning EBADFD",
+ fd->inode->ino);
+ goto unwind;
+ }
+ ino = fd->inode->ino;
remote_fd = fdctx->remote_fd;
- }
-
- hdrlen = gf_hdr_len (req, dict_len);
- hdr = gf_hdr_new (req, dict_len);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
-
- req = gf_param (hdr);
-
- req->flags = hton32 (flags);
- req->dict_len = hton32 (dict_len);
- if (dict) {
- ret = dict_serialize (dict, req->dict);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to serialize dictionary(%p)",
- dict);
- goto unwind;
- }
- }
- req->fd = hton64 (remote_fd);
- req->ino = hton64 (ino);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FXATTROP,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ }
+
+ hdrlen = gf_hdr_len (req, dict_len);
+ hdr = gf_hdr_new (req, dict_len);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
+
+ req = gf_param (hdr);
+
+ req->flags = hton32 (flags);
+ req->dict_len = hton32 (dict_len);
+ if (dict) {
+ ret = dict_serialize (dict, req->dict);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to serialize dictionary(%p)",
+ dict);
+ goto unwind;
+ }
+ }
+ req->fd = hton64 (remote_fd);
+ req->ino = hton64 (ino);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FXATTROP,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND (frame, -1, EBADFD, NULL);
- return 0;
+ STACK_UNWIND (frame, -1, EBADFD, NULL);
+ return 0;
}
@@ -1876,65 +1876,65 @@ int
client_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
dict_t *dict, int32_t flags)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_setxattr_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t dict_len = 0;
- int ret = -1;
- size_t pathlen = 0;
- ino_t ino = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_setxattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t dict_len = 0;
+ int ret = -1;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- dict_len = dict_serialized_length (dict);
- if (dict_len < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to get serialized length of dict(%p)",
- dict);
- goto unwind;
- }
+ dict_len = dict_serialized_length (dict);
+ if (dict_len < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict(%p)",
+ dict);
+ goto unwind;
+ }
- pathlen = STRLEN_0(loc->path);
+ pathlen = STRLEN_0 (loc->path);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SETXATTR %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "SETXATTR %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, dict_len + pathlen);
- hdr = gf_hdr_new (req, dict_len + pathlen);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, dict_len + pathlen);
+ hdr = gf_hdr_new (req, dict_len + pathlen);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- req->flags = hton32 (flags);
- req->dict_len = hton32 (dict_len);
-
- ret = dict_serialize (dict, req->dict);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to serialize dictionary(%p)",
- dict);
- goto unwind;
- }
-
- strcpy (req->path + dict_len, loc->path);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETXATTR,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ req->flags = hton32 (flags);
+ req->dict_len = hton32 (dict_len);
+
+ ret = dict_serialize (dict, req->dict);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to serialize dictionary(%p)",
+ dict);
+ goto unwind;
+ }
+
+ strcpy (req->path + dict_len, loc->path);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_SETXATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
/**
@@ -1952,25 +1952,25 @@ int
client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
dict_t *dict, int32_t flags)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fsetxattr_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t dict_len = 0;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fsetxattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t dict_len = 0;
ino_t ino;
- int ret = -1;
- int64_t remote_fd = -1;
+ int ret = -1;
+ int64_t remote_fd = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
conf = this->private;
- dict_len = dict_serialized_length (dict);
- if (dict_len < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to get serialized length of dict(%p)",
- dict);
- goto unwind;
- }
+ dict_len = dict_serialized_length (dict);
+ if (dict_len < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict(%p)",
+ dict);
+ goto unwind;
+ }
pthread_mutex_lock (&conf->mutex);
{
@@ -1987,37 +1987,37 @@ client_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
ino = fd->inode->ino;
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, dict_len);
- hdr = gf_hdr_new (req, dict_len);
+ hdrlen = gf_hdr_len (req, dict_len);
+ hdr = gf_hdr_new (req, dict_len);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->fd = hton64 (remote_fd);
- req->flags = hton32 (flags);
- req->dict_len = hton32 (dict_len);
-
- ret = dict_serialize (dict, req->dict);
- if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to serialize dictionary(%p)",
- dict);
- goto unwind;
- }
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSETXATTR,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ req->flags = hton32 (flags);
+ req->dict_len = hton32 (dict_len);
+
+ ret = dict_serialize (dict, req->dict);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to serialize dictionary(%p)",
+ dict);
+ goto unwind;
+ }
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FSETXATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
/**
@@ -2033,51 +2033,51 @@ int
client_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_getxattr_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t pathlen = 0;
- size_t namelen = 0;
- ino_t ino = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_getxattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t pathlen = 0;
+ size_t namelen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- pathlen = STRLEN_0(loc->path);
- if (name)
- namelen = STRLEN_0(name);
+ pathlen = STRLEN_0 (loc->path);
+ if (name)
+ namelen = STRLEN_0 (name);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "GETXATTR %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "GETXATTR %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen + namelen);
- hdr = gf_hdr_new (req, pathlen + namelen);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen + namelen);
+ hdr = gf_hdr_new (req, pathlen + namelen);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- req->namelen = hton32 (namelen);
- strcpy (req->path, loc->path);
- if (name)
- strcpy (req->name + pathlen, name);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETXATTR,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ req->namelen = hton32 (namelen);
+ strcpy (req->path, loc->path);
+ if (name)
+ strcpy (req->name + pathlen, name);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETXATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -2094,18 +2094,18 @@ int
client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_fgetxattr_req_t *req = NULL;
- size_t hdrlen = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_fgetxattr_req_t *req = NULL;
+ size_t hdrlen = 0;
int64_t remote_fd = -1;
- size_t namelen = 0;
- ino_t ino = 0;
+ size_t namelen = 0;
+ ino_t ino = 0;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
- if (name)
- namelen = STRLEN_0(name);
+ if (name)
+ namelen = STRLEN_0 (name);
conf = this->private;
@@ -2124,31 +2124,31 @@ client_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
ino = fd->inode->ino;
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, namelen);
- hdr = gf_hdr_new (req, namelen);
+ hdrlen = gf_hdr_len (req, namelen);
+ hdr = gf_hdr_new (req, namelen);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->fd = hton64 (remote_fd);
- req->namelen = hton32 (namelen);
+ req->namelen = hton32 (namelen);
- if (name)
- strcpy (req->name, name);
+ if (name)
+ strcpy (req->name, name);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_FGETXATTR,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_FGETXATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
+ if (hdr)
+ free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, NULL);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL, NULL);
+ return 0;
}
@@ -2166,47 +2166,47 @@ int
client_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name)
{
- int ret = -1;
- gf_hdr_common_t *hdr = NULL;
- gf_fop_removexattr_req_t *req = NULL;
- size_t hdrlen = 0;
- size_t namelen = 0;
- size_t pathlen = 0;
- ino_t ino = 0;
+ int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_removexattr_req_t *req = NULL;
+ size_t hdrlen = 0;
+ size_t namelen = 0;
+ size_t pathlen = 0;
+ ino_t ino = 0;
uint64_t gen = 0;
- pathlen = STRLEN_0(loc->path);
- namelen = STRLEN_0(name);
+ pathlen = STRLEN_0 (loc->path);
+ namelen = STRLEN_0 (name);
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "REMOVEXATTR %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "REMOVEXATTR %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- hdrlen = gf_hdr_len (req, pathlen + namelen);
- hdr = gf_hdr_new (req, pathlen + namelen);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen + namelen);
+ hdr = gf_hdr_new (req, pathlen + namelen);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
- strcpy (req->name + pathlen, name);
-
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_REMOVEXATTR,
- hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ strcpy (req->path, loc->path);
+ strcpy (req->name + pathlen, name);
+
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_REMOVEXATTR,
+ hdr, hdrlen, NULL, 0, NULL);
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL);
+ return 0;
}
/**
@@ -2222,54 +2222,54 @@ int
client_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc,
fd_t *fd)
{
- gf_fop_opendir_req_t *req = NULL;
- gf_hdr_common_t *hdr = NULL;
- size_t hdrlen = 0;
- int ret = -1;
- ino_t ino = 0;
+ gf_fop_opendir_req_t *req = NULL;
+ gf_hdr_common_t *hdr = NULL;
+ size_t hdrlen = 0;
+ int ret = -1;
+ ino_t ino = 0;
uint64_t gen = 0;
- size_t pathlen = 0;
- client_local_t *local = NULL;
+ size_t pathlen = 0;
+ client_local_t *local = NULL;
+
+ local = calloc (1, sizeof (*local));
+ GF_VALIDATE_OR_GOTO (this->name, local, unwind);
- local = calloc (1, sizeof (*local));
- GF_VALIDATE_OR_GOTO(this->name, local, unwind);
+ loc_copy (&local->loc, loc);
+ local->fd = fd_ref (fd);
- loc_copy (&local->loc, loc);
- local->fd = fd_ref (fd);
+ frame->local = local;
- frame->local = local;
-
- ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
- if (loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "OPENDIR %"PRId64" (%s): "
+ ret = inode_ctx_get2 (loc->inode, this, &ino, &gen);
+ if (loc->inode->ino && ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "OPENDIR %"PRId64" (%s): "
"failed to get remote inode number",
- loc->inode->ino, loc->path);
- }
+ loc->inode->ino, loc->path);
+ }
- pathlen = STRLEN_0(loc->path);
+ pathlen = STRLEN_0 (loc->path);
- hdrlen = gf_hdr_len (req, pathlen);
- hdr = gf_hdr_new (req, pathlen);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, pathlen);
+ hdr = gf_hdr_new (req, pathlen);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req = gf_param (hdr);
+ req = gf_param (hdr);
- req->ino = hton64 (ino);
+ req->ino = hton64 (ino);
req->gen = hton64 (gen);
- strcpy (req->path, loc->path);
+ strcpy (req->path, loc->path);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPENDIR,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_OPENDIR,
+ hdr, hdrlen, NULL, 0, NULL);
- return ret;
+ return ret;
unwind:
- if (hdr)
- free (hdr);
- STACK_UNWIND(frame, -1, EINVAL, fd);
- return 0;
+ if (hdr)
+ free (hdr);
+ STACK_UNWIND (frame, -1, EINVAL, fd);
+ return 0;
}
@@ -2286,11 +2286,11 @@ int
client_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
size_t size, off_t offset, int32_t flag)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_getdents_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_getdents_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int ret = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
@@ -2302,35 +2302,35 @@ client_getdents (call_frame_t *frame, xlator_t *this, fd_t *fd,
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- STACK_UNWIND (frame, -1, EBADFD, NULL);
- return 0;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ STACK_UNWIND (frame, -1, EBADFD, NULL);
+ return 0;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req = gf_param (hdr);
- GF_VALIDATE_OR_GOTO(frame->this->name, hdr, unwind);
+ req = gf_param (hdr);
+ GF_VALIDATE_OR_GOTO (frame->this->name, hdr, unwind);
- req->fd = hton64 (remote_fd);
- req->size = hton32 (size);
- req->offset = hton64 (offset);
- req->flags = hton32 (flag);
+ req->fd = hton64 (remote_fd);
+ req->size = hton32 (size);
+ req->offset = hton64 (offset);
+ req->flags = hton32 (flag);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_BULK),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETDENTS,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_BULK),
+ GF_OP_TYPE_FOP_REQUEST, GF_FOP_GETDENTS,
+ hdr, hdrlen, NULL, 0, NULL);
- return 0;
+ return 0;
unwind:
- STACK_UNWIND(frame, -1, EINVAL, NULL, 0);
- return 0;
+ STACK_UNWIND (frame, -1, EINVAL, NULL, 0);
+ return 0;
}
@@ -2370,10 +2370,10 @@ client_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
remote_fd = fdctx->remote_fd;
hdrlen = gf_hdr_len (req, 0);
hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
req = gf_param (hdr);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
req->fd = hton64 (remote_fd);
req->size = hton32 (size);
@@ -2404,13 +2404,13 @@ unwind:
int
client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
- off_t offset)
+ off_t offset)
{
- gf_hdr_common_t *hdr = NULL;
- gf_fop_readdir_req_t *req = NULL;
- size_t hdrlen = 0;
- int64_t remote_fd = -1;
- int ret = -1;
+ gf_hdr_common_t *hdr = NULL;
+ gf_fop_readdir_req_t *req = NULL;
+ size_t hdrlen = 0;
+ int64_t remote_fd = -1;
+ int ret = -1;
client_fd_ctx_t *fdctx = NULL;
client_conf_t *conf = NULL;
@@ -2422,35 +2422,35 @@ client_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
}
pthread_mutex_unlock (&conf->mutex);
- if (fdctx == NULL) {
- gf_log (this->name, GF_LOG_TRACE,
- "(%"PRId64"): failed to get fd ctx. EBADFD",
- fd->inode->ino);
- goto unwind;
- }
+ if (fdctx == NULL) {
+ gf_log (this->name, GF_LOG_TRACE,
+ "(%"PRId64"): failed to get fd ctx. EBADFD",
+ fd->inode->ino);
+ goto unwind;
+ }
remote_fd = fdctx->remote_fd;
- hdrlen = gf_hdr_len (req, 0);
- hdr = gf_hdr_new (req, 0);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ hdrlen = gf_hdr_len (req, 0);
+ hdr = gf_hdr_new (req, 0);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req = gf_param (hdr);
- GF_VALIDATE_OR_GOTO(this->name, hdr, unwind);
+ req = gf_param (hdr);
+ GF_VALIDATE_OR_GOTO (this->name, hdr, unwind);
- req->fd = hton64 (remote_fd);
- req->size = hton32 (size);
- req->offset = hton64 (offset);
+ req->fd = hton64 (remote_fd);
+ req->size = hton32 (size);
+ req->offset = hton64 (offset);
- ret = protocol_client_xfer (frame, this,
- CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
- GF_OP_TYPE_FOP_REQUEST, GF_FOP_READDIR,
- hdr, hdrlen, NULL, 0, NULL);
+ ret = protocol_client_xfer (frame, this,
+ CLIENT_CHANNEL (this, CHANNEL_LOWLAT),
+