Add mmap client mode
[lttng-modules.git] / ltt-context.c
index 961d80e111fcf25d57d48b332b3b58360e31bdff..634694b968d4c06f6cf5066b684c80efc10d68d9 100644 (file)
@@ -4,6 +4,8 @@
  * Copyright 2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
  * LTTng trace/channel/event context management.
+ *
+ * Dual LGPL v2.1/GPL v2 license.
  */
 
 #include <linux/module.h>
@@ -33,7 +35,7 @@ struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
                if (!new_fields)
                        return NULL;
                if (ctx->fields)
-                       memcpy(new_fields, ctx->fields, ctx->nr_fields);
+                       memcpy(new_fields, ctx->fields, sizeof(*ctx->fields) * ctx->nr_fields);
                kfree(ctx->fields);
                ctx->fields = new_fields;
        }
@@ -43,6 +45,17 @@ struct lttng_ctx_field *lttng_append_context(struct lttng_ctx **ctx_p)
 }
 EXPORT_SYMBOL_GPL(lttng_append_context);
 
+void lttng_remove_context_field(struct lttng_ctx **ctx_p,
+                               struct lttng_ctx_field *field)
+{
+       struct lttng_ctx *ctx;
+
+       ctx = *ctx_p;
+       ctx->nr_fields--;
+       memset(&ctx->fields[ctx->nr_fields], 0, sizeof(struct lttng_ctx_field));
+}
+EXPORT_SYMBOL_GPL(lttng_remove_context_field);
+
 void lttng_destroy_context(struct lttng_ctx *ctx)
 {
        int i;
This page took 0.02422 seconds and 4 git commands to generate.