Cleanup: rename `get_domain_str()` -> `lttng_domain_type_str()`
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 25 May 2021 19:57:59 +0000 (15:57 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 16 Jul 2021 17:36:29 +0000 (13:36 -0400)
Both functions currently exist in the code base and accomplish the same
goal. Let's keep only one of them.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I2254b846f0b5bdc883c86d970fde7daffa9e6155

src/bin/lttng/commands/add_context.c
src/bin/lttng/commands/add_trigger.c
src/bin/lttng/commands/disable_channels.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/enable_channels.c
src/bin/lttng/commands/enable_events.c
src/bin/lttng/commands/list.c
src/bin/lttng/utils.c
src/bin/lttng/utils.h
src/common/mi-lttng.c

index b33eb1d14ef22545b73baeceed6d6a19424b9e8c..de066e6dc3410648fff47cb8720ff50ef9885f0c 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <urcu/list.h>
 
+#include <lttng/domain-internal.h>
 #include <common/mi-lttng.h>
 
 #include "../command.h"
@@ -810,11 +811,13 @@ static int add_context(char *session_name)
                } else {
                        if (opt_channel_name) {
                                MSG("%s context %s added to channel %s",
-                                               get_domain_str(dom.type), type->opt->symbol,
+                                               lttng_domain_type_str(dom.type),
+                                               type->opt->symbol,
                                                opt_channel_name);
                        } else {
                                MSG("%s context %s added to all channels",
-                                               get_domain_str(dom.type), type->opt->symbol);
+                                               lttng_domain_type_str(dom.type),
+                                               type->opt->symbol);
                        }
                        success = 1;
                }
index 00f8f47e363401400db7d613939b8be17923245e..8fb79d3786c577842475ea9724f92293ec591800 100644 (file)
@@ -18,6 +18,7 @@
 #include "common/mi-lttng.h"
 #include "common/string-utils/string-utils.h"
 #include "common/utils.h"
+#include <lttng/domain-internal.h>
 /* For lttng_event_rule_type_str(). */
 #include <lttng/event-rule/event-rule-internal.h>
 #include <lttng/lttng.h>
index 344be237d26c2d4581c26c50363dbbe7558293ff..f75c5feb0257bdccfaf1bfa9faad652d359b2ae9 100644 (file)
@@ -16,6 +16,7 @@
 #include <assert.h>
 
 #include <common/mi-lttng.h>
+#include <lttng/domain-internal.h>
 
 #include "../command.h"
 
@@ -155,7 +156,8 @@ static int disable_channels(char *session_name)
 
                } else {
                        MSG("%s channel %s disabled for session %s",
-                                       get_domain_str(dom.type), channel_name, session_name);
+                                       lttng_domain_type_str(dom.type),
+                                       channel_name, session_name);
                        enabled = 0;
                        success = 1;
                }
index a42c3a3cd52849c044d9a61a7304113b0db7a56c..0bfd0c506c850e4fedca383615c13d67365a7006 100644 (file)
@@ -16,6 +16,7 @@
 #include <assert.h>
 
 #include <common/mi-lttng.h>
+#include <lttng/domain-internal.h>
 
 #include "../command.h"
 
@@ -226,7 +227,7 @@ static int disable_events(char *session_name)
                        enabled = 0;
                        success = 1;
                        MSG("All %s events of type %s are disabled in channel %s",
-                                       get_domain_str(dom.type),
+                                       lttng_domain_type_str(dom.type),
                                        print_event_type(opt_event_type),
                                        print_channel_name(channel_name));
                }
