Remove path and session from session message
authorDavid Goulet <david.goulet@polymtl.ca>
Thu, 4 Aug 2011 01:03:27 +0000 (21:03 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Thu, 4 Aug 2011 01:03:27 +0000 (21:03 -0400)
Replace the two by a lttng_session structure.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
liblttngctl/liblttngctl.c
liblttsessiondcomm/liblttsessiondcomm.h
ltt-sessiond/main.c

index f57201ab186be26ffe0106589325be5db42fe0a1..fd5a552cf012d94e904b72f77cf7dc86d9635e72 100644 (file)
@@ -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);
 }
 
 /*
index 33be8dd8baef06b6a2324357460336e863123358..8ebadfdabf089593a8f783d32a414f72498085c9 100644 (file)
@@ -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 {
index 7d453214ee1936830fcd846d9411610c414f3082..cf88db97159c3c661d9b06201e0df6953fa003dc 100644 (file)
@@ -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;
This page took 0.031938 seconds and 4 git commands to generate.