lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200504133524.686c7be5@gandalf.local.home>
Date:   Mon, 4 May 2020 13:35:24 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
Cc:     linux-kernel@...r.kernel.org, linux-block@...r.kernel.org,
        linux-bcache@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
        Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH RFC 2/2] tracing/block: add request operation and flags
 into trace events

On Mon, 04 May 2020 18:16:21 +0300
Konstantin Khlebnikov <khlebnikov@...dex-team.ru> wrote:

> +/* Request operations, see enum req_opf */
> +
> +TRACE_DEFINE_ENUM(REQ_OP_READ);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE);
> +TRACE_DEFINE_ENUM(REQ_OP_FLUSH);
> +TRACE_DEFINE_ENUM(REQ_OP_DISCARD);
> +TRACE_DEFINE_ENUM(REQ_OP_SECURE_ERASE);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_RESET);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE_SAME);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_RESET_ALL);
> +TRACE_DEFINE_ENUM(REQ_OP_WRITE_ZEROES);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_OPEN);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_CLOSE);
> +TRACE_DEFINE_ENUM(REQ_OP_ZONE_FINISH);
> +TRACE_DEFINE_ENUM(REQ_OP_SCSI_IN);
> +TRACE_DEFINE_ENUM(REQ_OP_SCSI_OUT);
> +TRACE_DEFINE_ENUM(REQ_OP_DRV_IN);
> +TRACE_DEFINE_ENUM(REQ_OP_DRV_OUT);
> +
> +#define BLOCK_REQ_OP_STRINGS					\
> +	{ REQ_OP_READ,		"READ" },			\
> +	{ REQ_OP_WRITE,		"WRITE" },			\
> +	{ REQ_OP_FLUSH,		"FLUSH" },			\
> +	{ REQ_OP_DISCARD,	"DISCARD" },			\
> +	{ REQ_OP_SECURE_ERASE,	"SECURE_ERASE" },		\
> +	{ REQ_OP_ZONE_RESET,	"ZONE_RESET" },			\
> +	{ REQ_OP_WRITE_SAME,	"WRITE_SAME" },			\
> +	{ REQ_OP_ZONE_RESET_ALL,"ZONE_RESET_ALL" },		\
> +	{ REQ_OP_WRITE_ZEROES,	"WRITE_ZEROES" },		\
> +	{ REQ_OP_ZONE_OPEN,	"ZONE_OPEN" },			\
> +	{ REQ_OP_ZONE_CLOSE,	"ZONE_CLOSE" },			\
> +	{ REQ_OP_ZONE_FINISH,	"ZONE_FINISH" },		\
> +	{ REQ_OP_SCSI_IN,	"SCSI_IN" },			\
> +	{ REQ_OP_SCSI_OUT,	"SCSI_OUT" },			\
> +	{ REQ_OP_DRV_IN,	"DRV_IN" },			\
> +	{ REQ_OP_DRV_OUT,	"DRV_OUT" }
> +
> +#define show_block_req_op(req)					\
> +	__print_symbolic((req) & REQ_OP_MASK, BLOCK_REQ_OP_STRINGS)
> +

A common trick to avoid the duplication from above is to do this:

#define BLOCK_REQ_OP_STRINGS					\
	EM( REQ_OP_READ,	"READ" )			\
	EM( REQ_OP_WRITE,	"WRITE" )			\
	EM( REQ_OP_FLUSH,	"FLUSH" )			\
	EM( REQ_OP_DISCARD,	"DISCARD" )			\
	EM( REQ_OP_SECURE_ERASE, "SECURE_ERASE" )		\
	EM( REQ_OP_ZONE_RESET,	"ZONE_RESET" )			\
	EM( REQ_OP_WRITE_SAME,	"WRITE_SAME" )			\
	EM( REQ_OP_ZONE_RESET_ALL,"ZONE_RESET_ALL" )		\
	EM( REQ_OP_WRITE_ZEROES, "WRITE_ZEROES" )		\
	EM( REQ_OP_ZONE_OPEN,	"ZONE_OPEN" )			\
	EM( REQ_OP_ZONE_CLOSE,	"ZONE_CLOSE" )			\
	EM( REQ_OP_ZONE_FINISH,	"ZONE_FINISH" )			\
	EM( REQ_OP_SCSI_IN,	"SCSI_IN" )			\
	EM( REQ_OP_SCSI_OUT,	"SCSI_OUT" )			\
	EM( REQ_OP_DRV_IN,	"DRV_IN" )			\
	EMe( REQ_OP_DRV_OUT,	"DRV_OUT" )

#undef EM
#undef EMe

#define EM(a, b) TRACE_DEFINE_ENUM(a);
#define EMe(a, b) TRACE_DEFINE_ENUM(a);

BLOCK_REQ_OP_STRINGS

#undef EM
#undef EMe

#define EM(a, b) { a, b },
#define EMe(a, b)  { a , b }

#define show_block_req_op(req)
	__print_symbolic((req) & REQ_OP_MASK, BLOCK_REQ_OP_STRINGS)


Several other event files in include/trace/events do this.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