X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fdisable_channels.cpp;fp=src%2Fbin%2Flttng%2Fcommands%2Fdisable_channels.cpp;h=8bc9861f93a4a2fcd495887e4b173b8eedd983c4;hp=ff9bd91c8e818d91ebf0c42877474545befbb048;hb=28ab034a2c3582d07d3423d2d746731f87d3969f;hpb=52e345b9ac912d033c2a2c25a170a01cf209839d diff --git a/src/bin/lttng/commands/disable_channels.cpp b/src/bin/lttng/commands/disable_channels.cpp index ff9bd91c8..8bc9861f9 100644 --- a/src/bin/lttng/commands/disable_channels.cpp +++ b/src/bin/lttng/commands/disable_channels.cpp @@ -6,6 +6,12 @@ */ #define _LGPL_SOURCE +#include "../command.hpp" + +#include + +#include + #include #include #include @@ -14,11 +20,6 @@ #include #include -#include -#include - -#include "../command.hpp" - static int opt_kernel; static char *opt_session_name; static int opt_userspace; @@ -26,7 +27,7 @@ static int opt_userspace; #ifdef LTTNG_EMBED_HELP static const char help_msg[] = #include -; + ; #endif enum { @@ -40,16 +41,15 @@ static struct mi_writer *writer; static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ - {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, - {"session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0}, - {"kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0}, - {"userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0}, - {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, - {0, 0, 0, 0, 0, 0, 0} + { "help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0 }, + { "session", 's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0 }, + { "kernel", 'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0 }, + { "userspace", 'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0 }, + { "list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL }, + { 0, 0, 0, 0, 0, 0, 0 } }; -static int mi_partial_channel_print(char *channel_name, unsigned int enabled, - int success) +static int mi_partial_channel_print(char *channel_name, unsigned int enabled, int success) { int ret; @@ -63,22 +63,19 @@ static int mi_partial_channel_print(char *channel_name, unsigned int enabled, } /* Name */ - ret = mi_lttng_writer_write_element_string(writer, config_element_name, - channel_name); + ret = mi_lttng_writer_write_element_string(writer, config_element_name, channel_name); if (ret) { goto end; } /* Enabled ? */ - ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, - enabled); + ret = mi_lttng_writer_write_element_bool(writer, config_element_enabled, enabled); if (ret) { goto end; } /* Success ? */ - ret = mi_lttng_writer_write_element_bool(writer, - mi_lttng_element_success, success); + ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_success, success); if (ret) { goto end; } @@ -128,7 +125,6 @@ static int disable_channels(char *session_name, char *channel_list) ret = CMD_ERROR; goto error; } - } /* Strip channel list */ @@ -138,8 +134,10 @@ static int disable_channels(char *session_name, char *channel_list) ret = lttng_disable_channel(handle, channel_name); if (ret < 0) { - ERR("Channel %s: %s (session %s)", channel_name, - lttng_strerror(ret), session_name); + ERR("Channel %s: %s (session %s)", + channel_name, + lttng_strerror(ret), + session_name); warn = 1; /* @@ -154,8 +152,9 @@ static int disable_channels(char *session_name, char *channel_list) } else { MSG("%s channel %s disabled for session %s", - lttng_domain_type_str(dom.type), - channel_name, session_name); + lttng_domain_type_str(dom.type), + channel_name, + session_name); enabled = 0; success = 1; } @@ -230,8 +229,7 @@ int cmd_disable_channels(int argc, const char **argv) } } - ret = print_missing_or_multiple_domains( - opt_kernel + opt_userspace, false); + ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace, false); if (ret) { ret = CMD_ERROR; goto end; @@ -278,15 +276,14 @@ int cmd_disable_channels(int argc, const char **argv) /* Open command element */ ret = mi_lttng_writer_command_open(writer, - mi_lttng_element_command_disable_channel); + mi_lttng_element_command_disable_channel); if (ret) { ret = CMD_ERROR; goto end; } /* Open output element */ - ret = mi_lttng_writer_open_element(writer, - mi_lttng_element_command_output); + ret = mi_lttng_writer_open_element(writer, mi_lttng_element_command_output); if (ret) { ret = CMD_ERROR; goto end; @@ -308,8 +305,7 @@ int cmd_disable_channels(int argc, const char **argv) } /* Success ? */ - ret = mi_lttng_writer_write_element_bool(writer, - mi_lttng_element_success, success); + ret = mi_lttng_writer_write_element_bool(writer, mi_lttng_element_success, success); if (ret) { ret = CMD_ERROR; goto end;