diff options
author | Amar Tumballi <amarts@redhat.com> | 2017-09-12 22:07:10 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2017-11-03 07:26:41 +0000 |
commit | cf62283467d7dd30b89b80717f1fbc24670cb44b (patch) | |
tree | fe71cde3eb20befab776af44b298333668e79172 /libglusterfs/src/xlator.c | |
parent | 9424a9fcc9f670766b7557230648e57123edd600 (diff) |
Add framework for global xlator in graph
Updates #303
Change-Id: Id0b9050c93ea87532dc80b4fda650c5663d285bd
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'libglusterfs/src/xlator.c')
-rw-r--r-- | libglusterfs/src/xlator.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index de97dff6dfe..fdc2be144a6 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -305,10 +305,28 @@ xlator_set_type (xlator_t *xl, const char *type) { int ret = 0; + /* Handle 'global' translator differently */ + if (!strncmp (GF_GLOBAL_XLATOR_NAME, type, + strlen (GF_GLOBAL_XLATOR_NAME))) { + /* set the required values from Global xlator */ + xl->type = gf_strdup (GF_GLOBAL_XLATOR_NAME); + xl->cbks = global_xlator.cbks; + xl->fops = global_xlator.fops; + xl->init = global_xlator.init; + xl->fini = global_xlator.fini; + xl->reconfigure = global_xlator.reconfigure; + + INIT_LIST_HEAD (&xl->volume_options); + + fill_defaults(xl); + + goto out; + } + ret = xlator_set_type_virtual (xl, type); if (!ret) ret = xlator_dynload (xl); - +out: return ret; } |