From: Miquel Raynal <miquel.raynal@bootlin.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Steven Rostedt <rostedt@goodmis.org>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Jonathan Corbet <corbet@lwn.net>,
John Ogness <john.ogness@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] hexdump: Allow skipping identical lines
Date: Mon, 20 Jan 2025 10:29:27 +0100 [thread overview]
Message-ID: <87wmepvnns.fsf@bootlin.com> (raw)
In-Reply-To: <20250117192522.0b2e7c65@pumpkin> (David Laight's message of "Fri, 17 Jan 2025 19:25:22 +0000")
Hello David & Petr,
On 17/01/2025 at 19:25:22 GMT, David Laight <david.laight.linux@gmail.com> wrote:
> On Fri, 17 Jan 2025 17:27:26 +0100
> Petr Mladek <pmladek@suse.com> wrote:
>
> ...
>> IMHO, it is perfectly fine to add support for skipping identical lines
>> only to print_hex_dump(). And I would go even further and replace
>>
>> void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
>> int rowsize, int groupsize,
>> const void *buf, size_t len, bool ascii)
>>
>> with
>>
>> void print_hex_dump(const char *level, const char *prefix_str,
>> enum hex_dump_type,
>> int rowsize, int groupsize,
>> const void *buf, size_t len)
>>
>> and combine all the flags into the one enum:
>>
>> enum hex_dump_type {
>> DUMP_HEX_ONLY = 0,
>> DUMP_HEX_AND_ASCII = BIT(1),
>> DUMP_PREFIX_ADDRESS = BIT(2),
>> DUMP_PREFIX_OFFSET = BIT(3),
>> DUMP_SKIP_IDENTICAL_LINES = BIT(4),
>> };
Would a single enum (in the prototype of the function) work? I like the
idea but we need some kind of OR combination to be supported, typically:
DUMP_HEX_AND_ASCII | DUMP_PREFIX_OFFSET | DUMP_SKIP_IDENTICAL_LINES
Maybe something like:
void print_hex(const char *level, const char *prefix_str,
int rowsize, int groupsize,
const void *buf, size_t len,
unsigned int dump_flags) // flags instead of enum?
enum hex_dump_flags {
// I'm not sure what to do with the default value?
DUMP_ASCII = BIT(0), // renamed?
DUMP_PREFIX_ADDRESS = BIT(1),
DUMP_PREFIX_OFFSET = BIT(2),
DUMP_SKIP_IDENTICAL_LINES = BIT(3),
};
>> How does that sound, please?
>
> Rename it as (say) print_hex() and add wrappers for the existing callers?
That would avoid the treewide changes, so yes I can try that, definitely.
Thanks,
Miquèl
next prev parent reply other threads:[~2025-01-20 9:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 18:42 [PATCH v2 0/2] hexdump: Allow skipping identical lines Miquel Raynal
2025-01-10 18:42 ` [PATCH v2 1/2] hexdump: Convert the ascii boolean into a flag variable Miquel Raynal
2025-01-10 18:42 ` [PATCH v2 2/2] hexdump: Allow skipping identical lines Miquel Raynal
2025-01-10 19:39 ` David Laight
2025-01-11 9:54 ` Miquel Raynal
2025-01-11 12:10 ` David Laight
2025-01-13 10:04 ` Andy Shevchenko
2025-01-11 5:36 ` Randy Dunlap
2025-01-13 12:35 ` Andy Shevchenko
2025-01-17 16:27 ` Petr Mladek
2025-01-17 19:25 ` David Laight
2025-01-20 9:29 ` Miquel Raynal [this message]
2025-01-20 10:25 ` Petr Mladek
2025-01-13 12:40 ` [PATCH v2 0/2] " Andy Shevchenko
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=87wmepvnns.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=corbet@lwn.net \
--cc=david.laight.linux@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=thomas.petazzoni@bootlin.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.