Fix: remove unused code in session daemon
authorDavid Goulet <dgoulet@efficios.com>
Tue, 3 Dec 2013 19:33:24 +0000 (14:33 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 3 Dec 2013 19:34:46 +0000 (14:34 -0500)
This also removes unused data structure in an unit test.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng-sessiond/jul.c
src/bin/lttng-sessiond/modprobe.c
src/bin/lttng-sessiond/modprobe.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
tests/unit/test_ust_data.c

index 183081dc04bc942df9363eabc2d70f2e03d4517c..59be57f6efe086d5edf195c5c6aca21023b1d481 100644 (file)
@@ -677,27 +677,6 @@ error:
        return NULL;
 }
 
-/*
- * Delete JUL event from given domain. Events hash table MUST be initialized.
- */
-void jul_delete_event(struct jul_event *event, struct jul_domain *dom)
-{
-       int ret;
-       struct lttng_ht_iter iter;
-
-       assert(event);
-       assert(dom);
-       assert(dom->events);
-
-       DBG3("JUL deleting event %s from domain", event->name);
-
-       iter.iter.node = &event->node.node;
-       rcu_read_lock();
-       ret = lttng_ht_del(dom->events, &iter);
-       rcu_read_unlock();
-       assert(!ret);
-}
-
 /*
  * Free given JUL event. This event must not be globally visible at this
  * point (only expected to be used on failure just after event
index a010e7cd76ab92b66d12ecef024efc5e98f07a98..92563b0faad2b4cd1714c5cc4f5a2f3f3974ac99 100644 (file)
@@ -232,24 +232,3 @@ int modprobe_lttng_data(void)
 error:
        return ret;
 }
-
-/*
- * Load all lttng kernel modules.
- */
-int modprobe_lttng_all(void)
-{
-       int ret;
-
-       ret = modprobe_lttng_control();
-       if (ret < 0) {
-               goto error;
-       }
-
-       ret = modprobe_lttng_data();
-       if (ret < 0) {
-               goto error;
-       }
-
-error:
-       return ret;
-}
index 8f329fad19a422505b7dd1a82168b737a3ffb77e..0c6f5f158f925c825eebbaf550934eac60e7b126 100644 (file)
@@ -21,7 +21,6 @@
 void modprobe_remove_lttng_all(void);
 void modprobe_remove_lttng_control(void);
 void modprobe_remove_lttng_data(void);
-int modprobe_lttng_all(void);
 int modprobe_lttng_control(void);
 int modprobe_lttng_data(void);
 
index 657d6e554310f70fdbed57d72d9f7165daf5b768..70b3a91a30edb48689a4b5c2f0f988783ff4317a 100644 (file)
@@ -404,48 +404,6 @@ error:
        return NULL;
 }
 
-/*
- * Allocate and initialize a ust metadata.
- *
- * Return pointer to structure or NULL.
- */
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
-       int ret;
-       struct ltt_ust_metadata *lum;
-
-       assert(path);
-
-       lum = zmalloc(sizeof(struct ltt_ust_metadata));
-       if (lum == NULL) {
-               PERROR("ust metadata zmalloc");
-               goto error;
-       }
-
-       /* Set default attributes */
-       lum->attr.overwrite = DEFAULT_CHANNEL_OVERWRITE;
-       lum->attr.subbuf_size = default_get_metadata_subbuf_size();
-       lum->attr.num_subbuf = DEFAULT_METADATA_SUBBUF_NUM;
-       lum->attr.switch_timer_interval = DEFAULT_METADATA_SWITCH_TIMER;
-       lum->attr.read_timer_interval = DEFAULT_METADATA_READ_TIMER;
-       lum->attr.output = LTTNG_UST_MMAP;
-
-       lum->handle = -1;
-       /* Set metadata trace path */
-       ret = snprintf(lum->pathname, PATH_MAX, "%s/" DEFAULT_METADATA_NAME, path);
-       if (ret < 0) {
-               PERROR("asprintf ust metadata");
-               goto error_free_metadata;
-       }
-
-       return lum;
-
-error_free_metadata:
-       free(lum);
-error:
-       return NULL;
-}
-
 /*
  * Allocate and initialize an UST context.
  *
@@ -638,20 +596,6 @@ void trace_ust_delete_channel(struct lttng_ht *ht,
        assert(!ret);
 }
 
-/*
- * Cleanup ust metadata structure.
- */
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
-{
-       assert(metadata);
-
-       if (!metadata->handle) {
-               return;
-       }
-       DBG2("Trace UST destroy metadata %d", metadata->handle);
-       free(metadata);
-}
-
 /*
  * Iterate over a hash table containing channels and cleanup safely.
  */
