From 2c2de71ef6dae09fa1a61f02051b68f60b0a1750 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 30 Aug 2018 14:51:52 -0400 Subject: [PATCH] Remove unused session current_archive_location accessor MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This function was replaced by lttng_rotation_handle_get_archive_location() which requires an lttng_rotation_handle to be used, making its use less error-prone. Signed-off-by: Jérémie Galarneau --- include/lttng/rotate-internal.h | 5 --- include/lttng/session.h | 17 -------- src/bin/lttng-sessiond/cmd.c | 52 ------------------------ src/bin/lttng-sessiond/cmd.h | 2 - src/bin/lttng-sessiond/main.c | 23 ----------- src/common/sessiond-comm/sessiond-comm.h | 3 +- src/lib/lttng-ctl/lttng-ctl.c | 44 -------------------- 7 files changed, 1 insertion(+), 145 deletions(-) diff --git a/include/lttng/rotate-internal.h b/include/lttng/rotate-internal.h index 966f9f969..c44178079 100644 --- a/include/lttng/rotate-internal.h +++ b/include/lttng/rotate-internal.h @@ -111,11 +111,6 @@ struct lttng_rotation_get_info_return { } location; } LTTNG_PACKED; -/* For the LTTNG_SESSION_GET_CURRENT_OUTPUT command. */ -struct lttng_session_get_current_output_return { - char path[LTTNG_PATH_MAX]; -} LTTNG_PACKED; - /* For the LTTNG_SESSION_LIST_SCHEDULES command. */ struct lttng_session_list_schedules_return { struct { diff --git a/include/lttng/session.h b/include/lttng/session.h index 7211eeec1..599892d13 100644 --- a/include/lttng/session.h +++ b/include/lttng/session.h @@ -162,23 +162,6 @@ extern int lttng_untrack_pid(struct lttng_handle *handle, int pid); extern int lttng_list_tracker_pids(struct lttng_handle *handle, int *enabled, int32_t **pids, size_t *nr_pids); -/* - * Ask the session daemon where the data for this session is currently being - * written to. If rotations occured during a session, this call is useful to - * know the location of the last chunk. - * - * Return 0 and allocate chunk_path if rotations occured for this session, the - * caller needs to free chunk_path. - * Return 1 if no rotation occured during the session, chunk_path is left - * unallocated. - * - * Return a negative LTTng error code on error (readable with lttng_strerror). - * - * FIXME: Return an lttng_location object rather than a path. - */ -extern int lttng_session_get_current_archive_location(const char *session_name, - char **chunk_path); - #ifdef __cplusplus } #endif diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 53a72d9b8..e88ad0d0d 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -5047,58 +5047,6 @@ end: return ret; } -/* - * Command ROTATE_GET_CURRENT_PATH from the lttng-ctl library. - * - * Configure the automatic rotation parameters. - * Set to -1ULL to disable them. - * - * Return LTTNG_OK on success or else a LTTNG_ERR code. - */ -int cmd_session_get_current_output(struct ltt_session *session, - struct lttng_session_get_current_output_return *output_return) -{ - int ret; - const char *path; - - if (!session->snapshot_mode) { - if (session->current_archive_id == 0) { - if (session->kernel_session) { - path = session_get_base_path(session); - } else if (session->ust_session) { - path = session_get_base_path(session); - } else { - abort(); - } - assert(path); - } else { - path = session->rotation_chunk.active_tracing_path; - } - } else { - /* - * A snapshot session does not have a "current" trace archive - * location. - */ - path = ""; - } - - DBG("Cmd get current output for session %s, returning %s", - session->name, path); - - ret = lttng_strncpy(output_return->path, - path, - sizeof(output_return->path)); - if (ret) { - ERR("Failed to copy trace output path to session get current output command reply"); - ret = -LTTNG_ERR_UNK; - goto end; - } - - ret = LTTNG_OK; -end: - return ret; -} - /* Wait for a given path to be removed before continuing. */ static enum lttng_error_code wait_on_path(void *path_data) { diff --git a/src/bin/lttng-sessiond/cmd.h b/src/bin/lttng-sessiond/cmd.h index 16c07f78e..c0fbee8f0 100644 --- a/src/bin/lttng-sessiond/cmd.h +++ b/src/bin/lttng-sessiond/cmd.h @@ -138,8 +138,6 @@ int cmd_rotate_session(struct ltt_session *session, int cmd_rotate_get_info(struct ltt_session *session, struct lttng_rotation_get_info_return *info_return, uint64_t rotate_id); -int cmd_session_get_current_output(struct ltt_session *session, - struct lttng_session_get_current_output_return *output_return); int cmd_rotation_set_schedule(struct ltt_session *session, bool activate, enum lttng_rotation_schedule_type schedule_type, uint64_t value, diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c index 2c571c4a8..947c35db7 100644 --- a/src/bin/lttng-sessiond/main.c +++ b/src/bin/lttng-sessiond/main.c @@ -3102,7 +3102,6 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock, case LTTNG_UNREGISTER_TRIGGER: case LTTNG_ROTATE_SESSION: case LTTNG_ROTATION_GET_INFO: - case LTTNG_SESSION_GET_CURRENT_OUTPUT: case LTTNG_ROTATION_SET_SCHEDULE: case LTTNG_SESSION_LIST_ROTATION_SCHEDULES: need_domain = 0; @@ -4324,28 +4323,6 @@ error_add_context: ret = LTTNG_OK; break; } - case LTTNG_SESSION_GET_CURRENT_OUTPUT: - { - struct lttng_session_get_current_output_return output_return; - - memset(&output_return, 0, sizeof(output_return)); - ret = cmd_session_get_current_output(cmd_ctx->session, - &output_return); - if (ret < 0) { - ret = -ret; - goto error; - } - - ret = setup_lttng_msg_no_cmd_header(cmd_ctx, &output_return, - sizeof(output_return)); - if (ret < 0) { - ret = -ret; - goto error; - } - - ret = LTTNG_OK; - break; - } case LTTNG_ROTATION_SET_SCHEDULE: { bool set_schedule; diff --git a/src/common/sessiond-comm/sessiond-comm.h b/src/common/sessiond-comm/sessiond-comm.h index 56c925973..3a2dd4946 100644 --- a/src/common/sessiond-comm/sessiond-comm.h +++ b/src/common/sessiond-comm/sessiond-comm.h @@ -104,8 +104,7 @@ enum lttcomm_sessiond_command { LTTNG_ROTATE_SESSION = 45, LTTNG_ROTATION_GET_INFO = 46, LTTNG_ROTATION_SET_SCHEDULE = 47, - LTTNG_SESSION_GET_CURRENT_OUTPUT = 48, - LTTNG_SESSION_LIST_ROTATION_SCHEDULES = 49, + LTTNG_SESSION_LIST_ROTATION_SCHEDULES = 48, }; enum lttcomm_relayd_command { diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index d8e2f1428..b57be223a 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -2893,50 +2893,6 @@ end: return ret; } -int lttng_session_get_current_archive_location(const char *session_name, - char **chunk_path) -{ - struct lttcomm_session_msg lsm; - struct lttng_session_get_current_output_return *output_return = NULL; - int ret; - size_t path_len; - - memset(&lsm, 0, sizeof(lsm)); - lsm.cmd_type = LTTNG_SESSION_GET_CURRENT_OUTPUT; - ret = lttng_strncpy(lsm.session.name, session_name, - sizeof(lsm.session.name)); - if (ret) { - ret = -LTTNG_ERR_INVALID; - goto end; - } - - ret = lttng_ctl_ask_sessiond(&lsm, (void **) &output_return); - if (ret < 0) { - ret = -1; - goto end; - } - - path_len = lttng_strnlen(output_return->path, - sizeof(output_return->path)); - if (path_len == 0 || path_len == sizeof(output_return->path)) { - ret = -LTTNG_ERR_NO_SESSION_OUTPUT; - goto end; - } - - *chunk_path = zmalloc(path_len + 1); - if (!*chunk_path) { - ret = -1; - goto end; - } - memcpy(*chunk_path, output_return->path, path_len); - - ret = 0; - -end: - free(output_return); - return ret; -} - /* * lib constructor. */ -- 2.34.1