linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH v5 04/25] trace-cmd library: Add internal helper function for writing headers before file sections
Date: Wed, 24 Nov 2021 14:15:03 -0500	[thread overview]
Message-ID: <20211124141503.6fae3366@gandalf.local.home> (raw)
In-Reply-To: <20211111150900.86585-1-tz.stoyanov@gmail.com>

On Thu, 11 Nov 2021 17:09:00 +0200
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> Introduce headers before each file section, in trace file version 7. The
> section header has the following format:
>  <2 bytes>, header ID
>  <string>, null terminated ASCII string, description of the header
>  <2 bytes>, section flags:
>      1: the section is compressed
>  <4 bytes>, size of the section
> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  include/trace-cmd/trace-cmd.h                 |  5 ++
>  .../include/private/trace-cmd-private.h       |  1 +
>  lib/trace-cmd/include/trace-cmd-local.h       |  5 ++
>  lib/trace-cmd/trace-output.c                  | 68 +++++++++++++++++++
>  4 files changed, 79 insertions(+)
> 
> diff --git a/include/trace-cmd/trace-cmd.h b/include/trace-cmd/trace-cmd.h
> index 7fea4e01..5d71e8ba 100644
> --- a/include/trace-cmd/trace-cmd.h
> +++ b/include/trace-cmd/trace-cmd.h
> @@ -15,6 +15,11 @@ enum tracecmd_open_flags {
>  	TRACECMD_FL_LOAD_NO_PLUGINS		= 1 << 0, /* Do not load plugins */
>  	TRACECMD_FL_LOAD_NO_SYSTEM_PLUGINS	= 1 << 1, /* Do not load system plugins */
>  };
> +
> +enum tracecmd_section_flags {
> +	TRACECMD_SEC_FL_COMPRESS	= 1 << 0, /* the section is compressed */
> +};
> +
>  struct tracecmd_input *tracecmd_open_head(const char *file, int flags);
>  struct tracecmd_input *tracecmd_open(const char *file, int flags);
>  struct tracecmd_input *tracecmd_open_fd(int fd, int flags);
> diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
> index eaa902a3..5b253511 100644
> --- a/lib/trace-cmd/include/private/trace-cmd-private.h
> +++ b/lib/trace-cmd/include/private/trace-cmd-private.h
> @@ -138,6 +138,7 @@ enum {
>  	TRACECMD_OPTION_TIME_SHIFT,
>  	TRACECMD_OPTION_GUEST,
>  	TRACECMD_OPTION_TSC2NSEC,
> +	TRACECMD_OPTION_MAX,
>  };
>  
>  enum {
> diff --git a/lib/trace-cmd/include/trace-cmd-local.h b/lib/trace-cmd/include/trace-cmd-local.h
> index d65ff599..d3760483 100644
> --- a/lib/trace-cmd/include/trace-cmd-local.h
> +++ b/lib/trace-cmd/include/trace-cmd-local.h
> @@ -37,6 +37,11 @@ struct data_file_write {
>  bool check_file_state(unsigned long file_version, int current_state, int new_state);
>  bool check_out_state(struct tracecmd_output *handle, int new_state);
>  
> +unsigned long long
> +out_write_section_header(struct tracecmd_output *handle, unsigned short header_id,
> +			 char *description, enum tracecmd_section_flags flags, bool option);

Unless you expect only a single flag to ever be passed in, flags cannot be
of type enum. Because two enums or'd together is not a valid enum.

-- Steve


> +int out_update_section_header(struct tracecmd_output *handle, unsigned long long offset);
> +
>  struct cpu_data_source {
>  	int fd;
>  	int size;
> diff --git a/lib/trace-cmd/trace-output.c b/lib/trace-cmd/trace-output.c
> index e8c788ad..a8c1305d 100644
> --- a/lib/trace-cmd/trace-output.c
> +++ b/lib/trace-cmd/trace-output.c
> @@ -332,6 +332,74 @@ int tracecmd_ftrace_enable(int set)
>  	return ret;
>  }
>  
> +__hidden unsigned long long
> +out_write_section_header(struct tracecmd_output *handle, unsigned short header_id,
> +			 char *description, enum tracecmd_section_flags flags, bool option)
> +{

  reply	other threads:[~2021-11-24 19:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-11 15:09 [PATCH v5 04/25] trace-cmd library: Add internal helper function for writing headers before file sections Tzvetomir Stoyanov (VMware)
2021-11-24 19:15 ` Steven Rostedt [this message]
2021-12-04  1:35 ` Steven Rostedt
2021-12-06  3:25   ` Tzvetomir Stoyanov
2021-12-06 14:55     ` Steven Rostedt
2021-12-06 15:52       ` Tzvetomir Stoyanov
2021-12-06 16:27         ` Steven Rostedt

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=20211124141503.6fae3366@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=tz.stoyanov@gmail.com \
    /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).