summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src/client.h
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendrabhat@gluster.com>2011-08-31 13:02:21 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-11 23:24:38 -0700
commit225dd7da8959c78331d16ba2c2a955b1432bc873 (patch)
tree7986417087855e88fd905c519f9cc7a405d6c2ce /xlators/protocol/client/src/client.h
parenta2ef31b01537d8edd5ecf3738967704b0a19b137 (diff)
protocol/client: avoid code duplication in fd based operations
Change-Id: I012f78bac8ba82333628c59ef51d5e5f43d05ac7 BUG: 3158 Reviewed-on: http://review.gluster.com/329 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/protocol/client/src/client.h')
-rw-r--r--xlators/protocol/client/src/client.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 1322aebf961..459ceed70cd 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -35,6 +35,31 @@
#define CLIENT_CMD_DISCONNECT "trusted.glusterfs.client-disconnect"
#define CLIENT_DUMP_LOCKS "trusted.glusterfs.clientlk-dump"
+#define CLIENT_GET_FD_CTX(conf, args, fdctx, op_errno, label) \
+ do { \
+ pthread_mutex_lock (&conf->lock); \
+ { \
+ fdctx = this_fd_get_ctx (args->fd, this); \
+ } \
+ pthread_mutex_unlock (&conf->lock); \
+ \
+ if (fdctx == NULL) { \
+ gf_log (this->name, GF_LOG_WARNING, \
+ "(%s): failed to get fd ctx. EBADFD", \
+ uuid_utoa (args->fd->inode->gfid)); \
+ op_errno = EBADFD; \
+ goto label; \
+ } \
+ \
+ if (fdctx->remote_fd == -1) { \
+ gf_log (this->name, GF_LOG_WARNING, \
+ "(%s): failed to get fd ctx. EBADFD", \
+ uuid_utoa (args->fd->inode->gfid)); \
+ op_errno = EBADFD; \
+ goto label; \
+ } \
+ } while (0);
+
struct clnt_options {
char *remote_subvolume;
int ping_timeout;