961d80e111fcf25d57d48b332b3b58360e31bdff
4 * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 * LTTng trace/channel/event context management.
9 #include <linux/module.h>
10 #include <linux/list.h>
11 #include <linux/mutex.h>
12 #include <linux/slab.h>
13 #include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
14 #include "ltt-events.h"
15 #include "ltt-tracer.h"
17 struct lttng_ctx_field
*lttng_append_context(struct lttng_ctx
**ctx_p
)
19 struct lttng_ctx_field
*field
;
20 struct lttng_ctx
*ctx
;
23 *ctx_p
= kzalloc(sizeof(struct lttng_ctx
), GFP_KERNEL
);
28 if (ctx
->nr_fields
+ 1 > ctx
->allocated_fields
) {
29 struct lttng_ctx_field
*new_fields
;
31 ctx
->allocated_fields
= max_t(size_t, 1, 2 * ctx
->allocated_fields
);
32 new_fields
= kzalloc(ctx
->allocated_fields
* sizeof(struct lttng_ctx_field
), GFP_KERNEL
);
36 memcpy(new_fields
, ctx
->fields
, ctx
->nr_fields
);
38 ctx
->fields
= new_fields
;
40 field
= &ctx
->fields
[ctx
->nr_fields
];
44 EXPORT_SYMBOL_GPL(lttng_append_context
);
46 void lttng_destroy_context(struct lttng_ctx
*ctx
)
52 for (i
= 0; i
< ctx
->nr_fields
; i
++) {
53 if (ctx
->fields
[i
].destroy
)
54 ctx
->fields
[i
].destroy(&ctx
->fields
[i
]);
This page took 0.038458 seconds and 5 git commands to generate.