+ int ret;
+ struct lttng_action_notify *notify_action;
+
+ if (!action || !IS_NOTIFY_ACTION(action) || !payload) {
+ ret = -1;
+ goto end;
+ }
+
+ DBG("Serializing notify action");
+
+ notify_action = action_notify_from_action(action);
+ DBG("Serializing notify action rate policy");
+ ret = lttng_rate_policy_serialize(notify_action->policy, payload);
+
+end:
+ return ret;
+}
+
+static
+bool lttng_action_notify_is_equal(const struct lttng_action *a,
+ const struct lttng_action *b)
+{
+ const struct lttng_action_notify *_a, *_b;
+
+ _a = action_notify_from_action_const(a);
+ _b = action_notify_from_action_const(b);
+ return lttng_rate_policy_is_equal(_a->policy, _b->policy);
+}
+
+static const struct lttng_rate_policy *
+lttng_action_notify_internal_get_rate_policy(const struct lttng_action *action)
+{
+ const struct lttng_action_notify *_action;
+ _action = action_notify_from_action_const(action);
+
+ return _action->policy;
+}
+
+static enum lttng_error_code lttng_action_notify_mi_serialize(
+ const struct lttng_action *action, struct mi_writer *writer)
+{
+ int ret;
+ enum lttng_action_status status;
+ enum lttng_error_code ret_code;
+ const struct lttng_rate_policy *policy = NULL;
+
+ assert(action);
+ assert(IS_NOTIFY_ACTION(action));
+ assert(writer);
+
+ status = lttng_action_notify_get_rate_policy(action, &policy);
+ assert(status == LTTNG_ACTION_STATUS_OK);
+ assert(policy != NULL);
+
+ /* Open action notify. */
+ ret = mi_lttng_writer_open_element(
+ writer, mi_lttng_element_action_notify);
+ if (ret) {
+ goto mi_error;
+ }
+
+ ret_code = lttng_rate_policy_mi_serialize(policy, writer);
+ if (ret_code != LTTNG_OK) {
+ goto end;
+ }
+
+ /* Close action notify element. */
+ ret = mi_lttng_writer_close_element(writer);
+ if (ret) {
+ goto mi_error;
+ }
+
+ ret_code = LTTNG_OK;
+ goto end;
+
+mi_error:
+ ret_code = LTTNG_ERR_MI_IO_FAIL;
+end:
+ return ret_code;