From fd2e7d007e5362f0738cd9a825349abcf5d27d8f Mon Sep 17 00:00:00 2001 From: Pavan Sondur Date: Fri, 1 Oct 2010 05:45:12 +0000 Subject: Changes to replace flock with gf_flock across GlusterFS. Signed-off-by: Pavan Vilas Sondur Signed-off-by: Vijay Bellur BUG: 865 (Add locks recovery support in GlusterFS) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=865 --- libglusterfs/src/call-stub.c | 8 ++++---- libglusterfs/src/call-stub.h | 16 ++++++++-------- libglusterfs/src/common-utils.c | 4 ++-- libglusterfs/src/defaults.c | 14 +++++++------- libglusterfs/src/defaults.h | 14 +++++++------- libglusterfs/src/glusterfs.h | 8 ++++++++ libglusterfs/src/xlator.h | 8 ++++---- 7 files changed, 40 insertions(+), 32 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 7008cfd6f..551fa99ae 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -1469,7 +1469,7 @@ fop_lk_stub (call_frame_t *frame, fop_lk_t fn, fd_t *fd, int32_t cmd, - struct flock *lock) + struct gf_flock *lock) { call_stub_t *stub = NULL; @@ -1494,7 +1494,7 @@ fop_lk_cbk_stub (call_frame_t *frame, fop_lk_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct flock *lock) + struct gf_flock *lock) { call_stub_t *stub = NULL; @@ -1515,7 +1515,7 @@ out: call_stub_t * fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, - const char *volume, loc_t *loc, int32_t cmd, struct flock *lock) + const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock) { call_stub_t *stub = NULL; @@ -1561,7 +1561,7 @@ fop_inodelk_cbk_stub (call_frame_t *frame, fop_inodelk_cbk_t fn, call_stub_t * fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, - const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock) { call_stub_t *stub = NULL; diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 83efa9a48..340468c3e 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -416,12 +416,12 @@ typedef struct { fop_lk_t fn; fd_t *fd; int32_t cmd; - struct flock lock; + struct gf_flock lock; } lk; struct { fop_lk_cbk_t fn; int32_t op_ret, op_errno; - struct flock lock; + struct gf_flock lock; } lk_cbk; /* inodelk */ @@ -430,7 +430,7 @@ typedef struct { const char *volume; loc_t loc; int32_t cmd; - struct flock lock; + struct gf_flock lock; } inodelk; struct { @@ -444,7 +444,7 @@ typedef struct { const char *volume; fd_t *fd; int32_t cmd; - struct flock lock; + struct gf_flock lock; } finodelk; struct { @@ -968,24 +968,24 @@ fop_lk_stub (call_frame_t *frame, fop_lk_t fn, fd_t *fd, int32_t cmd, - struct flock *lock); + struct gf_flock *lock); call_stub_t * fop_lk_cbk_stub (call_frame_t *frame, fop_lk_cbk_t fn, int32_t op_ret, int32_t op_errno, - struct flock *lock); + struct gf_flock *lock); call_stub_t * fop_inodelk_stub (call_frame_t *frame, fop_inodelk_t fn, const char *volume, loc_t *loc, int32_t cmd, - struct flock *lock); + struct gf_flock *lock); call_stub_t * fop_finodelk_stub (call_frame_t *frame, fop_finodelk_t fn, const char *volume, fd_t *fd, int32_t cmd, - struct flock *lock); + struct gf_flock *lock); call_stub_t * fop_entrylk_stub (call_frame_t *frame, fop_entrylk_t fn, diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 75476a029..f2db89c33 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1392,7 +1392,7 @@ gf_string2boolean (const char *str, gf_boolean_t *b) int gf_lockfd (int fd) { - struct flock fl; + struct gf_flock fl; fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET; @@ -1406,7 +1406,7 @@ gf_lockfd (int fd) int gf_unlockfd (int fd) { - struct flock fl; + struct gf_flock fl; fl.l_type = F_UNLCK; fl.l_whence = SEEK_SET; diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index d51cc8cca..3e271dde4 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -329,7 +329,7 @@ default_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t default_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct flock *lock) + int32_t op_ret, int32_t op_errno, struct gf_flock *lock) { STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock); return 0; @@ -675,7 +675,7 @@ default_removexattr_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t default_lk_resume (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t cmd, struct flock *lock) + int32_t cmd, struct gf_flock *lock) { STACK_WIND (frame, default_lk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lk, fd, cmd, lock); @@ -686,7 +686,7 @@ default_lk_resume (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t default_inodelk_resume (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, - struct flock *lock) + struct gf_flock *lock) { STACK_WIND (frame, default_inodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, @@ -697,7 +697,7 @@ default_inodelk_resume (call_frame_t *frame, xlator_t *this, int32_t default_finodelk_resume (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, - struct flock *lock) + struct gf_flock *lock) { STACK_WIND (frame, default_finodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, @@ -1043,7 +1043,7 @@ default_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t default_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t cmd, struct flock *lock) + int32_t cmd, struct gf_flock *lock) { STACK_WIND (frame, default_lk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lk, fd, cmd, lock); @@ -1054,7 +1054,7 @@ default_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t default_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, - struct flock *lock) + struct gf_flock *lock) { STACK_WIND (frame, default_inodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, @@ -1064,7 +1064,7 @@ default_inodelk (call_frame_t *frame, xlator_t *this, int32_t default_finodelk (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, int32_t cmd, struct flock *lock) + const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock) { STACK_WIND (frame, default_finodelk_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 7ddb10061..f02358210 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -181,15 +181,15 @@ int32_t default_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, @@ -396,15 +396,15 @@ int32_t default_lk_resume (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_inodelk_resume (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_finodelk_resume (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); int32_t default_entrylk_resume (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, @@ -627,7 +627,7 @@ default_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t default_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct flock *lock); + int32_t op_ret, int32_t op_errno, struct gf_flock *lock); int32_t default_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 2bb06fbb7..9e66c3044 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -144,6 +144,14 @@ typedef enum { GF_OP_TYPE_MAX, } gf_op_type_t; +struct gf_flock { + short l_type; + short l_whence; + off_t l_start; + off_t l_len; + pid_t l_pid; + uint64_t l_owner; +}; /* NOTE: all the miscellaneous flags used by GlusterFS should be listed here */ typedef enum { diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index 84ad990d4..618cf2025 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -339,7 +339,7 @@ typedef int32_t (*fop_lk_cbk_t) (call_frame_t *frame, xlator_t *this, int32_t op_ret, int32_t op_errno, - struct flock *flock); + struct gf_flock *flock); typedef int32_t (*fop_inodelk_cbk_t) (call_frame_t *frame, void *cookie, @@ -560,21 +560,21 @@ typedef int32_t (*fop_lk_t) (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); typedef int32_t (*fop_inodelk_t) (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); typedef int32_t (*fop_finodelk_t) (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, - struct flock *flock); + struct gf_flock *flock); typedef int32_t (*fop_entrylk_t) (call_frame_t *frame, xlator_t *this, -- cgit