diff options
author | Anand V. Avati <avati@amp.gluster.com> | 2009-05-22 02:10:22 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-05-22 01:01:11 -0700 |
commit | b7c1bcb4ea5ddd498f04b178f60209abbc9f01ed (patch) | |
tree | dbf67727da9afa4957bc609602a2f2d75ee09013 /libglusterfs | |
parent | 207fb347ed24716ac4f443bab2d1daeb9ae5ccf4 (diff) |
THIS: set appropriately in STACK_* macros
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/stack.h | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 10ab7f2025a..15b24ea08d9 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -41,6 +41,7 @@ typedef struct _call_pool_t call_pool_t; #include "dict.h" #include "list.h" #include "common-utils.h" +#include "globals.h" typedef int32_t (*ret_fn_t) (call_frame_t *frame, @@ -140,6 +141,7 @@ STACK_DESTROY (call_stack_t *stack) #define STACK_WIND(frame, rfn, obj, fn, params ...) \ do { \ call_frame_t *_new = NULL; \ + xlator_t *old_THIS = NULL; \ \ _new = CALLOC (1, sizeof (call_frame_t)); \ ERR_ABORT (_new); \ @@ -157,15 +159,20 @@ STACK_DESTROY (call_stack_t *stack) LOCK_INIT (&_new->lock); \ frame->ref_count++; \ \ + old_THIS = THIS; \ + THIS = obj; \ fn (_new, obj, params); \ + THIS = old_THIS; \ } while (0) /* make a call with a cookie */ #define STACK_WIND_COOKIE(frame, rfn, cky, obj, fn, params ...) \ do { \ - call_frame_t *_new = CALLOC (1, \ - sizeof (call_frame_t)); \ + call_frame_t *_new = NULL; \ + xlator_t *old_THIS = NULL; \ + \ + _new = CALLOC (1, sizeof (call_frame_t)); \ ERR_ABORT (_new); \ typeof(fn##_cbk) tmp_cbk = rfn; \ _new->root = frame->root; \ @@ -182,17 +189,27 @@ STACK_DESTROY (call_stack_t *stack) frame->ref_count++; \ fn##_cbk = rfn; \ \ + old_THIS = THIS; \ + THIS = obj; \ fn (_new, obj, params); \ + THIS = old_THIS; \ } while (0) /* return from function */ #define STACK_UNWIND(frame, params ...) \ do { \ - ret_fn_t fn = frame->ret; \ - call_frame_t *_parent = frame->parent; \ + ret_fn_t fn = NULL; \ + call_frame_t *_parent = NULL; \ + xlator_t *old_THIS = NULL; \ + \ + fn = frame->ret; \ + _parent = frame->parent; \ _parent->ref_count--; \ + old_THIS = THIS; \ + THIS = _parent->this; \ fn (_parent, frame->cookie, _parent->this, params); \ + THIS = old_THIS; \ } while (0) |