summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-02-25 22:21:32 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-24 06:33:32 -0700
commit9f5addd987861d0a3a1144d576221a7f93af0970 (patch)
treea6723ef501fd481da76e830a88dcad0f3a119ab7 /xlators/features
parent470d5c4af7f85809997a77af187c8f430b0354c8 (diff)
features/changelog: Make use of IPC fop
Translators which wish to send event notifications can send "down" an IPC FOP with op_type as GF_IPC_TARGET_CHANGELOG and xdata carrying event structures (changelog_event_t). Change-Id: I0e5f8c9170161c186f0e58d07105813e34e18786 BUG: 1170075 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/9775 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/changelog/src/changelog.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/xlators/features/changelog/src/changelog.c b/xlators/features/changelog/src/changelog.c
index e7d8522ae8c..bb9c51a2a0b 100644
--- a/xlators/features/changelog/src/changelog.c
+++ b/xlators/features/changelog/src/changelog.c
@@ -1714,6 +1714,51 @@ changelog_open (call_frame_t *frame, xlator_t *this,
/* {{{ */
+
+/* }}} */
+
+int32_t
+_changelog_generic_dispatcher (dict_t *dict,
+ char *key, data_t *value, void *data)
+{
+ xlator_t *this = NULL;
+ changelog_priv_t *priv = NULL;
+
+ this = data;
+ priv = this->private;
+
+ changelog_dispatch_event (this, priv, (changelog_event_t *)value->data);
+ return 0;
+}
+
+/**
+ * changelog ipc dispatches events, pointers of which are passed in
+ * @xdata. Dispatching is orderless (whatever order dict_foreach()
+ * traverses the dictionary).
+ */
+int32_t
+changelog_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
+{
+ if (op != GF_IPC_TARGET_CHANGELOG)
+ goto wind;
+
+ /* it's for us, do the job */
+ if (xdata)
+ (void) dict_foreach (xdata,
+ _changelog_generic_dispatcher, this);
+
+ STACK_UNWIND_STRICT (ipc, frame, 0, 0, NULL);
+ return 0;
+
+ wind:
+ STACK_WIND (frame, default_ipc_cbk, FIRST_CHILD (this),
+ FIRST_CHILD (this)->fops->ipc, op, xdata);
+ return 0;
+}
+
+
+/* {{{ */
+
int32_t
changelog_release (xlator_t *this, fd_t *fd)
{
@@ -2621,6 +2666,7 @@ struct xlator_fops fops = {
.fsetxattr = changelog_fsetxattr,
.removexattr = changelog_removexattr,
.fremovexattr = changelog_fremovexattr,
+ .ipc = changelog_ipc,
};
struct xlator_cbks cbks = {