| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2009, Steven Rostedt <srostedt@redhat.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 8 | | - * the Free Software Foundation; version 2 of the License (not later!) |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | | - * |
|---|
| 19 | | - * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 20 | 4 | */ |
|---|
| 21 | 5 | #include <dirent.h> |
|---|
| 22 | 6 | #include <stdio.h> |
|---|
| .. | .. |
|---|
| 31 | 15 | #include <unistd.h> |
|---|
| 32 | 16 | #include <errno.h> |
|---|
| 33 | 17 | |
|---|
| 34 | | -#include "../perf.h" |
|---|
| 35 | | -#include "util.h" |
|---|
| 36 | 18 | #include "trace-event.h" |
|---|
| 37 | 19 | #include "debug.h" |
|---|
| 38 | 20 | |
|---|
| .. | .. |
|---|
| 93 | 75 | r = size > BUFSIZ ? BUFSIZ : size; |
|---|
| 94 | 76 | do_read(buf, r); |
|---|
| 95 | 77 | size -= r; |
|---|
| 96 | | - }; |
|---|
| 78 | + } |
|---|
| 97 | 79 | } |
|---|
| 98 | 80 | |
|---|
| 99 | 81 | static unsigned int read4(struct tep_handle *pevent) |
|---|
| .. | .. |
|---|
| 102 | 84 | |
|---|
| 103 | 85 | if (do_read(&data, 4) < 0) |
|---|
| 104 | 86 | return 0; |
|---|
| 105 | | - return __data2host4(pevent, data); |
|---|
| 87 | + return tep_read_number(pevent, &data, 4); |
|---|
| 106 | 88 | } |
|---|
| 107 | 89 | |
|---|
| 108 | 90 | static unsigned long long read8(struct tep_handle *pevent) |
|---|
| .. | .. |
|---|
| 111 | 93 | |
|---|
| 112 | 94 | if (do_read(&data, 8) < 0) |
|---|
| 113 | 95 | return 0; |
|---|
| 114 | | - return __data2host8(pevent, data); |
|---|
| 96 | + return tep_read_number(pevent, &data, 8); |
|---|
| 115 | 97 | } |
|---|
| 116 | 98 | |
|---|
| 117 | 99 | static char *read_string(void) |
|---|
| .. | .. |
|---|
| 241 | 223 | * The commit field in the page is of type long, |
|---|
| 242 | 224 | * use that instead, since it represents the kernel. |
|---|
| 243 | 225 | */ |
|---|
| 244 | | - tep_set_long_size(pevent, pevent->header_page_size_size); |
|---|
| 226 | + tep_set_long_size(pevent, tep_get_header_page_size(pevent)); |
|---|
| 245 | 227 | } |
|---|
| 246 | 228 | free(header_page); |
|---|
| 247 | 229 | |
|---|
| .. | .. |
|---|
| 297 | 279 | } |
|---|
| 298 | 280 | |
|---|
| 299 | 281 | ret = do_read(buf, size); |
|---|
| 300 | | - if (ret < 0) { |
|---|
| 301 | | - free(buf); |
|---|
| 282 | + if (ret < 0) |
|---|
| 302 | 283 | goto out; |
|---|
| 303 | | - } |
|---|
| 304 | 284 | |
|---|
| 305 | 285 | ret = parse_event_file(pevent, buf, size, sys); |
|---|
| 306 | 286 | if (ret < 0) |
|---|
| .. | .. |
|---|
| 445 | 425 | |
|---|
| 446 | 426 | tep_set_flag(pevent, TEP_NSEC_OUTPUT); |
|---|
| 447 | 427 | tep_set_file_bigendian(pevent, file_bigendian); |
|---|
| 448 | | - tep_set_host_bigendian(pevent, host_bigendian); |
|---|
| 428 | + tep_set_local_bigendian(pevent, host_bigendian); |
|---|
| 449 | 429 | |
|---|
| 450 | 430 | if (do_read(buf, 1) < 0) |
|---|
| 451 | 431 | goto out; |
|---|