On Sat, 11 Jan 2025 10:54:58 +0100 Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > Hi David, > > On 10/01/2025 at 19:39:30 GMT, David Laight <david.laight.linux@xxxxxxxxx> wrote: > > > On Fri, 10 Jan 2025 19:42:05 +0100 > > Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > > > >> When dumping long buffers (especially for debug purposes) it may be very > >> convenient to sometimes avoid spitting all the lines of the buffer if > >> the lines are identical. Typically on embedded devices, the console > >> would be wired to a UART running at 115200 bauds, which makes the dumps > >> very (very) slow. In this case, having a flag to avoid printing > >> duplicated lines is handy. > > ... > >> enum { > >> DUMP_FLAG_ASCII, > >> + DUMP_FLAG_SKIP_IDENTICAL_LINES, > >> }; > > ... > >> + if (flags & DUMP_FLAG_SKIP_IDENTICAL_LINES) { > > > > > > That doesn't look right to me. > > You want: > > enum { > > DUMP_FLAG_HEX_ONLY = false, > > DUMP_FLAG_ASCII = true, > > DUMP_FLAG_SKIP_IDENTICAL_LINES = BIT(1), > > }; > > > > and maybe you can get away with not changing all the other files. > > I'm a bit sad all the time spent on these changes will go to trash :), > they kind of looked "nicer", but for sure this approach would be > transparent. I can definitely try that. The only way the big patch would ever get applied is if Linus himself decided it was a good idea and 'just applied it'. Otherwise it needs an ack from all the maintainers. The other way to avoid having to change all the files is to rename the function and add a compile-time wrapper for the old users. So you'd end up with (something like): #define hexdump(args, ascii) hexdump_new(args, ascii ? DUMP_FLAG_ASCII : DUMP_FLAG_HEX_ONLY) But in this case you might be away with binary compatibility. David