#include <lttng/userspace-probe-internal.h>
#define IS_UPROBE_EVENT_RULE(rule) \
- (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_UPROBE)
+ (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE)
-static void lttng_event_rule_uprobe_destroy(struct lttng_event_rule *rule)
+static void lttng_event_rule_userspace_probe_destroy(struct lttng_event_rule *rule)
{
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
lttng_userspace_probe_location_destroy(uprobe->location);
free(uprobe->name);
free(uprobe);
}
-static bool lttng_event_rule_uprobe_validate(
+static bool lttng_event_rule_userspace_probe_validate(
const struct lttng_event_rule *rule)
{
bool valid = false;
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
if (!rule) {
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
/* Required field. */
if (!uprobe->name) {
return valid;
}
-static int lttng_event_rule_uprobe_serialize(
+static int lttng_event_rule_userspace_probe_serialize(
const struct lttng_event_rule *rule,
struct lttng_payload *payload)
{
int ret;
size_t name_len, header_offset, size_before_probe;
- struct lttng_event_rule_uprobe *uprobe;
- struct lttng_event_rule_uprobe_comm uprobe_comm = {};
- struct lttng_event_rule_uprobe_comm *header;
+ struct lttng_event_rule_userspace_probe *uprobe;
+ struct lttng_event_rule_userspace_probe_comm uprobe_comm = {};
+ struct lttng_event_rule_userspace_probe_comm *header;
if (!rule || !IS_UPROBE_EVENT_RULE(rule)) {
ret = -1;
header_offset = payload->buffer.size;
DBG("Serializing uprobe event rule.");
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
name_len = strlen(uprobe->name) + 1;
}
/* Update the header regarding the probe size. */
- header = (struct lttng_event_rule_uprobe_comm
+ header = (struct lttng_event_rule_userspace_probe_comm
*) ((char *) payload->buffer.data +
header_offset);
header->location_len = payload->buffer.size - size_before_probe;
return ret;
}
-static bool lttng_event_rule_uprobe_is_equal(const struct lttng_event_rule *_a,
+static bool lttng_event_rule_userspace_probe_is_equal(const struct lttng_event_rule *_a,
const struct lttng_event_rule *_b)
{
bool is_equal = false;
- struct lttng_event_rule_uprobe *a, *b;
+ struct lttng_event_rule_userspace_probe *a, *b;
- a = container_of(_a, struct lttng_event_rule_uprobe, parent);
- b = container_of(_b, struct lttng_event_rule_uprobe, parent);
+ a = container_of(_a, struct lttng_event_rule_userspace_probe, parent);
+ b = container_of(_b, struct lttng_event_rule_userspace_probe, parent);
/* uprobe is invalid if this is not true. */
assert(a->name);
return is_equal;
}
-static enum lttng_error_code lttng_event_rule_uprobe_generate_filter_bytecode(
+static enum lttng_error_code lttng_event_rule_userspace_probe_generate_filter_bytecode(
struct lttng_event_rule *rule,
const struct lttng_credentials *creds)
{
return LTTNG_OK;
}
-static const char *lttng_event_rule_uprobe_get_filter(
+static const char *lttng_event_rule_userspace_probe_get_filter(
const struct lttng_event_rule *rule)
{
/* Unsupported. */
return NULL;
}
-static const struct lttng_filter_bytecode *
-lttng_event_rule_uprobe_get_filter_bytecode(const struct lttng_event_rule *rule)
+static const struct lttng_bytecode *
+lttng_event_rule_userspace_probe_get_filter_bytecode(const struct lttng_event_rule *rule)
{
/* Unsupported. */
return NULL;
}
-static struct lttng_event_exclusion *
-lttng_event_rule_uprobe_generate_exclusions(const struct lttng_event_rule *rule)
+static enum lttng_event_rule_generate_exclusions_status
+lttng_event_rule_userspace_probe_generate_exclusions(const struct lttng_event_rule *rule,
+ struct lttng_event_exclusion **exclusions)
{
/* Unsupported. */
- return NULL;
+ *exclusions = NULL;
+ return LTTNG_EVENT_RULE_GENERATE_EXCLUSIONS_STATUS_NONE;
}
static unsigned long
-lttng_event_rule_uprobe_hash(
+lttng_event_rule_userspace_probe_hash(
const struct lttng_event_rule *rule)
{
unsigned long hash;
- struct lttng_event_rule_uprobe *urule =
+ struct lttng_event_rule_userspace_probe *urule =
container_of(rule, typeof(*urule), parent);
- hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_UPROBE,
+ hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE,
lttng_ht_seed);
hash ^= hash_key_str(urule->name, lttng_ht_seed);
hash ^= lttng_userspace_probe_location_hash(urule->location);
return hash;
}
-struct lttng_event_rule *lttng_event_rule_uprobe_create(void)
+struct lttng_event_rule *lttng_event_rule_userspace_probe_create(void)
{
struct lttng_event_rule *rule = NULL;
- struct lttng_event_rule_uprobe *urule;
+ struct lttng_event_rule_userspace_probe *urule;
- urule = zmalloc(sizeof(struct lttng_event_rule_uprobe));
+ urule = zmalloc(sizeof(struct lttng_event_rule_userspace_probe));
if (!urule) {
goto end;
}
rule = &urule->parent;
- lttng_event_rule_init(&urule->parent, LTTNG_EVENT_RULE_TYPE_UPROBE);
- urule->parent.validate = lttng_event_rule_uprobe_validate;
- urule->parent.serialize = lttng_event_rule_uprobe_serialize;
- urule->parent.equal = lttng_event_rule_uprobe_is_equal;
- urule->parent.destroy = lttng_event_rule_uprobe_destroy;
+ lttng_event_rule_init(&urule->parent, LTTNG_EVENT_RULE_TYPE_USERSPACE_PROBE);
+ urule->parent.validate = lttng_event_rule_userspace_probe_validate;
+ urule->parent.serialize = lttng_event_rule_userspace_probe_serialize;
+ urule->parent.equal = lttng_event_rule_userspace_probe_is_equal;
+ urule->parent.destroy = lttng_event_rule_userspace_probe_destroy;
urule->parent.generate_filter_bytecode =
- lttng_event_rule_uprobe_generate_filter_bytecode;
- urule->parent.get_filter = lttng_event_rule_uprobe_get_filter;
+ lttng_event_rule_userspace_probe_generate_filter_bytecode;
+ urule->parent.get_filter = lttng_event_rule_userspace_probe_get_filter;
urule->parent.get_filter_bytecode =
- lttng_event_rule_uprobe_get_filter_bytecode;
+ lttng_event_rule_userspace_probe_get_filter_bytecode;
urule->parent.generate_exclusions =
- lttng_event_rule_uprobe_generate_exclusions;
- urule->parent.hash = lttng_event_rule_uprobe_hash;
+ lttng_event_rule_userspace_probe_generate_exclusions;
+ urule->parent.hash = lttng_event_rule_userspace_probe_hash;
+
end:
return rule;
}
LTTNG_HIDDEN
-ssize_t lttng_event_rule_uprobe_create_from_payload(
+ssize_t lttng_event_rule_userspace_probe_create_from_payload(
struct lttng_payload_view *view,
struct lttng_event_rule **_event_rule)
{
ssize_t ret, offset = 0;
- const struct lttng_event_rule_uprobe_comm *uprobe_comm;
+ const struct lttng_event_rule_userspace_probe_comm *uprobe_comm;
const char *name;
struct lttng_buffer_view current_buffer_view;
struct lttng_event_rule *rule = NULL;
struct lttng_userspace_probe_location *location;
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
enum lttng_event_rule_status status;
if (!_event_rule) {
}
uprobe_comm = (typeof(uprobe_comm)) current_buffer_view.data;
-
- rule = lttng_event_rule_uprobe_create();
+ rule = lttng_event_rule_userspace_probe_create();
if (!rule) {
ERR("Failed to create event rule uprobe");
ret = -1;
/* Skip after the location. */
offset += uprobe_comm->location_len;
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
uprobe->location = location;
- status = lttng_event_rule_uprobe_set_name(rule, name);
+ status = lttng_event_rule_userspace_probe_set_name(rule, name);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
ret = -1;
goto end;
}
- if (!lttng_event_rule_uprobe_validate(rule)) {
+ if (!lttng_event_rule_userspace_probe_validate(rule)) {
ret = -1;
goto end;
}
return ret;
}
-enum lttng_event_rule_status lttng_event_rule_uprobe_set_location(
+enum lttng_event_rule_status lttng_event_rule_userspace_probe_set_location(
struct lttng_event_rule *rule,
const struct lttng_userspace_probe_location *location)
{
struct lttng_userspace_probe_location *location_copy = NULL;
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !location) {
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
location_copy = lttng_userspace_probe_location_copy(location);
if (!location_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
return status;
}
-enum lttng_event_rule_status lttng_event_rule_uprobe_get_location(
+enum lttng_event_rule_status lttng_event_rule_userspace_probe_get_location(
const struct lttng_event_rule *rule,
const struct lttng_userspace_probe_location **location)
{
goto end;
}
- *location = lttng_event_rule_uprobe_get_location_mutable(rule);
+ *location = lttng_event_rule_userspace_probe_get_location_mutable(rule);
if (!*location) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
LTTNG_HIDDEN
struct lttng_userspace_probe_location *
-lttng_event_rule_uprobe_get_location_mutable(
+lttng_event_rule_userspace_probe_get_location_mutable(
const struct lttng_event_rule *rule)
{
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
assert(rule);
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
return uprobe->location;
}
-enum lttng_event_rule_status lttng_event_rule_uprobe_set_name(
+enum lttng_event_rule_status lttng_event_rule_userspace_probe_set_name(
struct lttng_event_rule *rule, const char *name)
{
char *name_copy = NULL;
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !name ||
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
name_copy = strdup(name);
if (!name_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
return status;
}
-enum lttng_event_rule_status lttng_event_rule_uprobe_get_name(
+enum lttng_event_rule_status lttng_event_rule_userspace_probe_get_name(
const struct lttng_event_rule *rule, const char **name)
{
- struct lttng_event_rule_uprobe *uprobe;
+ struct lttng_event_rule_userspace_probe *uprobe;
enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !name) {
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_uprobe, parent);
+ uprobe = container_of(rule, struct lttng_event_rule_userspace_probe, parent);
if (!uprobe->name) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;