From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 10/10] trace-cmd library: Remove deprecated APIs for creating an output handler
Date: Fri, 8 Oct 2021 07:13:21 +0300 [thread overview]
Message-ID: <20211008041321.973755-11-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20211008041321.973755-1-tz.stoyanov@gmail.com>
With the introduction of the new output handler creation flow, some of
the old APIs are not used any more. Removed unused APIs:
tracecmd_create_init_file_glob()
tracecmd_create_init_fd_glob()
tracecmd_create_init_fd_msg()
tracecmd_create_init_file_override()
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
.../include/private/trace-cmd-private.h | 12 +-
lib/trace-cmd/trace-output.c | 165 ------------------
2 files changed, 1 insertion(+), 176 deletions(-)
diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
index 086e6906..167f3804 100644
--- a/lib/trace-cmd/include/private/trace-cmd-private.h
+++ b/lib/trace-cmd/include/private/trace-cmd-private.h
@@ -280,19 +280,9 @@ int tracecmd_output_write_headers(struct tracecmd_output *handler,
struct tracecmd_event_list *list);
struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, int cpus);
-struct tracecmd_output *
-tracecmd_create_init_file_glob(const char *output_file,
- struct tracecmd_event_list *list);
struct tracecmd_output *tracecmd_create_init_fd(int fd);
-struct tracecmd_output *
-tracecmd_create_init_fd_glob(int fd, struct tracecmd_event_list *list);
-struct tracecmd_output *
-tracecmd_create_init_fd_msg(struct tracecmd_msg_handle *msg_handle,
- struct tracecmd_event_list *list);
+
struct tracecmd_output *tracecmd_create_init_file(const char *output_file);
-struct tracecmd_output *tracecmd_create_init_file_override(const char *output_file,
- const char *tracing_dir,
- const char *kallsyms);
struct tracecmd_option *tracecmd_add_option(struct tracecmd_output *handle,
unsigned short id, int size,
const void *data);
diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
index 9ea85b1c..27f296dd 100644
--- a/lib/trace-cmd/trace-output.c
+++ b/lib/trace-cmd/trace-output.c
@@ -31,11 +31,6 @@
typedef unsigned long long tsize_t;
typedef long long stsize_t;
-static struct tracecmd_event_list all_event_list = {
- .next = NULL,
- .glob = "all"
-};
-
struct tracecmd_option {
unsigned short id;
int size;
@@ -1119,139 +1114,6 @@ int tracecmd_output_write_headers(struct tracecmd_output *handler,
return 0;
}
-static int select_file_version(struct tracecmd_output *handle,
- struct tracecmd_input *ihandle)
-{
- if (ihandle)
- handle->file_version = tracecmd_get_in_file_version(ihandle);
- else
- handle->file_version = FILE_VERSION;
-
- return 0;
-}
-
-static struct tracecmd_output *
-create_file_fd(int fd, struct tracecmd_input *ihandle,
- const char *tracing_dir,
- const char *kallsyms,
- struct tracecmd_event_list *list,
- struct tracecmd_msg_handle *msg_handle)
-{
- struct tracecmd_output *handle;
- struct tep_handle *pevent;
- char buf[BUFSIZ];
- int endian4;
-
- handle = malloc(sizeof(*handle));
- if (!handle)
- return NULL;
- memset(handle, 0, sizeof(*handle));
-
- list_head_init(&handle->options);
-
- handle->fd = fd;
- if (tracing_dir) {
- handle->tracing_dir = strdup(tracing_dir);
- if (!handle->tracing_dir)
- goto out_free;
- }
-
- handle->msg_handle = msg_handle;
-
- if (select_file_version(handle, ihandle))
- goto out_free;
-
- buf[0] = 23;
- buf[1] = 8;
- buf[2] = 68;
- memcpy(buf + 3, "tracing", 7);
-
- if (do_write_check(handle, buf, 10))
- goto out_free;
-
- sprintf(buf, "%lu", handle->file_version);
- if (do_write_check(handle, buf, strlen(buf) + 1))
- goto out_free;
-
- /* get endian and page size */
- if (ihandle) {
- pevent = tracecmd_get_tep(ihandle);
- /* Use the pevent of the ihandle for later writes */
- handle->pevent = tracecmd_get_tep(ihandle);
- tep_ref(pevent);
- if (tep_is_file_bigendian(pevent))
- buf[0] = 1;
- else
- buf[0] = 0;
- handle->page_size = tracecmd_page_size(ihandle);
- } else {
- if (tracecmd_host_bigendian())
- buf[0] = 1;
- else
- buf[0] = 0;
- handle->page_size = getpagesize();
- }
-
- if (do_write_check(handle, buf, 1))
- goto out_free;
-
- /* save size of long (this may not be what the kernel is) */
- buf[0] = sizeof(long);
- if (do_write_check(handle, buf, 1))
- goto out_free;
-
- endian4 = convert_endian_4(handle, handle->page_size);
- if (do_write_check(handle, &endian4, 4))
- goto out_free;
- handle->file_state = TRACECMD_FILE_INIT;
-
- if (ihandle)
- return handle;
-
- if (read_header_files(handle))
- goto out_free;
-
- if (read_ftrace_files(handle))
- goto out_free;
-
- if (read_event_files(handle, list))
- goto out_free;
-
- if (read_proc_kallsyms(handle))
- goto out_free;
-
- if (read_ftrace_printk(handle))
- goto out_free;
-
- return handle;
-
- out_free:
- tracecmd_output_close(handle);
- return NULL;
-}
-
-static struct tracecmd_output *create_file(const char *output_file,
- struct tracecmd_input *ihandle,
- const char *tracing_dir,
- const char *kallsyms,
- struct tracecmd_event_list *list)
-{
- struct tracecmd_output *handle;
- int fd;
-
- fd = open(output_file, O_RDWR | O_CREAT | O_TRUNC | O_LARGEFILE, 0644);
- if (fd < 0)
- return NULL;
-
- handle = create_file_fd(fd, ihandle, tracing_dir, kallsyms, list, NULL);
- if (!handle) {
- close(fd);
- unlink(output_file);
- }
-
- return handle;
-}
-
/**
* tracecmd_add_option_v - add options to the file
* @handle: the output file handle name
@@ -1825,26 +1687,6 @@ error:
return NULL;
}
-struct tracecmd_output *
-tracecmd_create_init_fd_msg(struct tracecmd_msg_handle *msg_handle,
- struct tracecmd_event_list *list)
-{
- return create_file_fd(msg_handle->fd, NULL, NULL, NULL, list, msg_handle);
-}
-
-struct tracecmd_output *
-tracecmd_create_init_fd_glob(int fd, struct tracecmd_event_list *list)
-{
- return create_file_fd(fd, NULL, NULL, NULL, list, NULL);
-}
-
-struct tracecmd_output *
-tracecmd_create_init_file_glob(const char *output_file,
- struct tracecmd_event_list *list)
-{
- return create_file(output_file, NULL, NULL, NULL, list);
-}
-
struct tracecmd_output *tracecmd_create_init_file(const char *output_file)
{
struct tracecmd_output *handle;
@@ -1863,13 +1705,6 @@ struct tracecmd_output *tracecmd_create_init_file(const char *output_file)
return handle;
}
-struct tracecmd_output *tracecmd_create_init_file_override(const char *output_file,
- const char *tracing_dir,
- const char *kallsyms)
-{
- return create_file(output_file, NULL, tracing_dir, kallsyms, &all_event_list);
-}
-
/**
* tracecmd_copy - copy the headers of one trace.dat file for another
* @ihandle: input handle of the trace.dat file to copy
--
2.31.1
prev parent reply other threads:[~2021-10-08 4:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-08 4:13 [PATCH 00/10] Refactor APIs for creating output handler Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 01/10] trace-cmd library: New API for allocating an " Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 02/10] trace-cmd library: New API for setting a message context to " Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 03/10] trace-cmd library: New API for setting a custom trace directory " Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 04/10] trace-cmd library: New API for setting a custom kallsyms " Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 05/10] trace-cmd library: New API to inherit parameters from an existing trace file Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 06/10] trace-cmd library: New API tracecmd_output_write_init Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 07/10] trace-cmd library: New API to write headers of a trace file Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 08/10] trace-cmd library: Use the new flow when creating output handler Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` [PATCH 09/10] trace-cmd: " Tzvetomir Stoyanov (VMware)
2021-10-08 4:13 ` Tzvetomir Stoyanov (VMware) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211008041321.973755-11-tz.stoyanov@gmail.com \
--to=tz.stoyanov@gmail.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).