All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: rostedt@goodmis.org, linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 1/5] trace-cmd: Use a structure to describe a compression protocol
Date: Wed, 2 Mar 2022 08:03:07 +0100	[thread overview]
Message-ID: <Yh8Wq4KAGJ6WtqKc@breakpoint.cc> (raw)
In-Reply-To: <20220302045131.387658-2-tz.stoyanov@gmail.com>

On 2022-03-02 06:51:27 [+0200], Tzvetomir Stoyanov (VMware) wrote:
> Changed the tracecmd_compress_proto_register() function to use a
> structure instead of list of arguments to describe new compression
> protocol. That approach is more flexible and allows to extend the API in
> the future without changing the already implemented protocols.
> 
> Suggested-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>

Thank you.

Acked-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>

> index a697cc61..8b9758c9 100644
> --- a/lib/trace-cmd/trace-compress-zlib.c
> +++ b/lib/trace-cmd/trace-compress-zlib.c
> @@ -103,7 +103,16 @@ static bool zlib_is_supported(const char *name, const char *version)
>  
>  int tracecmd_zlib_init(void)
>  {
> -	return tracecmd_compress_proto_register(__ZLIB_NAME, zlibVersion(), __ZLIB_WEIGTH,
> -						zlib_compress, zlib_decompress,
> -						zlib_compress_bound, zlib_is_supported);
> +	struct tracecmd_compression_proto proto;
> +
> +	memset(&proto, 0, sizeof(proto));
> +	proto.name = __ZLIB_NAME;
> +	proto.version = zlibVersion();
> +	proto.weight = __ZLIB_WEIGTH;
> +	proto.compress = zlib_compress;
> +	proto.uncompress = zlib_decompress;
> +	proto.is_supported = zlib_is_supported;
> +	proto.compress_size = zlib_compress_bound;

	struct tracecmd_compression_proto proto = {
		.name = __ZLIB_NAME,
		.version = zlibVersion(),
		.weight = __ZLIB_WEIGTH,
		.compress = zlib_compress,
		.uncompress = zlib_decompress,
		.is_supported = zlib_is_supported,
		.compress_size = zlib_compress_bound,
	}

this way to initialize ensures that members which are not explicitly
touched are set to 0. And you don't have to type proto that often ;)

> +
> +	return tracecmd_compress_proto_register(&proto);
>  }

Sebastian

  reply	other threads:[~2022-03-02  7:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02  4:51 [PATCH 0/5] trace-cmd: Improvements in compression logic Tzvetomir Stoyanov (VMware)
2022-03-02  4:51 ` [PATCH 1/5] trace-cmd: Use a structure to describe a compression protocol Tzvetomir Stoyanov (VMware)
2022-03-02  7:03   ` Sebastian Andrzej Siewior [this message]
2022-03-02  4:51 ` [PATCH 2/5] trace-cmd: Make internal compression hooks more generic Tzvetomir Stoyanov (VMware)
2022-03-02  7:08   ` Sebastian Andrzej Siewior
2022-03-02  4:51 ` [PATCH 3/5] trace-cmd: Use errno from zlib, if available Tzvetomir Stoyanov (VMware)
2022-03-02  7:15   ` Sebastian Andrzej Siewior
2022-03-02 15:52     ` Steven Rostedt
2022-03-03  7:09       ` Sebastian Andrzej Siewior
2022-03-02  4:51 ` [PATCH 4/5] trace-cmd: Add context to compression hooks Tzvetomir Stoyanov (VMware)
2022-03-02  7:13   ` Sebastian Andrzej Siewior
2022-03-03  1:10   ` Steven Rostedt
2022-03-03 16:33     ` Tzvetomir Stoyanov
2022-03-02  4:51 ` [PATCH 5/5] trace-cmd: Use context hooks in zstd Tzvetomir Stoyanov (VMware)
2022-03-02  7:13   ` Sebastian Andrzej Siewior

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=Yh8Wq4KAGJ6WtqKc@breakpoint.cc \
    --to=sebastian@breakpoint.cc \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.