index 9f8d182b3cf610551df792b8cda82646c453110a..f2f8c7e3654bfe3be456d1e32e3a711bf48c3d7d 100644 (file)
@@ -67,15 +67,6 @@ struct ltt_ust_channel {
        uint64_t tracefile_count;
 };
 
-/* UST Metadata */
-struct ltt_ust_metadata {
-       int handle;
-       struct lttng_ust_object_data *obj;
-       char pathname[PATH_MAX];              /* Trace file path name */
-       struct lttng_ust_channel_attr attr;
-       struct lttng_ust_object_data *stream_obj;
-};
-
 /* UST domain global (LTTNG_DOMAIN_UST) */
 struct ltt_ust_domain_global {
        struct lttng_ht *channels;
@@ -170,7 +161,6 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr);
 struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
                struct lttng_filter_bytecode *filter,
                struct lttng_event_exclusion *exclusion);
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path);
 struct ltt_ust_context *trace_ust_create_context(
                struct lttng_event_context *ctx);
 void trace_ust_delete_channel(struct lttng_ht *ht,
@@ -181,7 +171,6 @@ void trace_ust_delete_channel(struct lttng_ht *ht,
  * it's applies.
  */
 void trace_ust_destroy_session(struct ltt_ust_session *session);
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata);
 void trace_ust_destroy_channel(struct ltt_ust_channel *channel);
 void trace_ust_destroy_event(struct ltt_ust_event *event);
 
@@ -221,22 +210,11 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev,
 {
        return NULL;
 }
-static inline
-struct ltt_ust_metadata *trace_ust_create_metadata(char *path)
-{
-       return NULL;
-}
-
 static inline
 void trace_ust_destroy_session(struct ltt_ust_session *session)
 {
 }
 
-static inline
-void trace_ust_destroy_metadata(struct ltt_ust_metadata *metadata)
-{
-}
-
 static inline
 void trace_ust_destroy_channel(struct ltt_ust_channel *channel)
 {
index ab08ac0e4d04ccf409c8d02e358e11f0033a0520..c7bcc85f5e0b8fed7ef9aeff108f3fb630517e95 100644 (file)
@@ -2817,14 +2817,6 @@ error:
        return ret;
 }
 
-/*
- * Return pointer to traceable apps list.
- */
-struct lttng_ht *ust_app_get_ht(void)
-{
-       return ust_app_ht;
-}
-
 /*
  * Return ust app pointer or NULL if not found. RCU read side lock MUST be
  * acquired before calling this function.
@@ -3087,20 +3079,6 @@ void ust_app_unregister(int sock)
        return;
 }
 
-/*
- * Return traceable_app_count
- */
-unsigned long ust_app_list_count(void)
-{
-       unsigned long count;
-
-       rcu_read_lock();
-       count = lttng_ht_get_count(ust_app_ht);
-       rcu_read_unlock();
-
-       return count;
-}
-
 /*
  * Fill events array with all events name of all registered apps.
  */
@@ -3538,65 +3516,6 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
        return ret;
 }
 
