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
#include <lttng/condition/event-rule.h>
#include <lttng/event-rule/event-rule.h>
#include <lttng/event-rule/event-rule-internal.h>
#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>
#include <common/error.h>
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/filter.h>
#include <urcu/compiler.h>
#include <signal.h>
#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>
#include <common/compat/errno.h>
#include <common/common.h>
#include <common/hashtable/utils.h>
output->dst.session_root_path :
output->dst.net.base_dir;
}
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;
-}
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);
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 */
#endif /* _LTT_UTILS_H */
- (void *) &(*fb)->b.data[0];
return 0;
}
- (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;
+}
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 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)
static inline
unsigned int bytecode_get_len(struct lttng_filter_bytecode *bytecode)