summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/stack.c20
-rw-r--r--libglusterfs/src/stack.h14
2 files changed, 25 insertions, 9 deletions
diff --git a/libglusterfs/src/stack.c b/libglusterfs/src/stack.c
index bf905ca0b0e..61c779b0453 100644
--- a/libglusterfs/src/stack.c
+++ b/libglusterfs/src/stack.c
@@ -63,6 +63,26 @@ create_frame (xlator_t *xl, call_pool_t *pool)
}
void
+call_stack_set_groups (call_stack_t *stack, int ngrps, gid_t **groupbuf_p)
+{
+ /* We take the ownership of the passed group buffer. */
+
+ if (ngrps <= SMALL_GROUP_COUNT) {
+ memcpy (stack->groups_small, *groupbuf_p,
+ sizeof (gid_t) * ngrps);
+ stack->groups = stack->groups_small;
+ GF_FREE (*groupbuf_p);
+ } else {
+ stack->groups_large = *groupbuf_p;
+ stack->groups = stack->groups_large;
+ }
+
+ stack->ngrps = ngrps;
+ /* Set a canary. */
+ *groupbuf_p = (void *)0xdeadf00d;
+}
+
+void
gf_proc_dump_call_frame (call_frame_t *call_frame, const char *key_buf,...)
{
diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h
index ac395fcc4b0..251a5c25e85 100644
--- a/libglusterfs/src/stack.h
+++ b/libglusterfs/src/stack.h
@@ -390,26 +390,21 @@ STACK_RESET (call_stack_t *stack)
} while (0)
-static void
-call_stack_set_groups (call_stack_t *stack, int ngrps, gid_t *groupbuf)
-{
- stack->groups = groupbuf;
- stack->ngrps = ngrps;
-}
-
static inline int
call_stack_alloc_groups (call_stack_t *stack, int ngrps)
{
if (ngrps <= SMALL_GROUP_COUNT) {
- call_stack_set_groups (stack, ngrps, stack->groups_small);
+ stack->groups = stack->groups_small;
} else {
stack->groups_large = GF_CALLOC (ngrps, sizeof (gid_t),
gf_common_mt_groups_t);
if (!stack->groups_large)
return -1;
- call_stack_set_groups (stack, ngrps, stack->groups_large);
+ stack->groups = stack->groups_large;
}
+ stack->ngrps = ngrps;
+
return 0;
}
@@ -507,6 +502,7 @@ copy_frame (call_frame_t *frame)
return newframe;
}
+void call_stack_set_groups (call_stack_t *stack, int ngrps, gid_t **groupbuf_p);
void gf_proc_dump_pending_frames(call_pool_t *call_pool);
void gf_proc_dump_pending_frames_to_dict (call_pool_t *call_pool,
dict_t *dict);