Hide lttng_event_copy symbol
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 28 Aug 2018 16:13:43 +0000 (12:13 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 28 Aug 2018 16:13:46 +0000 (12:13 -0400)
lttng_event_copy()'s only caller is internal. It is hidden to
reduce the API surface, but could be made public at some point
to accomodate lttng-ctl users.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/event-internal.h
include/lttng/event.h
src/bin/lttng-sessiond/main.c
src/common/Makefile.am
src/common/event.c [new file with mode: 0644]
src/lib/lttng-ctl/event.c

index 8902a1a08d14233760597fcf9c1a7e854468e60c..f8130e3b948c0873ab0f13e7497f51456765e9ff 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef LTTNG_EVENT_INTERNAL_H
 #define LTTNG_EVENT_INTERNAL_H
 
+#include <common/macros.h>
+#include <lttng/event.h>
+
 struct lttng_userspace_probe_location;
 
 struct lttng_event_extended {
@@ -40,4 +43,7 @@ struct lttng_event_extended {
        struct lttng_userspace_probe_location *probe_location;
 };
 
+LTTNG_HIDDEN
+struct lttng_event *lttng_event_copy(const struct lttng_event *event);
+
 #endif /* LTTNG_EVENT_INTERNAL_H */
index 2a02859a39e195cd8a013c3935e397394dddd69e..0f75245c91e95f9075a6a147f7cbbf0f6d7d48cf 100644 (file)
@@ -321,8 +321,6 @@ extern int lttng_list_events(struct lttng_handle *handle,
  */
 extern struct lttng_event *lttng_event_create(void);
 
-extern struct lttng_event *lttng_event_copy(const struct lttng_event *event);
-
 /*
  * Destroy an lttng_event.
  *
index ee50db21e38b2c29a400b1ccec0065f72f28900c..bc3b49b71558013cfdfa04b15c624a280821c938 100644 (file)
@@ -51,6 +51,7 @@
 #include <common/config/session-config.h>
 #include <common/dynamic-buffer.h>
 #include <lttng/userspace-probe-internal.h>
+#include <lttng/event-internal.h>
 
 #include "lttng-sessiond.h"
 #include "buffer-registry.h"
index d6a7da1d8b790fefbbfc95d60ab16b2e5fc94b82..b9d344b88a59bd2616269ce7500da1cf480e5dea 100644 (file)
@@ -27,7 +27,7 @@ libcommon_la_SOURCES = error.h error.c utils.c utils.h runas.h \
                        buffer-view.h buffer-view.c \
                        location.c \
                        waiter.h waiter.c \
-                       userspace-probe.c
+                       userspace-probe.c event.c
 
 libcommon_la_LIBADD = \
                $(top_builddir)/src/common/config/libconfig.la \
diff --git a/src/common/event.c b/src/common/event.c
new file mode 100644 (file)
index 0000000..329a868
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 - Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License, version 2.1 only,
+ * as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <lttng/event-internal.h>
+#include <common/error.h>
+
+LTTNG_HIDDEN
+struct lttng_event *lttng_event_copy(const struct lttng_event *event)
+{
+       struct lttng_event *new_event;
+       struct lttng_event_extended *new_event_extended;
+
+       new_event = zmalloc(sizeof(*event));
+       if (!new_event) {
+               PERROR("Error allocating event structure");
+               goto end;
+       }
+
+       /* Copy the content of the old event. */
+       memcpy(new_event, event, sizeof(*event));
+
+       /*
+        * We need to create a new extended since the previous pointer is now
+        * invalid.
+        */
+       new_event_extended = zmalloc(sizeof(*new_event_extended));
+       if (!new_event_extended) {
+               PERROR("Error allocating event extended structure");
+               goto error;
+       }
+
+       new_event->extended.ptr = new_event_extended;
+end:
+       return new_event;
+error:
+       free(new_event);
+       goto end;
+}
index 5785345cd1bdb703da157f428da38733aefc582f..f8abf309e5fe354ce45c69be446a7866fba3aefd 100644 (file)
@@ -54,38 +54,6 @@ error:
        goto end;
 }
 
-struct lttng_event *lttng_event_copy(const struct lttng_event *event)
-{
-       struct lttng_event *new_event;
-       struct lttng_event_extended *new_event_extended;
-
-       new_event = zmalloc(sizeof(*event));
-       if (!new_event) {
-               PERROR("Error allocating event structure");
-               goto end;
-       }
-
-       /* Copy the content of the old event. */
-       memcpy(new_event, event, sizeof(*event));
-
-       /*
-        * We need to create a new extended since the previous pointer is now
-        * invalid.
-        */
-       new_event_extended = zmalloc(sizeof(*new_event_extended));
-       if (!new_event_extended) {
-               PERROR("Error allocating event extended structure");
-               goto error;
-       }
-
-       new_event->extended.ptr = new_event_extended;
-end:
-       return new_event;
-error:
-       free(new_event);
-       goto end;
-}
-
 void lttng_event_destroy(struct lttng_event *event)
 {
        struct lttng_event_extended *event_extended;
This page took 0.030803 seconds and 4 git commands to generate.