From: David Goulet Date: Thu, 4 Aug 2011 01:03:27 +0000 (-0400) Subject: Remove path and session from session message X-Git-Tag: v2.0-pre7~10 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=42abccdb24a0b2a132c42e85e1343a007c0c9059;p=lttng-tools.git Remove path and session from session message Replace the two by a lttng_session structure. Signed-off-by: David Goulet --- diff --git a/liblttngctl/liblttngctl.c b/liblttngctl/liblttngctl.c index f57201ab1..fd5a552cf 100644 --- a/liblttngctl/liblttngctl.c +++ b/liblttngctl/liblttngctl.c @@ -317,7 +317,7 @@ static void copy_string(char *dst, const char *src, size_t len) */ int lttng_start_tracing(const char *session_name) { - copy_string(lsm.session_name, session_name, NAME_MAX); + copy_string(lsm.session.name, session_name, NAME_MAX); return ask_sessiond(LTTNG_START_TRACE, NULL); } @@ -326,7 +326,7 @@ int lttng_start_tracing(const char *session_name) */ int lttng_stop_tracing(const char *session_name) { - copy_string(lsm.session_name, session_name, NAME_MAX); + copy_string(lsm.session.name, session_name, NAME_MAX); return ask_sessiond(LTTNG_STOP_TRACE, NULL); } @@ -500,8 +500,8 @@ const char *lttng_get_readable_code(int code) */ int lttng_create_session(const char *name, const char *path) { - copy_string(lsm.session_name, name, NAME_MAX); - copy_string(lsm.path, path, PATH_MAX); + copy_string(lsm.session.name, name, NAME_MAX); + copy_string(lsm.session.path, path, PATH_MAX); return ask_sessiond(LTTNG_CREATE_SESSION, NULL); } @@ -510,7 +510,7 @@ int lttng_create_session(const char *name, const char *path) */ int lttng_destroy_session(const char *name) { - copy_string(lsm.session_name, name, NAME_MAX); + copy_string(lsm.session.name, name, NAME_MAX); return ask_sessiond(LTTNG_DESTROY_SESSION, NULL); } @@ -539,7 +539,7 @@ int lttng_list_domains(const char *session_name, struct lttng_domain **domains) { int ret; - copy_string(lsm.session_name, session_name, NAME_MAX); + copy_string(lsm.session.name, session_name, NAME_MAX); ret = ask_sessiond(LTTNG_LIST_DOMAINS, (void**) domains); if (ret < 0) { return ret; @@ -556,7 +556,7 @@ int lttng_list_channels(struct lttng_domain *domain, { int ret; - copy_string(lsm.session_name, session_name, NAME_MAX); + copy_string(lsm.session.name, session_name, NAME_MAX); copy_lttng_domain(domain); ret = ask_sessiond(LTTNG_LIST_CHANNELS, (void**) channels); @@ -576,7 +576,7 @@ int lttng_list_events(struct lttng_domain *domain, { int ret; - copy_string(lsm.session_name, session_name, NAME_MAX); + copy_string(lsm.session.name, session_name, NAME_MAX); copy_string(lsm.u.list.channel_name, channel_name, NAME_MAX); copy_lttng_domain(domain); @@ -593,7 +593,7 @@ int lttng_list_events(struct lttng_domain *domain, */ void lttng_set_session_name(const char *name) { - copy_string(lsm.session_name, name, NAME_MAX); + copy_string(lsm.session.name, name, NAME_MAX); } /* diff --git a/liblttsessiondcomm/liblttsessiondcomm.h b/liblttsessiondcomm/liblttsessiondcomm.h index 33be8dd8b..8ebadfdab 100644 --- a/liblttsessiondcomm/liblttsessiondcomm.h +++ b/liblttsessiondcomm/liblttsessiondcomm.h @@ -126,8 +126,7 @@ enum lttcomm_return_code { */ struct lttcomm_session_msg { u32 cmd_type; /* enum lttcomm_sessiond_command */ - char session_name[NAME_MAX]; - char path[PATH_MAX]; + struct lttng_session session; struct lttng_domain domain; union { struct { diff --git a/ltt-sessiond/main.c b/ltt-sessiond/main.c index 7d453214e..cf88db971 100644 --- a/ltt-sessiond/main.c +++ b/ltt-sessiond/main.c @@ -1273,11 +1273,11 @@ static int process_client_msg(struct command_ctx *cmd_ctx) case LTTNG_LIST_TRACEPOINTS: break; default: - DBG("Getting session %s by name", cmd_ctx->lsm->session_name); - cmd_ctx->session = find_session_by_name(cmd_ctx->lsm->session_name); + DBG("Getting session %s by name", cmd_ctx->lsm->session.name); + cmd_ctx->session = find_session_by_name(cmd_ctx->lsm->session.name); if (cmd_ctx->session == NULL) { /* If session name not found */ - if (cmd_ctx->lsm->session_name != NULL) { + if (cmd_ctx->lsm->session.name != NULL) { ret = LTTCOMM_SESS_NOT_FOUND; } else { /* If no session name specified */ ret = LTTCOMM_SELECT_SESS; @@ -1825,7 +1825,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) goto setup_error; } - ret = create_session(cmd_ctx->lsm->session_name, cmd_ctx->lsm->path); + ret = create_session(cmd_ctx->lsm->session.name, cmd_ctx->lsm->session.path); if (ret < 0) { if (ret == -EEXIST) { ret = LTTCOMM_EXIST_SESS; @@ -1849,7 +1849,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx) /* Clean kernel session teardown */ teardown_kernel_session(cmd_ctx->session); - ret = destroy_session(cmd_ctx->lsm->session_name); + ret = destroy_session(cmd_ctx->lsm->session.name); if (ret < 0) { ret = LTTCOMM_FATAL; goto error;