printf_verbose("Converting from file: %s\n", opt_input_path);
printf_verbose("Converting from format: %s\n",
- opt_input_format ? : "<autodetect>");
+ opt_input_format ? : "ctf <default>");
printf_verbose("Converting to file: %s\n",
opt_output_path ? : "<stdout>");
printf_verbose("Converting to format: %s\n",
- opt_output_format ? : "ctf");
+ opt_output_format ? : "text <default>");
- if (!opt_input_format) {
- fprintf(stdout, "[error] Input format autodetection not implemented yet.\n\n");
- usage(stdout);
- exit(EXIT_FAILURE);
- }
+ if (!opt_input_format)
+ opt_input_format = "ctf";
+ if (!opt_output_format)
+ opt_output_format = "text";
fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format));
if (!fmt_read) {
fprintf(stdout, "[error] Format \"%s\" is not supported.\n\n",
goto error_td_read;
}
- if (!opt_output_path)
- opt_output_path = "/dev/stdout";
td_write = fmt_write->open_trace(opt_output_path, O_WRONLY);
if (!td_write) {
fprintf(stdout, "Error opening trace \"%s\" for writing.\n\n",
- opt_output_path);
+ opt_output_path ? : "<none>");
goto error_td_write;
}
return ret;
}
-static
-int ctf_open_trace_write(struct ctf_trace *td, const char *path, int flags)
-{
- int ret;
-
- ret = mkdir(path, S_IRWXU|S_IRWXG);
- if (ret)
- return ret;
-
- /* Open trace directory */
- td->dir = opendir(path);
- if (!td->dir) {
- fprintf(stdout, "[error] Unable to open trace directory.\n");
- ret = -ENOENT;
- goto error;
- }
-
-
- return 0;
-
-error:
- return ret;
-}
-
struct trace_descriptor *ctf_open_trace(const char *path, int flags)
{
struct ctf_trace *td;
switch (flags & O_ACCMODE) {
case O_RDONLY:
+ if (!path) {
+ fprintf(stdout, "[error] Path missing for input CTF trace.\n");
+ goto error;
+ }
ret = ctf_open_trace_read(td, path, flags);
if (ret)
goto error;
case O_WRONLY:
fprintf(stdout, "[error] Opening CTF traces for output is not supported yet.\n");
goto error;
-#if 0
- ret = ctf_open_trace_write(td, path, flags);
- if (ret)
- goto error;
-#endif //0
- break;
default:
fprintf(stdout, "[error] Incorrect open flags.\n");
goto error;