-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_userspace_probe *uprobe;
- enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
-
- if (!rule || !IS_UPROBE_EVENT_RULE(rule) || !location) {
- status = LTTNG_EVENT_RULE_STATUS_INVALID;
- goto end;
- }
-
- 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;
- goto end;
- }
-
- if (uprobe->location) {
- lttng_userspace_probe_location_destroy(uprobe->location);
- }
-
- uprobe->location = location_copy;
- location_copy = NULL;
-end:
- lttng_userspace_probe_location_destroy(location_copy);
- return status;
-}