Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: I9272253202cfd0d6b6fb165293a534a824fbe854
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
typedef void (*action_destroy_cb)(struct lttng_action *action);
typedef int (*action_serialize_cb)(struct lttng_action *action,
struct lttng_dynamic_buffer *buf);
typedef void (*action_destroy_cb)(struct lttng_action *action);
typedef int (*action_serialize_cb)(struct lttng_action *action,
struct lttng_dynamic_buffer *buf);
+typedef bool (*action_equal_cb)(const struct lttng_action *a,
+ const struct lttng_action *b);
typedef ssize_t (*action_create_from_buffer_cb)(
const struct lttng_buffer_view *view,
struct lttng_action **action);
typedef ssize_t (*action_create_from_buffer_cb)(
const struct lttng_buffer_view *view,
struct lttng_action **action);
enum lttng_action_type type;
action_validate_cb validate;
action_serialize_cb serialize;
enum lttng_action_type type;
action_validate_cb validate;
action_serialize_cb serialize;
action_destroy_cb destroy;
};
action_destroy_cb destroy;
};
enum lttng_action_type type,
action_validate_cb validate,
action_serialize_cb serialize,
enum lttng_action_type type,
action_validate_cb validate,
action_serialize_cb serialize,
action_destroy_cb destroy);
LTTNG_HIDDEN
action_destroy_cb destroy);
LTTNG_HIDDEN
enum lttng_action_type lttng_action_get_type_const(
const struct lttng_action *action);
enum lttng_action_type lttng_action_get_type_const(
const struct lttng_action *action);
+LTTNG_HIDDEN
+bool lttng_action_is_equal(const struct lttng_action *a,
+ const struct lttng_action *b);
+
#endif /* LTTNG_ACTION_INTERNAL_H */
#endif /* LTTNG_ACTION_INTERNAL_H */
enum lttng_action_type type,
action_validate_cb validate,
action_serialize_cb serialize,
enum lttng_action_type type,
action_validate_cb validate,
action_serialize_cb serialize,
action_destroy_cb destroy)
{
action->type = type;
action->validate = validate;
action->serialize = serialize;
action_destroy_cb destroy)
{
action->type = type;
action->validate = validate;
action->serialize = serialize;
action->destroy = destroy;
}
action->destroy = destroy;
}
end:
return consumed_len;
}
end:
return consumed_len;
}
+
+LTTNG_HIDDEN
+bool lttng_action_is_equal(const struct lttng_action *a,
+ const struct lttng_action *b)
+{
+ bool is_equal = false;
+
+ if (!a || !b) {
+ goto end;
+ }
+
+ if (a->type != b->type) {
+ goto end;
+ }
+
+ if (a == b) {
+ is_equal = true;
+ goto end;
+ }
+
+ assert(a->equal);
+ is_equal = a->equal(a, b);
+end:
+ return is_equal;
+}
+static
+bool lttng_action_notify_is_equal(const struct lttng_action *a,
+ const struct lttng_action *b)
+{
+ /* There is no discriminant between notify actions. */
+ return true;
+}
+
struct lttng_action *lttng_action_notify_create(void)
{
struct lttng_action_notify *notify;
struct lttng_action *lttng_action_notify_create(void)
{
struct lttng_action_notify *notify;
lttng_action_init(¬ify->parent, LTTNG_ACTION_TYPE_NOTIFY, NULL,
lttng_action_notify_serialize,
lttng_action_init(¬ify->parent, LTTNG_ACTION_TYPE_NOTIFY, NULL,
lttng_action_notify_serialize,
+ lttng_action_notify_is_equal,
lttng_action_notify_destroy);
end:
return ¬ify->parent;
lttng_action_notify_destroy);
end:
return ¬ify->parent;