X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Frotate.cpp;h=240b8c9ad3ffc5769e12382812c90dd9e8f3cf81;hb=37a5ef391d8d282fb8c8978e4761413b69d56072;hp=6a003a18ec101f1b0a3aa13eaaf5027c8df2c987;hpb=4bd69c5f1161cd065f487da0f4c1aa03a73c47e4;p=lttng-tools.git diff --git a/src/lib/lttng-ctl/rotate.cpp b/src/lib/lttng-ctl/rotate.cpp index 6a003a18e..240b8c9ad 100644 --- a/src/lib/lttng-ctl/rotate.cpp +++ b/src/lib/lttng-ctl/rotate.cpp @@ -10,12 +10,12 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include -#include "lttng-ctl-helper.h" +#include "lttng-ctl-helper.hpp" static enum lttng_rotation_status ask_rotation_info( @@ -33,7 +33,7 @@ enum lttng_rotation_status ask_rotation_info( } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATION_GET_INFO; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATION_GET_INFO; lsm.u.get_rotation_info.rotation_id = rotation_handle->rotation_id; ret = lttng_strncpy(lsm.session.name, rotation_handle->session_name, @@ -196,7 +196,7 @@ end: * Return 0 on success else a negative LTTng error code. */ int lttng_rotate_session(const char *session_name, - struct lttng_rotation_immediate_descriptor *descriptor, + struct lttng_rotation_immediate_descriptor *descriptor __attribute__((unused)), struct lttng_rotation_handle **rotation_handle) { struct lttcomm_session_msg lsm; @@ -217,7 +217,7 @@ int lttng_rotate_session(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATE_SESSION; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATE_SESSION; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); @@ -230,7 +230,7 @@ int lttng_rotate_session(const char *session_name, goto end; } - *rotation_handle = (lttng_rotation_handle *) zmalloc(sizeof(struct lttng_rotation_handle)); + *rotation_handle = zmalloc(); if (!*rotation_handle) { ret = -LTTNG_ERR_NOMEM; goto end; @@ -283,7 +283,7 @@ enum lttng_rotation_status lttng_rotation_update_schedule( } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_ROTATION_SET_SCHEDULE; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_ROTATION_SET_SCHEDULE; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); /* Source length already validated. */ @@ -350,7 +350,7 @@ end: static struct lttng_rotation_schedules *lttng_rotation_schedules_create(void) { - return (lttng_rotation_schedules *) zmalloc(sizeof(struct lttng_rotation_schedules)); + return zmalloc(); } static @@ -376,7 +376,7 @@ int get_schedules(const char *session_name, } memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SESSION_LIST_ROTATION_SCHEDULES; + lsm.cmd_type = LTTCOMM_SESSIOND_COMMAND_SESSION_LIST_ROTATION_SCHEDULES; ret = lttng_strncpy(lsm.session.name, session_name, sizeof(lsm.session.name)); if (ret) { @@ -463,7 +463,7 @@ lttng_rotation_schedule_size_threshold_create(void) { struct lttng_rotation_schedule_size_threshold *schedule; - schedule = (lttng_rotation_schedule_size_threshold *) zmalloc(sizeof(*schedule)); + schedule = zmalloc(); if (!schedule) { goto end; } @@ -487,9 +487,8 @@ lttng_rotation_schedule_size_threshold_get_threshold( goto end; } - size_schedule = container_of(schedule, - struct lttng_rotation_schedule_size_threshold, - parent); + size_schedule = lttng::utils::container_of(schedule, + <tng_rotation_schedule_size_threshold::parent); if (size_schedule->size.set) { *size_threshold_bytes = size_schedule->size.bytes; } else { @@ -515,9 +514,8 @@ lttng_rotation_schedule_size_threshold_set_threshold( goto end; } - size_schedule = container_of(schedule, - struct lttng_rotation_schedule_size_threshold, - parent); + size_schedule = lttng::utils::container_of(schedule, + <tng_rotation_schedule_size_threshold::parent); size_schedule->size.bytes = size_threshold_bytes; size_schedule->size.set = true; end: @@ -529,7 +527,7 @@ lttng_rotation_schedule_periodic_create(void) { struct lttng_rotation_schedule_periodic *schedule; - schedule = (lttng_rotation_schedule_periodic *) zmalloc(sizeof(*schedule)); + schedule = zmalloc(); if (!schedule) { goto end; } @@ -553,9 +551,8 @@ lttng_rotation_schedule_periodic_get_period( goto end; } - periodic_schedule = container_of(schedule, - struct lttng_rotation_schedule_periodic, - parent); + periodic_schedule = lttng::utils::container_of(schedule, + <tng_rotation_schedule_periodic::parent); if (periodic_schedule->period.set) { *period_us = periodic_schedule->period.us; } else { @@ -580,9 +577,8 @@ lttng_rotation_schedule_periodic_set_period( goto end; } - periodic_schedule = container_of(schedule, - struct lttng_rotation_schedule_periodic, - parent); + periodic_schedule = lttng::utils::container_of(schedule, + <tng_rotation_schedule_periodic::parent); periodic_schedule->period.us = period_us; periodic_schedule->period.set = true; end: