diff options
-rw-r--r-- | libglusterfs/src/common-utils.h | 5 | ||||
-rw-r--r-- | xlators/features/changelog/src/changelog.c | 46 |
2 files changed, 51 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index f76059b3082..5f67a162d59 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -119,8 +119,13 @@ enum _gf_client_pid GF_CLIENT_PID_GLFS_HEAL = -7, }; +enum _gf_xlator_ipc_targets { + GF_IPC_TARGET_CHANGELOG = 0, +}; + typedef enum _gf_boolean gf_boolean_t; typedef enum _gf_client_pid gf_client_pid_t; +typedef enum _gf_xlator_ipc_targets _gf_xlator_ipc_targets_t; typedef int (*gf_cmp) (void *, void *); void gf_global_variable_init(void); 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 = { |