summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand V. Avati <avati@amp.gluster.com>2009-05-22 02:10:31 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-05-22 01:23:48 -0700
commit6d5aff7bfd2403aa132d41c659c76abaf58f0503 (patch)
tree8ce3372e288ef34c4e31f347064e3222f2c6b032
parentbbce052d47e5f17a476379f5de6925ae795465bb (diff)
THIS: add xlator_init() API to set @THIS
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--libglusterfs/src/xlator.c17
-rw-r--r--libglusterfs/src/xlator.h1
2 files changed, 18 insertions, 0 deletions
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);