common: move copy_filter_bytecode to bytecode.c and rename it
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 8 Apr 2020 20:38:19 +0000 (16:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 9 Mar 2021 04:51:11 +0000 (23:51 -0500)
Since there's now a file dedicated to bytecode stuff, that is
independent of filters, move copy_filter_bytecode there.  Rename it to
`bytecode_copy`.

Change-Id: I61a7a7fa1a04d39fbaf367f6bf8147b323aa8b27
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Depends-on: lttng-ust: I5a800fc92e588c2a6a0e26282b0ad5f31c044479

src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/utils.c
src/bin/lttng-sessiond/utils.h
src/common/bytecode/bytecode.c
src/common/bytecode/bytecode.h

index 40eb2656098b7d0b3ab69a9dd1219b0d5beadf7b..c7768a547bf83e2d9e33450de1fe2362b2a5a0ec 100644 (file)
@@ -16,6 +16,7 @@
 #include <lttng/condition/event-rule.h>
 #include <lttng/event-rule/event-rule.h>
 #include <lttng/event-rule/event-rule-internal.h>
+#include <common/bytecode/bytecode.h>
 #include <common/error.h>
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/filter.h>
index 0f8664cc3c65fd29471c1ef78786ddde8ee0fca7..5ba14748d9014b07cd5ec1aabba2dedae87940b4 100644 (file)
@@ -18,6 +18,7 @@
 #include <urcu/compiler.h>
 #include <signal.h>
 
+#include <common/bytecode/bytecode.h>
 #include <common/compat/errno.h>
 #include <common/common.h>
 #include <common/hashtable/utils.h>
index febf2305826a5ce31c7033e111457aae5040618c..f84859fc621645aea1939d7c04648c7ac729682a 100644 (file)
@@ -98,26 +98,3 @@ const char *consumer_output_get_base_path(const struct consumer_output *output)
                        output->dst.session_root_path :
                        output->dst.net.base_dir;
 }
-
-/*
- * Allocate a filter and copy the given original filter.
- *
- * Return allocated filter or NULL on error.
- */
-struct lttng_filter_bytecode *lttng_filter_bytecode_copy(
-               const struct lttng_filter_bytecode *orig_f)
-{
-       struct lttng_filter_bytecode *filter = NULL;
-
-       /* Copy filter bytecode */
-       filter = zmalloc(sizeof(*filter) + orig_f->len);
-       if (!filter) {
-               PERROR("zmalloc alloc filter bytecode");
-               goto error;
-       }
-
-       memcpy(filter, orig_f, sizeof(*filter) + orig_f->len);
-
-error:
-       return filter;
-}
index 2492bb0f6f646a149490282f34a442e49116cac5..ff8deaec45597b64ab88a366b1c7cec39a89ec4d 100644 (file)
@@ -19,7 +19,5 @@ int loglevels_match(int a_loglevel_type, int a_loglevel_value,
        int b_loglevel_type, int b_loglevel_value, int loglevel_all_type);
 const char *session_get_base_path(const struct ltt_session *session);
 const char *consumer_output_get_base_path(const struct consumer_output *output);
-struct lttng_filter_bytecode *lttng_filter_bytecode_copy(
-               const struct lttng_filter_bytecode *orig_f);
 
 #endif /* _LTT_UTILS_H */
index b8edd6913e18fa9fe1b4f7dbb753380c05a59e89..e85dd66c14eb90a6584c882d9401bd70ccba0822 100644 (file)
@@ -99,3 +99,25 @@ int bytecode_push_logical(struct lttng_filter_bytecode_alloc **fb,
                        - (void *) &(*fb)->b.data[0];
        return 0;
 }
+
+/*
+ * Allocate an lttng_bytecode object and copy the given original bytecode.
+ *
+ * Return allocated bytecode or NULL on error.
+ */
+LTTNG_HIDDEN
+struct lttng_filter_bytecode *lttng_filter_bytecode_copy(
+               const struct lttng_filter_bytecode *orig_f)
+{
+       struct lttng_filter_bytecode *bytecode = NULL;
+
+       bytecode = zmalloc(sizeof(*bytecode) + orig_f->len);
+       if (!bytecode) {
+               goto error;
+       }
+
+       memcpy(bytecode, orig_f, sizeof(*bytecode) + orig_f->len);
+
+error:
+       return bytecode;
+}
index ecf54f92e7a707b4a1ffbcfe943f53f25e3a0532..3a639c939b45fc12b8cddb5babe2f7d8009273e0 100644 (file)
@@ -238,6 +238,8 @@ LTTNG_HIDDEN int bytecode_push(struct lttng_filter_bytecode_alloc **fb,
 LTTNG_HIDDEN int bytecode_push_logical(struct lttng_filter_bytecode_alloc **fb,
                struct logical_op *data, uint32_t align, uint32_t len,
                uint16_t *skip_offset);
+LTTNG_HIDDEN struct lttng_filter_bytecode *lttng_filter_bytecode_copy(
+               const struct lttng_filter_bytecode *orig_f);
 
 static inline
 unsigned int bytecode_get_len(struct lttng_filter_bytecode *bytecode)
This page took 0.029168 seconds and 4 git commands to generate.