+
+enum lttng_action_status lttng_action_notify_set_rate_policy(
+ struct lttng_action *action,
+ const struct lttng_rate_policy *policy)
+{
+ enum lttng_action_status status;
+ struct lttng_action_notify *notify_action;
+ struct lttng_rate_policy *copy = NULL;
+
+ if (!action || !policy || !IS_NOTIFY_ACTION(action)) {
+ status = LTTNG_ACTION_STATUS_INVALID;
+ goto end;
+ }
+
+ copy = lttng_rate_policy_copy(policy);
+ if (!copy) {
+ status = LTTNG_ACTION_STATUS_ERROR;
+ goto end;
+ }
+
+ notify_action = action_notify_from_action(action);
+
+ /* Free the previous rate policy .*/
+ lttng_rate_policy_destroy(notify_action->policy);
+
+ /* Assign the policy. */
+ notify_action->policy = copy;
+ status = LTTNG_ACTION_STATUS_OK;
+ copy = NULL;
+
+end:
+ lttng_rate_policy_destroy(copy);
+ return status;
+}
+
+enum lttng_action_status lttng_action_notify_get_rate_policy(
+ const struct lttng_action *action,
+ const struct lttng_rate_policy **policy)
+{
+ enum lttng_action_status status;
+ const struct lttng_action_notify *notify_action;
+
+ if (!action || !policy || !IS_NOTIFY_ACTION(action)) {
+ status = LTTNG_ACTION_STATUS_INVALID;
+ goto end;
+ }
+
+ notify_action = action_notify_from_action_const(action);
+
+ *policy = notify_action->policy;
+ status = LTTNG_ACTION_STATUS_OK;
+end:
+ return status;
+}