Rename ust app function for better semantic
authorDavid Goulet <david.goulet@polymtl.ca>
Tue, 29 Nov 2011 22:42:21 +0000 (17:42 -0500)
committerDavid Goulet <david.goulet@polymtl.ca>
Tue, 29 Nov 2011 22:42:21 +0000 (17:42 -0500)
Replace _all by _glb meaning global. This family of functions (ending
with _glb) apply an action on *all* registered applications.

Also fix the setting the enabled flag on disable-event.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
lttng-sessiond/event.c
lttng-sessiond/main.c
lttng-sessiond/ust-app.c
lttng-sessiond/ust-app.h

index 407f8441c60bb7ffd8bae71448498879738b47b3..c7331956f91e486a5f2a06caf3f8b20f71d53f26 100644 (file)
@@ -260,10 +260,10 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, int domain,
        {
                if (to_create) {
                        /* Create event on all UST registered apps for session */
        {
                if (to_create) {
                        /* Create event on all UST registered apps for session */
-                       ret = ust_app_create_event_all(usess, uchan, uevent);
+                       ret = ust_app_create_event_glb(usess, uchan, uevent);
                } else {
                        /* Enable event on all UST registered apps for session */
                } else {
                        /* Enable event on all UST registered apps for session */
-                       ret = ust_app_enable_event_all(usess, uchan, uevent);
+                       ret = ust_app_enable_event_glb(usess, uchan, uevent);
                }
 
                if (ret < 0) {
                }
 
                if (ret < 0) {
index 63d7f0e2d3e0ab48a68104183e5054454bde7db6..7e4000a0fd1183365a9ccc7746e47297f0cb9d66 100644 (file)
@@ -2191,7 +2191,7 @@ static int cmd_disable_channel(struct ltt_session *session,
                        goto error;
                }
 
                        goto error;
                }
 
-               ret = ust_app_disable_channel_all(usess, uchan);
+               ret = ust_app_disable_channel_glb(usess, uchan);
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
@@ -2305,7 +2305,7 @@ static int cmd_enable_channel(struct ltt_session *session,
                        DBG2("UST channel %s added to global domain HT", attr->name);
 
                        /* Add channel to all registered applications */
                        DBG2("UST channel %s added to global domain HT", attr->name);
 
                        /* Add channel to all registered applications */
-                       ret = ust_app_create_channel_all(usess, uchan);
+                       ret = ust_app_create_channel_glb(usess, uchan);
                        if (ret != 0) {
                                ret = LTTCOMM_UST_CHAN_FAIL;
                                goto error;
                        if (ret != 0) {
                                ret = LTTCOMM_UST_CHAN_FAIL;
                                goto error;
@@ -2317,7 +2317,7 @@ static int cmd_enable_channel(struct ltt_session *session,
                                goto error;
                        }
 
                                goto error;
                        }
 
-                       ret = ust_app_enable_channel_all(usess, uchan);
+                       ret = ust_app_enable_channel_glb(usess, uchan);
                        if (ret < 0) {
                                ret = LTTCOMM_UST_ENABLE_FAIL;
                                goto error;
                        if (ret < 0) {
                                ret = LTTCOMM_UST_ENABLE_FAIL;
                                goto error;
@@ -2378,6 +2378,7 @@ static int cmd_disable_event(struct ltt_session *session, int domain,
        {
                struct ltt_ust_session *usess;
                struct ltt_ust_channel *uchan;
        {
                struct ltt_ust_session *usess;
                struct ltt_ust_channel *uchan;
+               struct ltt_ust_event *uevent;
 
                usess = session->ust_session;
 
 
                usess = session->ust_session;
 
@@ -2388,12 +2389,20 @@ static int cmd_disable_event(struct ltt_session *session, int domain,
                        goto error;
                }
 
                        goto error;
                }
 
-               ret = ust_app_disable_event(usess, uchan, event_name);
+               uevent = trace_ust_find_event_by_name(uchan->events, event_name);
+               if (uevent == NULL) {
+                       ret = LTTCOMM_UST_EVENT_NOT_FOUND;
+                       goto error;
+               }
+
+               ret = ust_app_disable_event_glb(usess, uchan, uevent);
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
                }
 
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
                }
 
+               uevent->enabled = 0;
+
                DBG2("Disable UST event %s in channel %s completed", event_name,
                                channel_name);
 
                DBG2("Disable UST event %s in channel %s completed", event_name,
                                channel_name);
 
@@ -2457,7 +2466,7 @@ static int cmd_disable_event_all(struct ltt_session *session, int domain,
                        goto error;
                }
 
                        goto error;
                }
 
-               ret = ust_app_disable_event_all(usess, uchan);
+               ret = ust_app_disable_all_event_glb(usess, uchan);
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
                if (ret < 0) {
                        ret = LTTCOMM_UST_DISABLE_FAIL;
                        goto error;
index 30ac8ceaf923d4d7490589d07eb885c5d0d481c4..3f4c4c661fb4aa10d8bb6680c1687d9f6b23ad0b 100644 (file)
@@ -760,8 +760,7 @@ error:
  */
 static
 int enable_ust_app_event(struct ust_app_session *ua_sess,
  */
 static
 int enable_ust_app_event(struct ust_app_session *ua_sess,
-               struct ust_app_channel *ua_chan, struct ust_app_event *ua_event,
-               struct ust_app *app)
+               struct ust_app_event *ua_event, struct ust_app *app)
 {
        int ret;
 
 {
        int ret;
 
@@ -1238,7 +1237,7 @@ void ust_app_ht_alloc(void)
 /*
  * For a specific UST session, disable the channel for all registered apps.
  */
 /*
  * For a specific UST session, disable the channel for all registered apps.
  */
-int ust_app_disable_channel_all(struct ltt_ust_session *usess,
+int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
@@ -1281,7 +1280,7 @@ error:
 /*
  * For a specific UST session, enable the channel for all registered apps.
  */
 /*
  * For a specific UST session, enable the channel for all registered apps.
  */
-int ust_app_enable_channel_all(struct ltt_ust_session *usess,
+int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
@@ -1324,8 +1323,8 @@ error:
 /*
  * Disable an event in a channel and for a specific session.
  */
 /*
  * Disable an event in a channel and for a specific session.
  */
-int ust_app_disable_event(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, char *event_name)
+int ust_app_disable_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct cds_lfht_iter iter, uiter;
 {
        int ret = 0;
        struct cds_lfht_iter iter, uiter;
@@ -1336,7 +1335,7 @@ int ust_app_disable_event(struct ltt_ust_session *usess,
        struct ust_app_event *ua_event;
 
        DBG("UST app disabling event %s for all apps in channel "
        struct ust_app_event *ua_event;
 
        DBG("UST app disabling event %s for all apps in channel "
-                       "%s for session uid %d", event_name, uchan->name, usess->uid);
+                       "%s for session uid %d", uevent->attr.name, uchan->name, usess->uid);
 
        rcu_read_lock();
 
 
        rcu_read_lock();
 
@@ -1359,10 +1358,10 @@ int ust_app_disable_event(struct ltt_ust_session *usess,
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
 
                ua_event_node = hashtable_lookup(ua_chan->events,
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
 
                ua_event_node = hashtable_lookup(ua_chan->events,
-                               (void *) event_name, strlen(event_name), &uiter);
+                               (void *)uevent->attr.name, strlen(uevent->attr.name), &uiter);
                if (ua_event_node == NULL) {
                        DBG2("Event %s not found in channel %s for app pid %d."
                if (ua_event_node == NULL) {
                        DBG2("Event %s not found in channel %s for app pid %d."
-                                       "Skipping", event_name, uchan->name, app->key.pid);
+                                       "Skipping", uevent->attr.name, uchan->name, app->key.pid);
                        continue;
                }
                ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
                        continue;
                }
                ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
@@ -1383,7 +1382,7 @@ int ust_app_disable_event(struct ltt_ust_session *usess,
  * For a specific UST session and UST channel, the event for all
  * registered apps.
  */
  * For a specific UST session and UST channel, the event for all
  * registered apps.
  */
-int ust_app_disable_event_all(struct ltt_ust_session *usess,
+int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
@@ -1431,7 +1430,7 @@ int ust_app_disable_event_all(struct ltt_ust_session *usess,
 /*
  * For a specific UST session, create the channel for all registered apps.
  */
 /*
  * For a specific UST session, create the channel for all registered apps.
  */
-int ust_app_create_channel_all(struct ltt_ust_session *usess,
+int ust_app_create_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
                struct ltt_ust_channel *uchan)
 {
        int ret = 0;
@@ -1479,12 +1478,12 @@ error:
 /*
  * Enable event for a specific session and channel on the tracer.
  */
 /*
  * Enable event for a specific session and channel on the tracer.
  */
-int ust_app_enable_event_all(struct ltt_ust_session *usess,
+int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct cds_lfht_iter iter, uiter;
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        int ret = 0;
        struct cds_lfht_iter iter, uiter;
-       struct cds_lfht_node *ua_chan_node;
+       struct cds_lfht_node *ua_chan_node, *ua_event_node;
        struct ust_app *app;
        struct ust_app_session *ua_sess;
        struct ust_app_channel *ua_chan;
        struct ust_app *app;
        struct ust_app_session *ua_sess;
        struct ust_app_channel *ua_chan;
@@ -1515,13 +1514,19 @@ int ust_app_enable_event_all(struct ltt_ust_session *usess,
 
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
 
 
                ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
 
-               /* Enable each events of channel */
-               cds_lfht_for_each_entry(ua_chan->events, &uiter, ua_event, node) {
-                       ret = enable_ust_app_event(ua_sess, ua_chan, ua_event, app);
-                       if (ret < 0) {
-                               /* XXX: Report error someday... */
-                               continue;
-                       }
+               ua_event_node = hashtable_lookup(ua_sess->channels,
+                               (void*)uevent->attr.name, strlen(uevent->attr.name), &uiter);
+               if (ua_event_node == NULL) {
+                       DBG3("UST app enable event %s not found. Skipping app",
+                                       uevent->attr.name);
+                       continue;
+               }
+               ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
+
+               ret = enable_ust_app_event(ua_sess, ua_event, app);
+               if (ret < 0) {
+                       /* XXX: Report error someday... */
+                       continue;
                }
        }
 
                }
        }
 
@@ -1534,7 +1539,7 @@ int ust_app_enable_event_all(struct ltt_ust_session *usess,
  * For a specific existing UST session and UST channel, creates the event for
  * all registered apps.
  */
  * For a specific existing UST session and UST channel, creates the event for
  * all registered apps.
  */
-int ust_app_create_event_all(struct ltt_ust_session *usess,
+int ust_app_create_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        int ret = 0;
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        int ret = 0;
index 87d84ffb9262de28cf75f3dfad8cb95569c5ee7a..8a0130f0724927f33cf986e58feb37ba01cc25f0 100644 (file)
@@ -110,10 +110,6 @@ struct ust_app {
 
 int ust_app_register(struct ust_register_msg *msg, int sock);
 void ust_app_unregister(int sock);
 
 int ust_app_register(struct ust_register_msg *msg, int sock);
 void ust_app_unregister(int sock);
-int ust_app_create_channel_all(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan);
-int ust_app_create_event_all(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
 unsigned long ust_app_list_count(void);
 int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app);
 int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app);
 unsigned long ust_app_list_count(void);
 int ust_app_start_trace(struct ltt_ust_session *usess, struct ust_app *app);
 int ust_app_stop_trace(struct ltt_ust_session *usess, struct ust_app *app);
@@ -122,16 +118,22 @@ int ust_app_stop_trace_all(struct ltt_ust_session *usess);
 int ust_app_destroy_trace(struct ltt_ust_session *usess, struct ust_app *app);
 int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
 int ust_app_list_events(struct lttng_event **events);
 int ust_app_destroy_trace(struct ltt_ust_session *usess, struct ust_app *app);
 int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
 int ust_app_list_events(struct lttng_event **events);
-int ust_app_disable_channel_all(struct ltt_ust_session *usess,
+int ust_app_create_channel_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan);
+int ust_app_create_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
+int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
                struct ltt_ust_channel *uchan);
-int ust_app_enable_channel_all(struct ltt_ust_session *usess,
+int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
                struct ltt_ust_channel *uchan);
-int ust_app_enable_event_all(struct ltt_ust_session *usess,
+int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
-int ust_app_disable_event_all(struct ltt_ust_session *usess,
+int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan);
+int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
                struct ltt_ust_channel *uchan);
-int ust_app_disable_event(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, char *event_name);
+int ust_app_disable_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
 void ust_app_global_update(struct ltt_ust_session *usess, int sock);
 
 void ust_app_clean_list(void);
 void ust_app_global_update(struct ltt_ust_session *usess, int sock);
 
 void ust_app_clean_list(void);
@@ -203,18 +205,6 @@ struct ust_app *ust_app_get_by_pid(pid_t pid)
        return NULL;
 }
 static inline
        return NULL;
 }
 static inline
-int ust_app_add_channel_all(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
-{
-       return 0;
-}
-static inline
-int ust_app_add_event_all(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
-{
-       return 0;
-}
-static inline
 struct cds_lfht *ust_app_get_ht(void)
 {
        return NULL;
 struct cds_lfht *ust_app_get_ht(void)
 {
        return NULL;
@@ -226,43 +216,49 @@ static inline
 void ust_app_global_update(struct ltt_ust_session *usess, int sock)
 {}
 static inline
 void ust_app_global_update(struct ltt_ust_session *usess, int sock)
 {}
 static inline
-int ust_app_disable_channel_all(struct ltt_ust_session *usess,
+int ust_app_disable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
-int ust_app_enable_channel_all(struct ltt_ust_session *usess,
+int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
-int ust_app_disable_event_all(struct ltt_ust_session *usess,
+int ust_app_create_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
-int ust_app_disable_event(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, char *event_name)
+int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
 {
        return 0;
 }
 static inline
-int ust_app_create_channel_all(struct ltt_ust_session *usess,
+int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
                struct ltt_ust_channel *uchan)
 {
        return 0;
 }
 static inline
-int ust_app_create_event_all(struct ltt_ust_session *usess,
+int ust_app_create_event_glb(struct ltt_ust_session *usess,
+               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
+{
+       return 0;
+}
+static inline
+int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        return 0;
 }
 static inline
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        return 0;
 }
 static inline
-int ust_app_enable_event_all(struct ltt_ust_session *usess,
+int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        return 0;
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent)
 {
        return 0;
This page took 0.035036 seconds and 4 git commands to generate.