Add kernel trace data structure init functions
[lttng-tools.git] / ltt-sessiond / session.c
index 93f03e4c5ef11386d7fc5fdf36288993d246b078..ae09625a4dba0256236171d729a70706b31d8879 100644 (file)
@@ -32,11 +32,21 @@ static unsigned int session_count;
 static void add_session_list(struct ltt_session *ls);
 static void del_session_list(struct ltt_session *ls);
 
-/* Init session's list */
-static struct ltt_session_list ltt_session_list = {
+/* Init global session list */
+struct ltt_session_list ltt_session_list = {
        .head = CDS_LIST_HEAD_INIT(ltt_session_list.head),
 };
 
+/*
+ *  get_session_list
+ *
+ *  Return a pointer to the session list.
+ */
+struct ltt_session_list *get_session_list(void)
+{
+       return &ltt_session_list;
+}
+
 /*
  *  get_session_count
  *
@@ -192,19 +202,21 @@ int create_session(char *name, uuid_t *session_id)
        uuid_generate(new_session->uuid);
        uuid_copy(*session_id, new_session->uuid);
 
-       /* Set consumer (identifier) to 0. This means that there is
+       /*
+        * Set consumer (identifier) to 0. This means that there is
         * NO consumer attach to that session yet.
         */
        new_session->ust_consumer = 0;
-       new_session->kernel_consumer = 0;
+
+       /* Init kernel session */
+       new_session->kernel_session = NULL;
+       new_session->kern_session_count = 0;
 
        /* Init list */
        CDS_INIT_LIST_HEAD(&new_session->ust_traces);
-       CDS_INIT_LIST_HEAD(&new_session->kernel_traces);
 
        /* Set trace list counter */
        new_session->ust_trace_count = 0;
-       new_session->kern_trace_count = 0;
 
        /* Add new session to the global session list */
        add_session_list(new_session);
@@ -224,7 +236,7 @@ error_mem:
  *  Iterate over the global session list and
  *  fill the lttng_session array.
  */
-void get_lttng_session(struct lttng_session *lt)
+void get_lttng_session(struct lttng_session *sessions)
 {
        int i = 0;
        struct ltt_session *iter;
@@ -240,7 +252,7 @@ void get_lttng_session(struct lttng_session *lt)
                uuid_copy(lsess.uuid, iter->uuid);
                strncpy(lsess.name, iter->name, sizeof(lsess.name));
                lsess.name[sizeof(lsess.name) - 1] = '\0';
-               memcpy(&lt[i], &lsess, sizeof(lsess));
+               memcpy(&sessions[i], &lsess, sizeof(lsess));
                i++;
                /* Reset struct for next pass */
                memset(&lsess, 0, sizeof(lsess));
This page took 0.024804 seconds and 4 git commands to generate.