@@ -265,7 +266,7 @@ static int disable_events(char *session_name)
                                enabled = 1;
                        } else {
                                MSG("%s %s of type %s disabled in channel %s for session %s",
-                                               get_domain_str(dom.type),
+                                               lttng_domain_type_str(dom.type),
                                                event_name,
                                                print_event_type(opt_event_type),
                                                print_channel_name(channel_name),
index fa65b1eaa9257d84e3be698a7e10a9960683c0d8..dd79926f81d6c80b3ef70d56cb8a188d4b491a9c 100644 (file)
@@ -21,6 +21,8 @@
 #include <common/utils.h>
 #include <common/mi-lttng.h>
 
+#include <lttng/domain-internal.h>
+
 #include "../command.h"
 #include "../utils.h"
 
@@ -304,7 +306,8 @@ static int enable_channel(char *session_name)
                        }
                } else {
                        MSG("%s channel %s enabled for session %s",
-                                       get_domain_str(dom.type), channel_name, session_name);
+                                       lttng_domain_type_str(dom.type),
+                                       channel_name, session_name);
                        success = 1;
                }
 
index 0704b14756f78ef860b7e283c4e084a4b6f6a40a..948663412fe1c563e2b5f6a08e902eaac0a618ed 100644 (file)
@@ -25,6 +25,7 @@
 /* Mi dependancy */
 #include <common/mi-lttng.h>
 
+#include <lttng/domain-internal.h>
 #include <lttng/event-internal.h>
 
 #include "../command.h"
@@ -486,7 +487,7 @@ static int enable_events(char *session_name)
                case LTTNG_DOMAIN_LOG4J:
                case LTTNG_DOMAIN_PYTHON:
                        ERR("Event name exclusions are not yet implemented for %s events",
-                                       get_domain_str(dom.type));
+                                       lttng_domain_type_str(dom.type));
                        ret = CMD_ERROR;
                        goto error;
                case LTTNG_DOMAIN_UST:
@@ -656,7 +657,7 @@ static int enable_events(char *session_name)
                                                goto end;
                                        }
                                        MSG("All %s tracepoints%s are enabled in channel %s for loglevel %s",
-                                                       get_domain_str(dom.type),
+                                                       lttng_domain_type_str(dom.type),
                                                        exclusion_string,
                                                        print_channel_name(channel_name),
                                                        opt_loglevel);
@@ -670,7 +671,7 @@ static int enable_events(char *session_name)
                                                goto end;
                                        }
                                        MSG("All %s tracepoints%s are enabled in channel %s",
-                                                       get_domain_str(dom.type),
+                                                       lttng_domain_type_str(dom.type),
                                                        exclusion_string,
                                                        print_channel_name(channel_name));
                                        free(exclusion_string);
@@ -679,7 +680,7 @@ static int enable_events(char *session_name)
                        case LTTNG_EVENT_SYSCALL:
                                if (opt_kernel) {
                                        MSG("All %s system calls are enabled in channel %s",
-                                                       get_domain_str(dom.type),
+                                                       lttng_domain_type_str(dom.type),
                                                        print_channel_name(channel_name));
                                }
                                break;
@@ -693,7 +694,7 @@ static int enable_events(char *session_name)
                                                goto end;
                                        }
                                        MSG("All %s events%s are enabled in channel %s for loglevel %s",
-                                                       get_domain_str(dom.type),
+                                                       lttng_domain_type_str(dom.type),
                                                        exclusion_string,
                                                        print_channel_name(channel_name),
                                                        opt_loglevel);
@@ -707,7 +708,7 @@ static int enable_events(char *session_name)
                                                goto end;
                                        }
                                        MSG("All %s events%s are enabled in channel %s",
-                                                       get_domain_str(dom.type),
+                                                       lttng_domain_type_str(dom.type),
                                                        exclusion_string,
                                                        print_channel_name(channel_name));
                                        free(exclusion_string);
@@ -1059,7 +1060,7 @@ static int enable_events(char *session_name)
                                case LTTNG_DOMAIN_KERNEL:
                                case LTTNG_DOMAIN_UST:
                                        MSG("%s event %s%s created in channel %s",
-                                               get_domain_str(dom.type),
+                                               lttng_domain_type_str(dom.type),
                                                event_name,
                                                exclusion_string,
                                                print_channel_name(channel_name));
