From f27911615bc5907d61d8ea236da974090bd85d24 Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Wed, 4 Nov 2020 15:23:30 -0500 Subject: [PATCH] Rename kprobe to kernel_probe MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Renaming of the kprobe based file follows. Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau Change-Id: If9f500234bdb1a97752ffeff8c8549500a5f841a --- include/lttng/event-rule/event-rule.h | 2 +- include/lttng/event-rule/kprobe-internal.h | 12 +- include/lttng/event-rule/kprobe.h | 26 ++--- src/bin/lttng-sessiond/trace-kernel.c | 7 +- src/bin/lttng/commands/add_trigger.c | 12 +- src/bin/lttng/commands/list_triggers.c | 12 +- src/common/event-rule/event-rule.c | 8 +- src/common/event-rule/kprobe.c | 110 +++++++++--------- .../tools/notification/notification.c | 6 +- tests/unit/test_event_rule.c | 20 ++-- 10 files changed, 108 insertions(+), 107 deletions(-) diff --git a/include/lttng/event-rule/event-rule.h b/include/lttng/event-rule/event-rule.h index e097dd488..ea33153d6 100644 --- a/include/lttng/event-rule/event-rule.h +++ b/include/lttng/event-rule/event-rule.h @@ -18,7 +18,7 @@ enum lttng_event_rule_type { LTTNG_EVENT_RULE_TYPE_UNKNOWN = -1, LTTNG_EVENT_RULE_TYPE_TRACEPOINT = 0, LTTNG_EVENT_RULE_TYPE_SYSCALL = 1, - LTTNG_EVENT_RULE_TYPE_KPROBE = 2, + LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE = 2, LTTNG_EVENT_RULE_TYPE_KRETPROBE = 3, LTTNG_EVENT_RULE_TYPE_UPROBE = 4, }; diff --git a/include/lttng/event-rule/kprobe-internal.h b/include/lttng/event-rule/kprobe-internal.h index 7d2ecc8cc..3799af955 100644 --- a/include/lttng/event-rule/kprobe-internal.h +++ b/include/lttng/event-rule/kprobe-internal.h @@ -5,21 +5,21 @@ * */ -#ifndef LTTNG_EVENT_RULE_KPROBE_INTERNAL_H -#define LTTNG_EVENT_RULE_KPROBE_INTERNAL_H +#ifndef LTTNG_EVENT_RULE_KERNEL_PROBE_INTERNAL_H +#define LTTNG_EVENT_RULE_KERNEL_PROBE_INTERNAL_H #include #include #include #include -struct lttng_event_rule_kprobe { +struct lttng_event_rule_kernel_probe { struct lttng_event_rule parent; char *name; struct lttng_kernel_probe_location *location; }; -struct lttng_event_rule_kprobe_comm { +struct lttng_event_rule_kernel_probe_comm { /* Includes terminator `\0`. */ uint32_t name_len; uint32_t location_len; @@ -32,8 +32,8 @@ struct lttng_event_rule_kprobe_comm { } LTTNG_PACKED; LTTNG_HIDDEN -ssize_t lttng_event_rule_kprobe_create_from_payload( +ssize_t lttng_event_rule_kernel_probe_create_from_payload( struct lttng_payload_view *payload, struct lttng_event_rule **rule); -#endif /* LTTNG_EVENT_RULE_KPROBE_INTERNAL_H */ +#endif /* LTTNG_EVENT_RULE_KERNEL_PROBE_INTERNAL_H */ diff --git a/include/lttng/event-rule/kprobe.h b/include/lttng/event-rule/kprobe.h index e3d7563a4..2ac173d27 100644 --- a/include/lttng/event-rule/kprobe.h +++ b/include/lttng/event-rule/kprobe.h @@ -5,8 +5,8 @@ * */ -#ifndef LTTNG_EVENT_RULE_KPROBE_H -#define LTTNG_EVENT_RULE_KPROBE_H +#ifndef LTTNG_EVENT_RULE_KERNEL_PROBE_H +#define LTTNG_EVENT_RULE_KERNEL_PROBE_H #include @@ -17,27 +17,27 @@ extern "C" { struct lttng_kernel_probe_location; /* - * Create a newly allocated kprobe event rule. + * Create a newly allocated kernel probe event rule. * * Returns a new event rule on success, NULL on failure. The returned event rule * must be destroyed using lttng_event_rule_destroy(). */ -extern struct lttng_event_rule *lttng_event_rule_kprobe_create(void); +extern struct lttng_event_rule *lttng_event_rule_kernel_probe_create(void); /* - * Set the kernel probe location of a kprobe event rule. + * Set the kernel probe location of a kernel probe event rule. * * The location is copied internally. * * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_location( +extern enum lttng_event_rule_status lttng_event_rule_kernel_probe_set_location( struct lttng_event_rule *rule, const struct lttng_kernel_probe_location *location); /* - * Get the kernel probe location of a kprobe event rule. + * Get the kernel probe location of a kernel probe event rule. * * The caller does not assume the ownership of the returned location. * The location shall only be used for the duration of the event @@ -48,23 +48,23 @@ extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_location( * passed, or LTTNG_EVENT_RULE_STATUS_UNSET if a location was not set prior to * this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kprobe_get_location( +extern enum lttng_event_rule_status lttng_event_rule_kernel_probe_get_location( const struct lttng_event_rule *rule, const struct lttng_kernel_probe_location **location); /* - * Set the name of a kprobe event rule. + * Set the name of a kernel probe event rule. * * The name is copied internally. * * Returns LTTNG_EVENT_RULE_STATUS_OK on success, LTTNG_EVENT_RULE_STATUS_INVALID * if invalid parameters are passed. */ -extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_name( +extern enum lttng_event_rule_status lttng_event_rule_kernel_probe_set_name( struct lttng_event_rule *rule, const char *name); /* - * Get the name of a kprobe event rule. + * Get the name of a kernel probe event rule. * * The caller does not assume the ownership of the returned name. * The name shall only only be used for the duration of the event @@ -74,11 +74,11 @@ extern enum lttng_event_rule_status lttng_event_rule_kprobe_set_name( * success, LTTNG_EVENT_RULE_STATUS_INVALID if an invalid parameter is passed, * or LTTNG_EVENT_RULE_STATUS_UNSET if a name was not set prior to this call. */ -extern enum lttng_event_rule_status lttng_event_rule_kprobe_get_name( +extern enum lttng_event_rule_status lttng_event_rule_kernel_probe_get_name( const struct lttng_event_rule *rule, const char **name); #ifdef __cplusplus } #endif -#endif /* LTTNG_EVENT_RULE_KPROBE_H */ +#endif /* LTTNG_EVENT_RULE_KERNEL_PROBE_H */ diff --git a/src/bin/lttng-sessiond/trace-kernel.c b/src/bin/lttng-sessiond/trace-kernel.c index 2623b2971..a9e8e03c3 100644 --- a/src/bin/lttng-sessiond/trace-kernel.c +++ b/src/bin/lttng-sessiond/trace-kernel.c @@ -550,7 +550,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( int strncpy_ret; switch (lttng_event_rule_get_type(rule)) { - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: { uint64_t address = 0, offset = 0; const char *symbol_name = NULL; @@ -558,7 +558,7 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( enum lttng_kernel_probe_location_status k_status; enum lttng_event_rule_status status; - status = lttng_event_rule_kprobe_get_location(rule, &location); + status = lttng_event_rule_kernel_probe_get_location(rule, &location); if (status != LTTNG_EVENT_RULE_STATUS_OK) { ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL; goto error; @@ -600,7 +600,8 @@ enum lttng_error_code trace_kernel_init_event_notifier_from_event_rule( } kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0'; - status = lttng_event_rule_kprobe_get_name(rule, &name); + + status = lttng_event_rule_kernel_probe_get_name(rule, &name); assert(status == LTTNG_EVENT_RULE_STATUS_OK); ret_code = LTTNG_OK; break; diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index feba92f6f..9ae8263c6 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -634,7 +634,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) break; case OPT_PROBE: if (!assign_event_rule_type(&event_rule_type, - LTTNG_EVENT_RULE_TYPE_KPROBE)) { + LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE)) { goto error; } @@ -817,7 +817,7 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) /* Validate event rule type against domain. */ switch (event_rule_type) { - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: case LTTNG_EVENT_RULE_TYPE_KRETPROBE: case LTTNG_EVENT_RULE_TYPE_UPROBE: case LTTNG_EVENT_RULE_TYPE_SYSCALL: @@ -955,12 +955,12 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) break; } - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: { int ret; enum lttng_event_rule_status event_rule_status; - res.er = lttng_event_rule_kprobe_create(); + res.er = lttng_event_rule_kernel_probe_create(); if (!res.er) { ERR("Failed to create kprobe event rule."); goto error; @@ -972,14 +972,14 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv) goto error; } - event_rule_status = lttng_event_rule_kprobe_set_name(res.er, tracepoint_name); + event_rule_status = lttng_event_rule_kernel_probe_set_name(res.er, tracepoint_name); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to set kprobe event rule's name to '%s'.", tracepoint_name); goto error; } assert(kernel_probe_location); - event_rule_status = lttng_event_rule_kprobe_set_location(res.er, kernel_probe_location); + event_rule_status = lttng_event_rule_kernel_probe_set_location(res.er, kernel_probe_location); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to set kprobe event rule's location."); goto error; diff --git a/src/bin/lttng/commands/list_triggers.c b/src/bin/lttng/commands/list_triggers.c index 05090381e..f634b8e38 100644 --- a/src/bin/lttng/commands/list_triggers.c +++ b/src/bin/lttng/commands/list_triggers.c @@ -160,21 +160,21 @@ end: } static -void print_event_rule_kprobe(const struct lttng_event_rule *event_rule) +void print_event_rule_kernel_probe(const struct lttng_event_rule *event_rule) { enum lttng_event_rule_status event_rule_status; const char *name; const struct lttng_kernel_probe_location *location; - assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KPROBE); + assert(lttng_event_rule_get_type(event_rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE); - event_rule_status = lttng_event_rule_kprobe_get_name(event_rule, &name); + event_rule_status = lttng_event_rule_kernel_probe_get_name(event_rule, &name); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to get kprobe event rule's name."); goto end; } - event_rule_status = lttng_event_rule_kprobe_get_location( + event_rule_status = lttng_event_rule_kernel_probe_get_location( event_rule, &location); if (event_rule_status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to get kprobe event rule's location."); @@ -280,8 +280,8 @@ void print_event_rule(const struct lttng_event_rule *event_rule) case LTTNG_EVENT_RULE_TYPE_TRACEPOINT: print_event_rule_tracepoint(event_rule); break; - case LTTNG_EVENT_RULE_TYPE_KPROBE: - print_event_rule_kprobe(event_rule); + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: + print_event_rule_kernel_probe(event_rule); break; case LTTNG_EVENT_RULE_TYPE_UPROBE: print_event_rule_uprobe(event_rule); diff --git a/src/common/event-rule/event-rule.c b/src/common/event-rule/event-rule.c index 3a5be731b..c6ccc8577 100644 --- a/src/common/event-rule/event-rule.c +++ b/src/common/event-rule/event-rule.c @@ -41,7 +41,7 @@ enum lttng_domain_type lttng_event_rule_get_domain_type( break; } case LTTNG_EVENT_RULE_TYPE_SYSCALL: - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: case LTTNG_EVENT_RULE_TYPE_KRETPROBE: case LTTNG_EVENT_RULE_TYPE_UPROBE: domain_type = LTTNG_DOMAIN_KERNEL; @@ -172,8 +172,8 @@ ssize_t lttng_event_rule_create_from_payload( create_from_payload = lttng_event_rule_tracepoint_create_from_payload; break; - case LTTNG_EVENT_RULE_TYPE_KPROBE: - create_from_payload = lttng_event_rule_kprobe_create_from_payload; + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: + create_from_payload = lttng_event_rule_kernel_probe_create_from_payload; break; case LTTNG_EVENT_RULE_TYPE_KRETPROBE: /* TODO */ @@ -315,7 +315,7 @@ const char *lttng_event_rule_type_str(enum lttng_event_rule_type type) return "tracepoint"; case LTTNG_EVENT_RULE_TYPE_SYSCALL: return "syscall"; - case LTTNG_EVENT_RULE_TYPE_KPROBE: + case LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE: return "probe"; case LTTNG_EVENT_RULE_TYPE_KRETPROBE: return "function"; diff --git a/src/common/event-rule/kprobe.c b/src/common/event-rule/kprobe.c index 12e6010ac..37592962b 100644 --- a/src/common/event-rule/kprobe.c +++ b/src/common/event-rule/kprobe.c @@ -23,34 +23,34 @@ #include #define IS_KPROBE_EVENT_RULE(rule) \ - (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_KPROBE) + (lttng_event_rule_get_type(rule) == LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE) #if (LTTNG_SYMBOL_NAME_LEN == 256) #define LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "255" #endif -static void lttng_event_rule_kprobe_destroy(struct lttng_event_rule *rule) +static void lttng_event_rule_kernel_probe_destroy(struct lttng_event_rule *rule) { - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); lttng_kernel_probe_location_destroy(kprobe->location); free(kprobe->name); free(kprobe); } -static bool lttng_event_rule_kprobe_validate( +static bool lttng_event_rule_kernel_probe_validate( const struct lttng_event_rule *rule) { bool valid = false; - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; if (!rule) { goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); /* Required field. */ if (!kprobe->name) { @@ -69,15 +69,15 @@ end: return valid; } -static int lttng_event_rule_kprobe_serialize( +static int lttng_event_rule_kernel_probe_serialize( const struct lttng_event_rule *rule, struct lttng_payload *payload) { int ret; size_t name_len, header_offset, size_before_location; - struct lttng_event_rule_kprobe *kprobe; - struct lttng_event_rule_kprobe_comm kprobe_comm; - struct lttng_event_rule_kprobe_comm *header; + struct lttng_event_rule_kernel_probe *kprobe; + struct lttng_event_rule_kernel_probe_comm kprobe_comm; + struct lttng_event_rule_kernel_probe_comm *header; if (!rule || !IS_KPROBE_EVENT_RULE(rule)) { ret = -1; @@ -87,7 +87,7 @@ static int lttng_event_rule_kprobe_serialize( header_offset = payload->buffer.size; DBG("Serializing kprobe event rule."); - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); name_len = strlen(kprobe->name) + 1; kprobe_comm.name_len = name_len; @@ -111,7 +111,7 @@ static int lttng_event_rule_kprobe_serialize( } /* Update the header regarding the probe size. */ - header = (struct lttng_event_rule_kprobe_comm*) ( + header = (struct lttng_event_rule_kernel_probe_comm*) ( (char *) payload->buffer.data + header_offset); header->location_len = payload->buffer.size - size_before_location; @@ -121,14 +121,14 @@ end: return ret; } -static bool lttng_event_rule_kprobe_is_equal(const struct lttng_event_rule *_a, +static bool lttng_event_rule_kernel_probe_is_equal(const struct lttng_event_rule *_a, const struct lttng_event_rule *_b) { bool is_equal = false; - struct lttng_event_rule_kprobe *a, *b; + struct lttng_event_rule_kernel_probe *a, *b; - a = container_of(_a, struct lttng_event_rule_kprobe, parent); - b = container_of(_b, struct lttng_event_rule_kprobe, parent); + a = container_of(_a, struct lttng_event_rule_kernel_probe, parent); + b = container_of(_b, struct lttng_event_rule_kernel_probe, parent); /* Quick checks */ if (!!a->name != !!b->name) { @@ -148,7 +148,7 @@ end: return is_equal; } -static enum lttng_error_code lttng_event_rule_kprobe_generate_filter_bytecode( +static enum lttng_error_code lttng_event_rule_kernel_probe_generate_filter_bytecode( struct lttng_event_rule *rule, const struct lttng_credentials *creds) { @@ -156,7 +156,7 @@ static enum lttng_error_code lttng_event_rule_kprobe_generate_filter_bytecode( return LTTNG_OK; } -static const char *lttng_event_rule_kprobe_get_filter( +static const char *lttng_event_rule_kernel_probe_get_filter( const struct lttng_event_rule *rule) { /* Not supported. */ @@ -164,14 +164,14 @@ static const char *lttng_event_rule_kprobe_get_filter( } static const struct lttng_bytecode * -lttng_event_rule_kprobe_get_filter_bytecode(const struct lttng_event_rule *rule) +lttng_event_rule_kernel_probe_get_filter_bytecode(const struct lttng_event_rule *rule) { /* Not supported. */ return NULL; } static enum lttng_event_rule_generate_exclusions_status -lttng_event_rule_kprobe_generate_exclusions(const struct lttng_event_rule *rule, +lttng_event_rule_kernel_probe_generate_exclusions(const struct lttng_event_rule *rule, struct lttng_event_exclusion **exclusions) { /* Not supported. */ @@ -180,14 +180,14 @@ lttng_event_rule_kprobe_generate_exclusions(const struct lttng_event_rule *rule, } static unsigned long -lttng_event_rule_kprobe_hash( +lttng_event_rule_kernel_probe_hash( const struct lttng_event_rule *rule) { unsigned long hash; - struct lttng_event_rule_kprobe *krule = + struct lttng_event_rule_kernel_probe *krule = container_of(rule, typeof(*krule), parent); - hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KPROBE, + hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE, lttng_ht_seed); hash ^= hash_key_str(krule->name, lttng_ht_seed); hash ^= lttng_kernel_probe_location_hash(krule->location); @@ -195,46 +195,46 @@ lttng_event_rule_kprobe_hash( return hash; } -struct lttng_event_rule *lttng_event_rule_kprobe_create(void) +struct lttng_event_rule *lttng_event_rule_kernel_probe_create(void) { struct lttng_event_rule *rule = NULL; - struct lttng_event_rule_kprobe *krule; + struct lttng_event_rule_kernel_probe *krule; - krule = zmalloc(sizeof(struct lttng_event_rule_kprobe)); + krule = zmalloc(sizeof(struct lttng_event_rule_kernel_probe)); if (!krule) { goto end; } rule = &krule->parent; - lttng_event_rule_init(&krule->parent, LTTNG_EVENT_RULE_TYPE_KPROBE); - krule->parent.validate = lttng_event_rule_kprobe_validate; - krule->parent.serialize = lttng_event_rule_kprobe_serialize; - krule->parent.equal = lttng_event_rule_kprobe_is_equal; - krule->parent.destroy = lttng_event_rule_kprobe_destroy; + lttng_event_rule_init(&krule->parent, LTTNG_EVENT_RULE_TYPE_KERNEL_PROBE); + krule->parent.validate = lttng_event_rule_kernel_probe_validate; + krule->parent.serialize = lttng_event_rule_kernel_probe_serialize; + krule->parent.equal = lttng_event_rule_kernel_probe_is_equal; + krule->parent.destroy = lttng_event_rule_kernel_probe_destroy; krule->parent.generate_filter_bytecode = - lttng_event_rule_kprobe_generate_filter_bytecode; - krule->parent.get_filter = lttng_event_rule_kprobe_get_filter; + lttng_event_rule_kernel_probe_generate_filter_bytecode; + krule->parent.get_filter = lttng_event_rule_kernel_probe_get_filter; krule->parent.get_filter_bytecode = - lttng_event_rule_kprobe_get_filter_bytecode; + lttng_event_rule_kernel_probe_get_filter_bytecode; krule->parent.generate_exclusions = - lttng_event_rule_kprobe_generate_exclusions; - krule->parent.hash = lttng_event_rule_kprobe_hash; + lttng_event_rule_kernel_probe_generate_exclusions; + krule->parent.hash = lttng_event_rule_kernel_probe_hash; end: return rule; } LTTNG_HIDDEN -ssize_t lttng_event_rule_kprobe_create_from_payload( +ssize_t lttng_event_rule_kernel_probe_create_from_payload( struct lttng_payload_view *view, struct lttng_event_rule **_event_rule) { ssize_t ret, offset = 0; enum lttng_event_rule_status status; - const struct lttng_event_rule_kprobe_comm *kprobe_comm; + const struct lttng_event_rule_kernel_probe_comm *kprobe_comm; const char *name; struct lttng_buffer_view current_buffer_view; struct lttng_event_rule *rule = NULL; - struct lttng_event_rule_kprobe *kprobe = NULL; + struct lttng_event_rule_kernel_probe *kprobe = NULL; struct lttng_kernel_probe_location *location; if (!_event_rule) { @@ -252,14 +252,14 @@ ssize_t lttng_event_rule_kprobe_create_from_payload( kprobe_comm = (typeof(kprobe_comm)) current_buffer_view.data; - rule = lttng_event_rule_kprobe_create(); + rule = lttng_event_rule_kernel_probe_create(); if (!rule) { ERR("Failed to create event rule kprobe."); ret = -1; goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); /* Skip to payload */ offset += current_buffer_view.size; @@ -316,7 +316,7 @@ ssize_t lttng_event_rule_kprobe_create_from_payload( /* Skip after the location */ offset += kprobe_comm->location_len; - status = lttng_event_rule_kprobe_set_name(rule, name); + status = lttng_event_rule_kernel_probe_set_name(rule, name); if (status != LTTNG_EVENT_RULE_STATUS_OK) { ERR("Failed to set event rule kprobe name."); ret = -1; @@ -331,12 +331,12 @@ end: return ret; } -enum lttng_event_rule_status lttng_event_rule_kprobe_set_location( +enum lttng_event_rule_status lttng_event_rule_kernel_probe_set_location( struct lttng_event_rule *rule, const struct lttng_kernel_probe_location *location) { struct lttng_kernel_probe_location *location_copy = NULL; - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK; if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !location) { @@ -344,7 +344,7 @@ enum lttng_event_rule_status lttng_event_rule_kprobe_set_location( goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); location_copy = lttng_kernel_probe_location_copy(location); if (!location_copy) { status = LTTNG_EVENT_RULE_STATUS_ERROR; @@ -362,19 +362,19 @@ end: return status; } -enum lttng_event_rule_status lttng_event_rule_kprobe_get_location( +enum lttng_event_rule_status lttng_event_rule_kernel_probe_get_location( const struct lttng_event_rule *rule, const struct lttng_kernel_probe_location **location) { enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK; - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !location) { status = LTTNG_EVENT_RULE_STATUS_INVALID; goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); *location = kprobe->location; if (!*location) { @@ -386,11 +386,11 @@ end: return status; } -enum lttng_event_rule_status lttng_event_rule_kprobe_set_name( +enum lttng_event_rule_status lttng_event_rule_kernel_probe_set_name( struct lttng_event_rule *rule, const char *name) { char *name_copy = NULL; - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK; if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !name || @@ -399,7 +399,7 @@ enum lttng_event_rule_status lttng_event_rule_kprobe_set_name( goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); name_copy = strdup(name); if (!name_copy) { status = LTTNG_EVENT_RULE_STATUS_ERROR; @@ -414,10 +414,10 @@ end: return status; } -enum lttng_event_rule_status lttng_event_rule_kprobe_get_name( +enum lttng_event_rule_status lttng_event_rule_kernel_probe_get_name( const struct lttng_event_rule *rule, const char **name) { - struct lttng_event_rule_kprobe *kprobe; + struct lttng_event_rule_kernel_probe *kprobe; enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK; if (!rule || !IS_KPROBE_EVENT_RULE(rule) || !name) { @@ -425,7 +425,7 @@ enum lttng_event_rule_status lttng_event_rule_kprobe_get_name( goto end; } - kprobe = container_of(rule, struct lttng_event_rule_kprobe, parent); + kprobe = container_of(rule, struct lttng_event_rule_kernel_probe, parent); if (!kprobe->name) { status = LTTNG_EVENT_RULE_STATUS_UNSET; goto end; diff --git a/tests/regression/tools/notification/notification.c b/tests/regression/tools/notification/notification.c index f6cd908b9..4d238b02c 100644 --- a/tests/regression/tools/notification/notification.c +++ b/tests/regression/tools/notification/notification.c @@ -1864,15 +1864,15 @@ static void test_kprobe_event_rule_notification( lttng_session_daemon_notification_endpoint); ok(notification_channel, "Notification channel object creation"); - event_rule = lttng_event_rule_kprobe_create(); + event_rule = lttng_event_rule_kernel_probe_create(); ok(event_rule, "kprobe event rule object creation"); - event_rule_status = lttng_event_rule_kprobe_set_location( + event_rule_status = lttng_event_rule_kernel_probe_set_location( event_rule, location); ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule location: '%s'", symbol_name); - event_rule_status = lttng_event_rule_kprobe_set_name( + event_rule_status = lttng_event_rule_kernel_probe_set_name( event_rule, trigger_name); ok(event_rule_status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule name: '%s'", trigger_name); diff --git a/tests/unit/test_event_rule.c b/tests/unit/test_event_rule.c index 53f16dbbd..7ed1a8bbf 100644 --- a/tests/unit/test_event_rule.c +++ b/tests/unit/test_event_rule.c @@ -306,7 +306,7 @@ end: lttng_userspace_probe_location_lookup_method_destroy(lookup_method); } -static void test_event_rule_kprobe_by_location( +static void test_event_rule_kernel_probe_by_location( const struct lttng_kernel_probe_location *location) { struct lttng_event_rule *kprobe = NULL; @@ -323,21 +323,21 @@ static void test_event_rule_kprobe_by_location( lttng_payload_init(&payload); - kprobe = lttng_event_rule_kprobe_create(); + kprobe = lttng_event_rule_kernel_probe_create(); ok(kprobe, "kprobe event rule object creation."); - status = lttng_event_rule_kprobe_set_location(kprobe, location); + status = lttng_event_rule_kernel_probe_set_location(kprobe, location); ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule location."); - status = lttng_event_rule_kprobe_get_location(kprobe, &_location); + status = lttng_event_rule_kernel_probe_get_location(kprobe, &_location); ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting kprobe event rule location."); ok(lttng_kernel_probe_location_is_equal(location, _location), "Locations are equal."); - status = lttng_event_rule_kprobe_set_name(kprobe, probe_name); + status = lttng_event_rule_kernel_probe_set_name(kprobe, probe_name); ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Setting kprobe event rule name: %s.", probe_name); - status = lttng_event_rule_kprobe_get_name(kprobe, &tmp); + status = lttng_event_rule_kernel_probe_get_name(kprobe, &tmp); ok(status == LTTNG_EVENT_RULE_STATUS_OK, "Getting kprobe name."); ok(!strcmp(probe_name, tmp), "kprobe name are equal."); @@ -361,7 +361,7 @@ static void test_event_rule_kprobe_by_location( lttng_event_rule_destroy(kprobe_from_buffer); } -static void test_event_rule_kprobe(void) +static void test_event_rule_kernel_probe(void) { struct lttng_kernel_probe_location *address_location = NULL; struct lttng_kernel_probe_location *symbol_location = NULL; @@ -371,8 +371,8 @@ static void test_event_rule_kprobe(void) assert(address_location); assert(symbol_location); - test_event_rule_kprobe_by_location(address_location); - test_event_rule_kprobe_by_location(symbol_location); + test_event_rule_kernel_probe_by_location(address_location); + test_event_rule_kernel_probe_by_location(symbol_location); lttng_kernel_probe_location_destroy(address_location); lttng_kernel_probe_location_destroy(symbol_location); @@ -384,6 +384,6 @@ int main(int argc, const char *argv[]) test_event_rule_tracepoint(); test_event_rule_syscall(); test_event_rule_uprobe(); - test_event_rule_kprobe(); + test_event_rule_kernel_probe(); return exit_status(); } -- 2.34.1