From 6d5aff7bfd2403aa132d41c659c76abaf58f0503 Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Fri, 22 May 2009 02:10:31 +0000 Subject: THIS: add xlator_init() API to set @THIS Signed-off-by: Anand V. Avati --- libglusterfs/src/xlator.c | 17 +++++++++++++++++ libglusterfs/src/xlator.h | 1 + 2 files changed, 18 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 61f8f6f4eab..0f76d9c7fe7 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -824,6 +824,23 @@ xlator_notify (xlator_t *xl, int event, void *data, ...) } +int +xlator_init (xlator_t *xl) +{ + xlator_t *old_THIS = NULL; + int ret = 0; + + old_THIS = THIS; + THIS = xl; + + ret = xl->init (xl); + + THIS = old_THIS; + + return ret; +} + + void xlator_tree_fini (xlator_t *xl) { diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index ffbb6a0f84f..2bacc04577c 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -873,6 +873,7 @@ xlator_t *file_to_xlator_tree (glusterfs_ctx_t *ctx, FILE *fp); int xlator_notify (xlator_t *this, int32_t event, void *data, ...); +int xlator_init (xlator_t *this); int32_t xlator_tree_init (xlator_t *xl); int32_t xlator_tree_free (xlator_t *xl); -- cgit