diff options
author | Vikas Gorur <vikas@zresearch.com> | 2009-02-23 02:33:11 -0800 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-02-23 19:31:52 +0530 |
commit | a3ed4474de9db5bda606b374f3d8cb1cdbf8a9fb (patch) | |
tree | 23da9bd50c184564c531a15a8c396af48499f07a /libglusterfs/src | |
parent | 80066c23da120621f26d83d631e204ab2943d181 (diff) |
added lock_notify and lock_fnotify FOPs to everywhere necessary in libglusterfs/*
fixed indentation and resubmitting
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs/src')
-rw-r--r-- | libglusterfs/src/call-stub.c | 140 | ||||
-rw-r--r-- | libglusterfs/src/call-stub.h | 47 | ||||
-rw-r--r-- | libglusterfs/src/common-utils.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/defaults.c | 45 | ||||
-rw-r--r-- | libglusterfs/src/defaults.h | 9 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 2 | ||||
-rw-r--r-- | libglusterfs/src/protocol.h | 14 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 26 |
9 files changed, 287 insertions, 2 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index cd735725960..76f0a736a2b 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2062,6 +2062,91 @@ fop_fxattrop_stub (call_frame_t *frame, } +call_stub_t * +fop_lock_notify_cbk_stub (call_frame_t *frame, fop_lock_notify_cbk_t fn, + int32_t op_ret, int32_t op_errno) +{ + call_stub_t *stub = NULL; + + GF_VALIDATE_OR_GOTO ("call-stub", frame, out); + + stub = stub_new (frame, 0, GF_FOP_LOCK_NOTIFY); + GF_VALIDATE_OR_GOTO ("call-stub", stub, out); + + stub->args.lock_notify_cbk.fn = fn; + stub->args.lock_notify_cbk.op_ret = op_ret; + stub->args.lock_notify_cbk.op_errno = op_errno; + +out: + return stub; +} + + +call_stub_t * +fop_lock_notify_stub (call_frame_t *frame, fop_lock_notify_t fn, + loc_t *loc, int32_t timeout) +{ + call_stub_t *stub = NULL; + + if (!frame) + return NULL; + + stub = stub_new (frame, 1, GF_FOP_LOCK_NOTIFY); + if (!stub) + return NULL; + + stub->args.lock_notify.fn = fn; + + loc_copy (&stub->args.lock_notify.loc, loc); + + stub->args.lock_notify.timeout = timeout; + + return stub; +} + + +call_stub_t * +fop_lock_fnotify_cbk_stub (call_frame_t *frame, fop_lock_fnotify_cbk_t fn, + int32_t op_ret, int32_t op_errno) +{ + call_stub_t *stub = NULL; + + GF_VALIDATE_OR_GOTO ("call-stub", frame, out); + + stub = stub_new (frame, 0, GF_FOP_LOCK_FNOTIFY); + GF_VALIDATE_OR_GOTO ("call-stub", stub, out); + + stub->args.lock_fnotify_cbk.fn = fn; + stub->args.lock_fnotify_cbk.op_ret = op_ret; + stub->args.lock_fnotify_cbk.op_errno = op_errno; + +out: + return stub; +} + + +call_stub_t * +fop_lock_fnotify_stub (call_frame_t *frame, fop_lock_fnotify_t fn, + fd_t *fd, int32_t timeout) +{ + call_stub_t *stub = NULL; + + if (!frame) + return NULL; + + stub = stub_new (frame, 1, GF_FOP_LOCK_FNOTIFY); + if (!stub) + return NULL; + + stub->args.lock_fnotify.fn = fn; + + stub->args.lock_fnotify.fd = fd_ref (fd); + stub->args.lock_fnotify.timeout = timeout; + + return stub; +} + + static void call_resume_wind (call_stub_t *stub) { @@ -2458,6 +2543,22 @@ call_resume_wind (call_stub_t *stub) break; } + case GF_FOP_LOCK_NOTIFY: + { + stub->args.lock_notify.fn (stub->frame, + stub->frame->this, + &stub->args.lock_notify.loc, + stub->args.lock_notify.timeout); + break; + } + case GF_FOP_LOCK_FNOTIFY: + { + stub->args.lock_fnotify.fn (stub->frame, + stub->frame->this, + stub->args.lock_fnotify.fd, + stub->args.lock_fnotify.timeout); + break; + } default: { gf_log ("call-stub", @@ -3232,6 +3333,34 @@ call_resume_unwind (call_stub_t *stub) break; } + case GF_FOP_LOCK_NOTIFY: + { + if (!stub->args.lock_notify_cbk.fn) + STACK_UNWIND (stub->frame, + stub->args.lock_notify_cbk.op_ret, + stub->args.lock_notify_cbk.op_errno); + else + stub->args.lock_notify_cbk.fn (stub->frame, + stub->frame->cookie, + stub->frame->this, + stub->args.lock_notify_cbk.op_ret, + stub->args.lock_notify_cbk.op_errno); + break; + } + case GF_FOP_LOCK_FNOTIFY: + { + if (!stub->args.lock_fnotify_cbk.fn) + STACK_UNWIND (stub->frame, + stub->args.lock_fnotify_cbk.op_ret, + stub->args.lock_fnotify_cbk.op_errno); + else + stub->args.lock_fnotify_cbk.fn (stub->frame, + stub->frame->cookie, + stub->frame->this, + stub->args.lock_fnotify_cbk.op_ret, + stub->args.lock_fnotify_cbk.op_errno); + break; + } case GF_FOP_MAXVALUE: { gf_log ("call-stub", @@ -3540,6 +3669,17 @@ call_stub_destroy_wind (call_stub_t *stub) dict_unref (stub->args.xattrop.xattr); break; } + case GF_FOP_LOCK_NOTIFY: + { + loc_wipe (&stub->args.lock_notify.loc); + break; + } + case GF_FOP_LOCK_FNOTIFY: + { + if (stub->args.lock_fnotify.fd) + fd_unref (stub->args.lock_fnotify.fd); + break; + } case GF_FOP_MAXVALUE: { gf_log ("call-stub", diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 12e94a15803..d08098b959a 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -567,6 +567,29 @@ typedef struct { int32_t op_errno; dict_t *xattr; } fxattrop_cbk; + + struct { + fop_lock_notify_t fn; + loc_t loc; + int32_t timeout; + } lock_notify; + struct { + fop_lock_notify_cbk_t fn; + int32_t op_ret; + int32_t op_errno; + } lock_notify_cbk; + + struct { + fop_lock_fnotify_t fn; + fd_t *fd; + int32_t timeout; + } lock_fnotify; + struct { + fop_lock_fnotify_cbk_t fn; + int32_t op_ret; + int32_t op_errno; + } lock_fnotify_cbk; + } args; } call_stub_t; @@ -1099,6 +1122,30 @@ fop_fxattrop_stub_cbk_stub (call_frame_t *frame, int32_t op_ret, int32_t op_errno); +call_stub_t * +fop_lock_notify_stub_cbk_stub (call_frame_t *frame, + fop_lock_notify_cbk_t fn, + int32_t op_ret, + int32_t op_errno); + +call_stub_t * +fop_lock_notify_stub (call_frame_t *frame, + fop_lock_notify_t fn, + loc_t *loc, + int32_t timeout); + +call_stub_t * +fop_lock_fnotify_stub_cbk_stub (call_frame_t *frame, + fop_lock_fnotify_cbk_t fn, + int32_t op_ret, + int32_t op_errno); + +call_stub_t * +fop_lock_fnotify_stub (call_frame_t *frame, + fop_lock_fnotify_t fn, + fd_t *fd, + int32_t timeout); + void call_resume (call_stub_t *stub); void call_stub_destroy (call_stub_t *stub); #endif diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index acac5e05281..14e0d5790ef 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -207,6 +207,8 @@ gf_global_variable_init() gf_fop_list[GF_FOP_FENTRYLK] = "FENTRYLK"; /* 40 */ gf_fop_list[GF_FOP_CHECKSUM] = "CHECKSUM"; /* 41 */ gf_fop_list[GF_FOP_XATTROP] = "XATTROP"; + gf_fop_list[GF_FOP_LOCK_NOTIFY] = "LOCK_NOTIFY"; + gf_fop_list[GF_FOP_LOCK_FNOTIFY]= "LOCK_FNOTIFY"; gf_mop_list[GF_MOP_SETVOLUME] = "SETVOLUME"; /* 0 */ gf_mop_list[GF_MOP_GETVOLUME] = "GETVOLUME"; /* 1 */ diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index 575e3d86e40..867c664cb6b 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -1337,6 +1337,51 @@ default_readdir (call_frame_t *frame, return 0; } + +int32_t +default_lock_notify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + + +int32_t +default_lock_fnotify_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + STACK_UNWIND (frame, op_ret, op_errno); + return 0; +} + + +int32_t +default_lock_notify (call_frame_t *frame, xlator_t *this, + loc_t *loc, int32_t timeout) +{ + STACK_WIND (frame, + default_lock_notify_cbk, + FIRST_CHILD (this), + FIRST_CHILD (this)->fops->lock_notify, + loc, timeout); + return 0; +} + + +int32_t +default_lock_fnotify (call_frame_t *frame, xlator_t *this, + fd_t *fd, int32_t timeout) +{ + STACK_WIND (frame, + default_lock_notify_cbk, + FIRST_CHILD (this), + FIRST_CHILD (this)->fops->lock_fnotify, + fd, timeout); + return 0; +} + + /* notify */ int32_t default_notify (xlator_t *this, diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index aa15df59945..cba54080b5f 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -256,6 +256,15 @@ int32_t default_fxattrop (call_frame_t *frame, gf_xattrop_flags_t flags, dict_t *dict); +int32_t +default_lock_notify (call_frame_t *frame, xlator_t *this, + loc_t *loc, int32_t timeout); + +int32_t +default_lock_fnotify (call_frame_t *frame, xlator_t *this, + fd_t *fd, int32_t timeout); + + int32_t default_notify (xlator_t *this, int32_t event, void *data, diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 6ec8a2a6316..7aadae21af5 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -124,6 +124,8 @@ typedef enum { GF_FOP_CHECKSUM, GF_FOP_XATTROP, /* 40 */ GF_FOP_FXATTROP, + GF_FOP_LOCK_NOTIFY, + GF_FOP_LOCK_FNOTIFY, GF_FOP_MAXVALUE, } glusterfs_fop_t; diff --git a/libglusterfs/src/protocol.h b/libglusterfs/src/protocol.h index 4ba869dee3a..5f7225152df 100644 --- a/libglusterfs/src/protocol.h +++ b/libglusterfs/src/protocol.h @@ -651,6 +651,20 @@ typedef struct { typedef struct { + uint64_t ino; + int32_t timeout; +} __attribute__((packed)) gf_fop_lock_notify_req_t; +typedef struct { } __attribute__((packed)) gf_fop_lock_notify_rsp_t; + + +typedef struct { + int64_t fd; + int32_t timeout; +} __attribute__((packed)) gf_fop_lock_fnotify_req_t; +typedef struct { } __attribute__((packed)) gf_fop_lock_fnotify_rsp_t; + + +typedef struct { char name[0]; } __attribute__((packed)) gf_mop_lock_req_t; typedef struct {} __attribute__((packed)) gf_mop_lock_rsp_t; diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 19f6a7f385b..235f2aaa6a0 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -95,7 +95,9 @@ fill_defaults (xlator_t *xl) SET_DEFAULT_FOP (checksum); SET_DEFAULT_FOP (xattrop); SET_DEFAULT_FOP (fxattrop); - + SET_DEFAULT_FOP (lock_notify); + SET_DEFAULT_FOP (lock_fnotify); + SET_DEFAULT_MOP (stats); SET_DEFAULT_CBK (release); diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index a24184ab8f0..b8722b2f63e 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -416,6 +416,18 @@ typedef int32_t (*fop_fxattrop_cbk_t) (call_frame_t *frame, int32_t op_errno, dict_t *xattr); +typedef int32_t (*fop_lock_notify_cbk_t) (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno); + +typedef int32_t (*fop_lock_fnotify_cbk_t) (call_frame_t *frame, + void *cookie, + xlator_t *this, + int32_t op_ret, + int32_t op_errno); + typedef int32_t (*fop_lookup_t) (call_frame_t *frame, xlator_t *this, loc_t *loc, @@ -635,6 +647,14 @@ typedef int32_t (*fop_fxattrop_t) (call_frame_t *frame, gf_xattrop_flags_t optype, dict_t *xattr); +typedef int32_t (*fop_lock_notify_t) (call_frame_t *frame, + xlator_t *this, loc_t *loc, + int32_t timeout); + +typedef int32_t (*fop_lock_fnotify_t) (call_frame_t *frame, + xlator_t *this, fd_t *fd, + int32_t timeout); + struct xlator_fops { fop_lookup_t lookup; fop_stat_t stat; @@ -677,7 +697,9 @@ struct xlator_fops { fop_getdents_t getdents; fop_checksum_t checksum; fop_xattrop_t xattrop; - fop_fxattrop_t fxattrop; + fop_fxattrop_t fxattrop; + fop_lock_notify_t lock_notify; + fop_lock_fnotify_t lock_fnotify; /* these entries are used for a typechecking hack in STACK_WIND _only_ */ fop_lookup_cbk_t lookup_cbk; @@ -722,6 +744,8 @@ struct xlator_fops { fop_checksum_cbk_t checksum_cbk; fop_xattrop_cbk_t xattrop_cbk; fop_fxattrop_cbk_t fxattrop_cbk; + fop_lock_notify_cbk_t lock_notify_cbk; + fop_lock_fnotify_cbk_t lock_fnotify_cbk; }; typedef int32_t (*cbk_forget_t) (xlator_t *this, |