X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=converter%2Fbabeltrace.c;h=83f300c5d9b2fa7635614fa477b173621f6a68b2;hp=b24d0102fba72a7428be2f642ab22082ec687caf;hb=05cab52530332c97aca9d8c78a8cae2f82f00896;hpb=41075e78197deaa9c7bbaf0f97482c513f497580 diff --git a/converter/babeltrace.c b/converter/babeltrace.c index b24d0102..83f300c5 100644 --- a/converter/babeltrace.c +++ b/converter/babeltrace.c @@ -16,6 +16,14 @@ * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. */ #define _GNU_SOURCE @@ -60,7 +68,7 @@ static char *opt_input_format, *opt_output_format; static GPtrArray *opt_input_paths; static char *opt_output_path; -static struct format *fmt_read; +static struct bt_format *fmt_read; static void strlower(char *str) @@ -101,7 +109,7 @@ enum { */ static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ - { "output", 'w', POPT_ARG_STRING, NULL, OPT_NONE, NULL, NULL }, + { "output", 'w', POPT_ARG_STRING, NULL, OPT_OUTPUT_PATH, NULL, NULL }, { "input-format", 'i', POPT_ARG_STRING, NULL, OPT_INPUT_FORMAT, NULL, NULL }, { "output-format", 'o', POPT_ARG_STRING, NULL, OPT_OUTPUT_FORMAT, NULL, NULL }, { "help", 'h', POPT_ARG_NONE, NULL, OPT_HELP, NULL, NULL }, @@ -196,7 +204,6 @@ static int get_names_args(poptContext *pc) opt_payload_field_names = 0; } else { fprintf(stderr, "[error] unknown field name type %s\n", str); - free(strlist); ret = -EINVAL; goto end; } @@ -453,13 +460,12 @@ static int traverse_trace_dir(const char *fpath, const struct stat *sb, */ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path, const char *format_str, - void (*packet_seek)(struct stream_pos *pos, + void (*packet_seek)(struct bt_stream_pos *pos, size_t offset, int whence)) { GArray *trace_ids; int ret = 0; - int i; /* Should lock traversed_paths mutex here if used in multithread */ @@ -470,6 +476,8 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path, /* Process the array if ntfw did not return a fatal error */ if (ret >= 0) { + int i; + for (i = 0; i < traversed_paths->len; i++) { GString *trace_path = g_ptr_array_index(traversed_paths, i); @@ -507,7 +515,7 @@ int bt_context_add_traces_recursive(struct bt_context *ctx, const char *path, return ret; } -int convert_trace(struct trace_descriptor *td_write, +int convert_trace(struct bt_trace_descriptor *td_write, struct bt_context *ctx) { struct bt_ctf_iter *iter; @@ -546,8 +554,8 @@ error_iter: int main(int argc, char **argv) { int ret, partial_error = 0, open_success = 0; - struct format *fmt_write; - struct trace_descriptor *td_write; + struct bt_format *fmt_write; + struct bt_trace_descriptor *td_write; struct bt_context *ctx; int i; @@ -598,7 +606,7 @@ int main(int argc, char **argv) } } fmt_read = bt_lookup_format(g_quark_from_static_string(opt_input_format)); - if (!fmt_read) { + if (!fmt_read || fmt_read->name != g_quark_from_static_string("ctf")) { fprintf(stderr, "[error] Format \"%s\" is not supported.\n\n", opt_input_format); partial_error = 1;