@@ -1072,7 +1073,7 @@ static int enable_events(char *session_name)
                                         * name for agent domains.
                                         */
                                        MSG("%s event %s%s enabled",
-                                               get_domain_str(dom.type),
+                                               lttng_domain_type_str(dom.type),
                                                event_name,
                                                exclusion_string);
                                        break;
index 4f4fcb5ef09c898157bbaa25a86fd88aea8de9b7..34a9c8aa0d612e7dc49ea78d9f0dbfa9d762230e 100644 (file)
@@ -18,6 +18,7 @@
 #include <common/mi-lttng.h>
 #include <common/time.h>
 #include <common/tracker.h>
+#include <lttng/domain-internal.h>
 #include <lttng/lttng.h>
 
 #include "../command.h"
@@ -576,7 +577,7 @@ static int list_agent_events(void)
                goto error;
        }
 
-       agent_domain_str = get_domain_str(domain.type);
+       agent_domain_str = lttng_domain_type_str(domain.type);
 
        DBG("Getting %s tracing events", agent_domain_str);
 
index b363cfed04521fad884a9235090e5f54f881ade3..e836943991da04d16c9c0764230cd4e3ca6367e6 100644 (file)
 #include "utils.h"
 #include "command.h"
 
-static const char *str_kernel = "Kernel";
-static const char *str_ust = "UST";
-static const char *str_jul = "JUL";
-static const char *str_log4j = "LOG4J";
-static const char *str_python = "Python";
 static const char *str_all = "ALL";
 static const char *str_tracepoint = "Tracepoint";
 static const char *str_syscall = "Syscall";
@@ -298,34 +293,6 @@ int get_count_order_ulong(unsigned long x)
        return fls_ulong(x - 1);
 }
 
-const char *get_domain_str(enum lttng_domain_type domain)
-{
-       const char *str_dom;
-
-       switch (domain) {
-       case LTTNG_DOMAIN_KERNEL:
-               str_dom = str_kernel;
-               break;
-       case LTTNG_DOMAIN_UST:
-               str_dom = str_ust;
-               break;
-       case LTTNG_DOMAIN_JUL:
-               str_dom = str_jul;
-               break;
-       case LTTNG_DOMAIN_LOG4J:
-               str_dom = str_log4j;
-               break;
-       case LTTNG_DOMAIN_PYTHON:
-               str_dom = str_python;
-               break;
-       default:
-               /* Should not have an unknown domain or else define it. */
-               assert(0);
-       }
-
-       return str_dom;
-}
-
 const char *get_event_type_str(enum lttng_event_type type)
 {
        const char *str_event_type;
index 97fb202ba3f15b3924a1d1dd483331c8ce2b3b94..ba893eddae1dd116a1fc4da9cbc5755ca0369795 100644 (file)
@@ -45,7 +45,6 @@ int get_count_order_u64(uint64_t x);
  */
 int get_count_order_ulong(unsigned long x);
 
-const char *get_domain_str(enum lttng_domain_type domain);
 const char *get_event_type_str(enum lttng_event_type event_type);
 
 int print_missing_or_multiple_domains(unsigned int domain_count,
index aaca5946c8dd0df3c9577b648e5410a7caa77677..663d38a7d20fe6326bd694972017112507c9b516 100644 (file)
@@ -710,7 +710,6 @@ const char *mi_lttng_eventfieldtype_string(enum lttng_event_field_type val)
 LTTNG_HIDDEN
 const char *mi_lttng_domaintype_string(enum lttng_domain_type value)
 {
-       /* Note: This is a *duplicate* of get_domain_str from bin/lttng/utils.c */
        switch (value) {
        case LTTNG_DOMAIN_KERNEL:
                return config_domain_type_kernel;
This page took 0.034585 seconds and 5 git commands to generate.