-/*
- * For a specific UST session and UST channel, the event for all
- * registered apps.
- */
-int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
-{
-       int ret = 0;
-       struct lttng_ht_iter iter, uiter;
-       struct lttng_ht_node_str *ua_chan_node;
-       struct ust_app *app;
-       struct ust_app_session *ua_sess;
-       struct ust_app_channel *ua_chan;
-       struct ust_app_event *ua_event;
-
-       DBG("UST app disabling all event for all apps in channel "
-                       "%s for session id %" PRIu64, uchan->name, usess->id);
-
-       rcu_read_lock();
-
-       /* For all registered applications */
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
-               if (!app->compatible) {
-                       /*
-                        * TODO: In time, we should notice the caller of this error by
-                        * telling him that this is a version error.
-                        */
-                       continue;
-               }
-               ua_sess = lookup_session_by_app(usess, app);
-               if (!ua_sess) {
-                       /* The application has problem or is probably dead. */
-                       continue;
-               }
-
-               /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
-               ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
-               /* If the channel is not found, there is a code flow error */
-               assert(ua_chan_node);
-
-               ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
-
-               /* Disable each events of channel */
-               cds_lfht_for_each_entry(ua_chan->events->ht, &uiter.iter, ua_event,
-                               node.node) {
-                       ret = disable_ust_app_event(ua_sess, ua_event, app);
-                       if (ret < 0) {
-                               /* XXX: Report error someday... */
-                               continue;
-                       }
-               }
-       }
-
-       rcu_read_unlock();
-
-       return ret;
-}
-
 /*
  * For a specific UST session, create the channel for all registered apps.
  */
@@ -4476,69 +4395,6 @@ end:
        return ret;
 }
 
-/*
- * Disable event for a channel from a UST session for a specific PID.
- */
-int ust_app_disable_event_pid(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent, pid_t pid)
-{
-       int ret = 0;
-       struct lttng_ht_iter iter;
-       struct lttng_ht_node_str *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_event *ua_event;
-
-       DBG("UST app disabling event %s for PID %d", uevent->attr.name, pid);
-
-       rcu_read_lock();
-
-       app = ust_app_find_by_pid(pid);
-       if (app == NULL) {
-               ERR("UST app disable event per PID %d not found", pid);
-               ret = -1;
-               goto error;
-       }
-
-       if (!app->compatible) {
-               ret = 0;
-               goto error;
-       }
-
-       ua_sess = lookup_session_by_app(usess, app);
-       if (!ua_sess) {
-               /* The application has problem or is probably dead. */
-               goto error;
-       }
-
-       /* Lookup channel in the ust app session */
-       lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &iter);
-       ua_chan_node = lttng_ht_iter_get_node_str(&iter);
-       if (ua_chan_node == NULL) {
-               /* Channel does not exist, skip disabling */
-               goto error;
-       }
-       ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
-
-       lttng_ht_lookup(ua_chan->events, (void *)uevent->attr.name, &iter);
-       ua_event_node = lttng_ht_iter_get_node_str(&iter);
-       if (ua_event_node == NULL) {
-               /* Event does not exist, skip disabling */
-               goto error;
-       }
-       ua_event = caa_container_of(ua_event_node, struct ust_app_event, node);
-
-       ret = disable_ust_app_event(ua_sess, ua_event, app);
-       if (ret < 0) {
-               goto error;
-       }
-
-error:
-       rcu_read_unlock();
-       return ret;
-}
-
 /*
  * Calibrate registered applications.
  */
index 252255710be6fcdc85196d64fa336f52d0b6f83e..fe040ae503db83436c8d93a1f23ecf6fc97e3b3c 100644 (file)
@@ -282,7 +282,6 @@ int ust_app_register_done(int sock)
 }
 int ust_app_version(struct ust_app *app);
 void ust_app_unregister(int sock);
-unsigned long ust_app_list_count(void);
 int ust_app_start_trace_all(struct ltt_ust_session *usess);
 int ust_app_stop_trace_all(struct ltt_ust_session *usess);
 int ust_app_destroy_trace_all(struct ltt_ust_session *usess);
