From: Philippe Proulx Date: Thu, 5 Oct 2017 04:15:23 +0000 (-0400) Subject: sink.text.dmesg: remove `read-from-stdin` parameter, use absent `path` X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=4da23e31de8e5fb7ede781e047295bd9ded4e5a9 sink.text.dmesg: remove `read-from-stdin` parameter, use absent `path` We don't need separate `path` and `read-from-stdin` parameters for this component class: if `path` is absent, read from standard input. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/cli/babeltrace-log.c b/cli/babeltrace-log.c index 2ff48ca6..9037dd93 100644 --- a/cli/babeltrace-log.c +++ b/cli/babeltrace-log.c @@ -122,8 +122,6 @@ int main(int argc, char *argv[]) "--component", "dmesg:src.text.dmesg", "--params", - "read-from-stdin=yes", - "--params", NULL, /* no-extract-timestamp=? placeholder */ "--component", "ctf:sink.ctf.fs", @@ -144,12 +142,12 @@ int main(int argc, char *argv[]) } if (no_extract_ts) { - bt_argv[7] = "no-extract-timestamp=yes"; + bt_argv[5] = "no-extract-timestamp=yes"; } else { - bt_argv[7] = "no-extract-timestamp=no"; + bt_argv[5] = "no-extract-timestamp=no"; } - bt_argv[13] = output_path; + bt_argv[11] = output_path; (void) g_spawn_sync(NULL, bt_argv, NULL, G_SPAWN_CHILD_INHERITS_STDIN, NULL, NULL, NULL, NULL, &retcode, &error); diff --git a/plugins/text/dmesg/dmesg.c b/plugins/text/dmesg/dmesg.c index f1a4324f..c126a15a 100644 --- a/plugins/text/dmesg/dmesg.c +++ b/plugins/text/dmesg/dmesg.c @@ -413,21 +413,6 @@ int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params) const char *path_str; int ret = 0; - read_from_stdin = bt_value_map_get(params, "read-from-stdin"); - if (read_from_stdin) { - if (!bt_value_is_bool(read_from_stdin)) { - BT_LOGE("Expecting a boolean value for the `read-from-stdin` parameter: " - "type=%s", - bt_value_type_string( - bt_value_get_type(read_from_stdin))); - goto error; - } - - ret = bt_value_bool_get(read_from_stdin, - &dmesg_comp->params.read_from_stdin); - assert(ret == 0); - } - no_timestamp = bt_value_map_get(params, "no-extract-timestamp"); if (no_timestamp) { if (!bt_value_is_bool(no_timestamp)) { @@ -462,10 +447,7 @@ int handle_params(struct dmesg_component *dmesg_comp, struct bt_value *params) assert(ret == 0); g_string_assign(dmesg_comp->params.path, path_str); } else { - if (!dmesg_comp->params.read_from_stdin) { - BT_LOGE_STR("Expecting `path` parameter or true `read-from-stdin` parameter."); - goto error; - } + dmesg_comp->params.read_from_stdin = true; } goto end;