This function is to be used to initialize the common portion of all
action structures. I have updated the sole currently existing action
(notify), but the function will also be used in subsequent patches.
Change-Id: I4e42554c42a4e6a5ef2da292a6dfeb708d72a602
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
int8_t action_type;
} LTTNG_PACKED;
int8_t action_type;
} LTTNG_PACKED;
+LTTNG_HIDDEN
+void lttng_action_init(struct lttng_action *action,
+ enum lttng_action_type type,
+ action_validate_cb validate,
+ action_serialize_cb serialize,
+ action_destroy_cb destroy);
+
LTTNG_HIDDEN
bool lttng_action_validate(struct lttng_action *action);
LTTNG_HIDDEN
bool lttng_action_validate(struct lttng_action *action);
+LTTNG_HIDDEN
+void lttng_action_init(
+ struct lttng_action *action,
+ 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 = destroy;
+}
+
void lttng_action_destroy(struct lttng_action *action)
{
if (!action) {
void lttng_action_destroy(struct lttng_action *action)
{
if (!action) {
- notify->parent.type = LTTNG_ACTION_TYPE_NOTIFY;
- notify->parent.serialize = lttng_action_notify_serialize;
- notify->parent.destroy = lttng_action_notify_destroy;
+ lttng_action_init(¬ify->parent, LTTNG_ACTION_TYPE_NOTIFY, NULL,
+ lttng_action_notify_serialize,
+ lttng_action_notify_destroy);
end:
return ¬ify->parent;
}
end:
return ¬ify->parent;
}