@@ -292,9 +291,6 @@ 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_event_pid(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               pid_t pid);
 int ust_app_enable_event_pid(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
                pid_t pid);
@@ -304,8 +300,6 @@ int ust_app_enable_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
 int ust_app_enable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
-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);
 int ust_app_disable_event_glb(struct ltt_ust_session *usess,
@@ -316,7 +310,6 @@ void ust_app_global_update(struct ltt_ust_session *usess, int sock);
 
 void ust_app_clean_list(void);
 void ust_app_ht_alloc(void);
-struct lttng_ht *ust_app_get_ht(void);
 struct ust_app *ust_app_find_by_pid(pid_t pid);
 int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate);
 struct ust_app_stream *ust_app_alloc_stream(void);
@@ -391,11 +384,6 @@ void ust_app_unregister(int sock)
 {
 }
 static inline
-unsigned int ust_app_list_count(void)
-{
-       return 0;
-}
-static inline
 void ust_app_lock_list(void)
 {
 }
@@ -418,11 +406,6 @@ struct ust_app *ust_app_get_by_pid(pid_t pid)
        return NULL;
 }
 static inline
-struct lttng_ht *ust_app_get_ht(void)
-{
-       return NULL;
-}
-static inline
 void ust_app_ht_alloc(void)
 {}
 static inline
@@ -447,12 +430,6 @@ int ust_app_create_channel_glb(struct ltt_ust_session *usess,
        return 0;
 }
 static inline
-int ust_app_disable_all_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan)
-{
-       return 0;
-}
-static inline
 int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan)
 {
@@ -490,13 +467,6 @@ int ust_app_enable_event_pid(struct ltt_ust_session *usess,
        return 0;
 }
 static inline
-int ust_app_disable_event_pid(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               pid_t pid)
-{
-       return 0;
-}
-static inline
 int ust_app_calibrate_glb(struct lttng_ust_calibrate *calibrate)
 {
        return 0;
index 2f08b38c0bffe44ffd42045493f3c010a73bd6be..52b93e9f6b87013bda56f56c34e1d7f65cfabc1c 100644 (file)
@@ -39,7 +39,7 @@
 #define RANDOM_STRING_LEN      11
 
 /* Number of TAP tests in this file */
-#define NUM_TESTS 12
+#define NUM_TESTS 10
 
 /* For lttngerr.h */
 int lttng_opt_quiet = 1;
@@ -91,33 +91,6 @@ static void test_create_one_ust_session(void)
        trace_ust_destroy_session(usess);
 }
 
-static void test_create_ust_metadata(void)
-{
-       struct ltt_ust_metadata *metadata;
-
-       assert(usess != NULL);
-
-       metadata = trace_ust_create_metadata(PATH1);
-       ok(metadata != NULL, "Create UST metadata");
-
-       ok(metadata->handle == -1 &&
-          strlen(metadata->pathname) &&
-          metadata->attr.overwrite
-                       == DEFAULT_CHANNEL_OVERWRITE &&
-          metadata->attr.subbuf_size
-                       == default_get_metadata_subbuf_size() &&
-          metadata->attr.num_subbuf
-                       == DEFAULT_METADATA_SUBBUF_NUM &&
-          metadata->attr.switch_timer_interval
-                       == DEFAULT_METADATA_SWITCH_TIMER &&
-          metadata->attr.read_timer_interval
-                       == DEFAULT_METADATA_READ_TIMER &&
-          metadata->attr.output == LTTNG_UST_MMAP,
-          "Validate UST session metadata");
-
-       trace_ust_destroy_metadata(metadata);
-}
-
 static void test_create_ust_channel(void)
 {
        struct ltt_ust_channel *uchan;
@@ -226,7 +199,6 @@ int main(int argc, char **argv)
        diag("UST data structures unit test");
 
        test_create_one_ust_session();
-       test_create_ust_metadata();
        test_create_ust_channel();
        test_create_ust_event();
        test_create_ust_context();
This page took 0.032791 seconds and 4 git commands to generate.