summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/stack.h
diff options
context:
space:
mode:
authorAmar Tumballi <amar@80x25.org>2007-05-07 15:27:34 +0000
committerAmar Tumballi <amarts@redhat.com>2017-05-05 01:31:39 +0530
commit97ca871992901577f75e155e600f5f7ba2bb3d3e (patch)
tree168a37e1efaead58007d57707ca12e9308715941 /libglusterfs/src/stack.h
parent9c2e2ee091bb37b059b41b06976c15acd4e995e1 (diff)
* libglusterfs/src/stack.h:
- added _STACK_WIND with another argument 'cooky' which will be returned in STACK_UNWIND. * xlators/*: - changed the argument of all the '*_cbk ()' to have 'void *cooky' instead of 'call_frame_t *prev_frame' * schedulers/*: - added another function hook 'update ()', which can be called from outside to update the stat info. * xlators/cluster/*: - changed place of incrementing 'local->call_count'. moved just before checking it
Diffstat (limited to 'libglusterfs/src/stack.h')
-rw-r--r--libglusterfs/src/stack.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index 37768fee20..0e8a8eaee4 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -50,6 +50,7 @@ struct _call_frame_t {
ret_fn_t ret; /* op_return address */
int32_t ref_count;
pthread_mutex_t mutex;
+ void *cooky; /* unique cooky */
};
struct _call_ctx_t {
@@ -102,18 +103,39 @@ do { \
_new->this = obj; \
_new->ret = (ret_fn_t) rfn; \
_new->parent = frame; \
+ _new->cooky = _new; \
frame->ref_count++; \
\
fn (_new, obj, params); \
} while (0)
+/* make a call with a cooky */
+#define _STACK_WIND(frame, rfn, cky, obj, fn, params ...) \
+do { \
+ call_frame_t *_new = calloc (1, \
+ sizeof (call_frame_t)); \
+ _new->root = frame->root; \
+ _new->next = frame->root->frames.next; \
+ _new->prev = &frame->root->frames; \
+ if (frame->root->frames.next) \
+ frame->root->frames.next->prev = _new; \
+ frame->root->frames.next = _new; \
+ _new->this = obj; \
+ _new->ret = (ret_fn_t) rfn; \
+ _new->parent = frame; \
+ _new->cooky = cky; \
+ frame->ref_count++; \
+ \
+ fn (_new, obj, params); \
+} while (0)
+
/* return from function */
-#define STACK_UNWIND(frame, params ...) \
-do { \
- ret_fn_t fn = frame->ret; \
- call_frame_t *_parent = frame->parent; \
- fn (_parent, frame, _parent->this, params); \
+#define STACK_UNWIND(frame, params ...) \
+do { \
+ ret_fn_t fn = frame->ret; \
+ call_frame_t *_parent = frame->parent; \
+ fn (_parent, frame->cooky, _parent->this, params); \
} while (0)
static inline call_frame_t *