All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/33] Printbufs
@ 2022-06-04 19:30 Kent Overstreet
  2022-06-04 19:30 ` [PATCH v3 01/33] lib/printbuf: New data structure for printing strings Kent Overstreet
                   ` (33 more replies)
  0 siblings, 34 replies; 48+ messages in thread
From: Kent Overstreet @ 2022-06-04 19:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Kent Overstreet, pmladek, rostedt

Printbufs, your new data structure for all your string-building and outputting
needs!

git repo: https://evilpiepirate.org/git/bcachefs.git/log/?h=printbuf_v3

Benefits:
 - Replaces passing & returning raw char * pointers and lengths in a ton of
   places, including especially vsprintf.c, with a much saner calling convention
 - New helpers which greatly simplify and cleanup aforementioned vsprintf.c
 - New standard calling convention/naming for pretty printers!
 - New printf format string - %pf(%p) - for calling pretty printers by passing
   them to sprintf instead of sticking them in vsprintf.c behind weird dispatch
   code
 - printbufs can auto-heap allocate! No need for statically sized buffers,
   unless you want to do that
 - Tabstops and indenting, for greatly improved formatting of multi-line output

...and probably more that I've forgotten to mention.

Changes since last patche:

New namespace prefixes:
-----------------------

We're not overloading pr_* anymore: any standard library code that outputs to a
printbuf should use the prt_ prefix. This is not for printbuf control code -
that uses the printbuf_ prefix; prt_ is just for things that print.

string_escape_mem():
--------------------

string_escape_mem() has now been properly converted to printbufs instead of just
adding a printbuf-style wrapper; the new printbuf helpers simplify that code
quite a bit.

hexdump:
--------

The hexdump code has been converted to printbuf and also reorganized and cleaned
up quite a bit, with better naming too. We now have
 - prt_hex_bytes(), for printing a few hex bytes, with optional grouping
 - prt_hex_line(), for printing a whole line of hex output with ascii characters
   at the end
 - prt_hex_dump(), for printing a whole multiline hex dump

Important behaviour change:

Previously, the hex dump code would _byte swap the output on little endian_.
Since this is not exactly standard behaviour for a hex dumper (binutils doesn't
do this), and is confusing as hell if you're trying to map byte offsets in
structs to your hex output, I've dropped it. Since we only use the hex dumper in
debug output, nothing should break, but to avoid confusion I've put this front
and center in the commit message for that patch.

tracing:
--------

This iteration of the patch series finally converts tracing to printbufs, which
is the last seq_buf user and that code is now also deleted. The tracing
conversion was pretty uneventful, not much to say here (except that it had its
own unique implementation of hex dumping with byte swabbing on little endian;
this is now replaced with just a call to prt_hex_bytes()).

Kent Overstreet (33):
  lib/printbuf: New data structure for printing strings
  lib/string_helpers: Convert string_escape_mem() to printbuf
  vsprintf: Convert to printbuf
  lib/hexdump: Convert to printbuf
  vsprintf: %pf(%p)
  lib/string_helpers: string_get_size() now returns characters wrote
  lib/printbuf: Heap allocation
  lib/printbuf: Tabstops, indenting
  lib/printbuf: Unit specifiers
  lib/pretty-printers: prt_string_option(), prt_bitflags()
  vsprintf: Improve number()
  vsprintf: prt_u64_minwidth(), prt_u64()
  test_printf: Drop requirement that sprintf not write past nul
  vsprintf: Start consolidating printf_spec handling
  vsprintf: Refactor resource_string()
  vsprintf: Refactor fourcc_string()
  vsprintf: Refactor ip_addr_string()
  vsprintf: Refactor mac_address_string()
  vsprintf: time_and_date() no longer takes printf_spec
  vsprintf: flags_string() no longer takes printf_spec
  vsprintf: Refactor device_node_string, fwnode_string
  vsprintf: Refactor hex_string, bitmap_string_list, bitmap_string
  Input/joystick/analog: Convert from seq_buf -> printbuf
  mm/memcontrol.c: Convert to printbuf
  clk: tegra: bpmp: Convert to printbuf
  tools/testing/nvdimm: Convert to printbuf
  powerpc: Convert to printbuf
  x86/resctrl: Convert to printbuf
  PCI/P2PDMA: Convert to printbuf
  tracing: trace_events_synth: Convert to printbuf
  d_path: prt_path()
  tracing: Convert to printbuf
  Delete seq_buf

 Documentation/core-api/printk-formats.rst |   22 +
 arch/powerpc/kernel/process.c             |   16 +-
 arch/powerpc/kernel/security.c            |   75 +-
 arch/powerpc/platforms/pseries/papr_scm.c |   34 +-
 arch/x86/kernel/cpu/resctrl/rdtgroup.c    |   16 +-
 drivers/clk/tegra/clk-bpmp.c              |   21 +-
 drivers/input/joystick/analog.c           |   23 +-
 drivers/pci/p2pdma.c                      |   17 +-
 fs/d_path.c                               |   34 +
 include/linux/dcache.h                    |    1 +
 include/linux/kernel.h                    |   12 +
 include/linux/pretty-printers.h           |   10 +
 include/linux/printbuf.h                  |  245 +++
 include/linux/seq_buf.h                   |  162 --
 include/linux/string.h                    |    5 +
 include/linux/string_helpers.h            |    8 +-
 include/linux/trace_events.h              |    2 +-
 include/linux/trace_seq.h                 |   14 +-
 kernel/trace/trace.c                      |   45 +-
 kernel/trace/trace_dynevent.c             |   34 +-
 kernel/trace/trace_events_filter.c        |    2 +-
 kernel/trace/trace_events_synth.c         |   32 +-
 kernel/trace/trace_functions_graph.c      |    6 +-
 kernel/trace/trace_kprobe.c               |    2 +-
 kernel/trace/trace_seq.c                  |  111 +-
 lib/Makefile                              |    4 +-
 lib/hexdump.c                             |  246 +--
 lib/pretty-printers.c                     |   59 +
 lib/printbuf.c                            |  252 +++
 lib/seq_buf.c                             |  397 -----
 lib/string_helpers.c                      |  141 +-
 lib/test_hexdump.c                        |   30 +-
 lib/test_printf.c                         |   26 +-
 lib/vsprintf.c                            | 1716 ++++++++++-----------
 mm/memcontrol.c                           |   68 +-
 tools/testing/nvdimm/test/ndtest.c        |   22 +-
 36 files changed, 1943 insertions(+), 1967 deletions(-)
 create mode 100644 include/linux/pretty-printers.h
 create mode 100644 include/linux/printbuf.h
 delete mode 100644 include/linux/seq_buf.h
 create mode 100644 lib/pretty-printers.c
 create mode 100644 lib/printbuf.c
 delete mode 100644 lib/seq_buf.c

-- 
2.36.0


^ permalink raw reply	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2022-06-17  8:59 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-04 19:30 [PATCH v3 00/33] Printbufs Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 01/33] lib/printbuf: New data structure for printing strings Kent Overstreet
2022-06-09 13:55   ` Petr Mladek
2022-06-04 19:30 ` [PATCH v3 02/33] lib/string_helpers: Convert string_escape_mem() to printbuf Kent Overstreet
2022-06-09 14:25   ` Petr Mladek
2022-06-09 17:53     ` Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 03/33] vsprintf: Convert " Kent Overstreet
2022-06-15  9:09   ` Rasmus Villemoes
2022-06-15 18:44     ` Kent Overstreet
2022-06-17  8:59       ` Rasmus Villemoes
2022-06-04 19:30 ` [PATCH v3 04/33] lib/hexdump: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 05/33] vsprintf: %pf(%p) Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 06/33] lib/string_helpers: string_get_size() now returns characters wrote Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 07/33] lib/printbuf: Heap allocation Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 08/33] lib/printbuf: Tabstops, indenting Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 09/33] lib/printbuf: Unit specifiers Kent Overstreet
2022-06-05  1:06   ` Joe Perches
2022-06-04 19:30 ` [PATCH v3 10/33] lib/pretty-printers: prt_string_option(), prt_bitflags() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 11/33] vsprintf: Improve number() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 12/33] vsprintf: prt_u64_minwidth(), prt_u64() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 13/33] test_printf: Drop requirement that sprintf not write past nul Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 14/33] vsprintf: Start consolidating printf_spec handling Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 15/33] vsprintf: Refactor resource_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 16/33] vsprintf: Refactor fourcc_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 17/33] vsprintf: Refactor ip_addr_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 18/33] vsprintf: Refactor mac_address_string() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 19/33] vsprintf: time_and_date() no longer takes printf_spec Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 20/33] vsprintf: flags_string() " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 21/33] vsprintf: Refactor device_node_string, fwnode_string Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 22/33] vsprintf: Refactor hex_string, bitmap_string_list, bitmap_string Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 23/33] Input/joystick/analog: Convert from seq_buf -> printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 24/33] mm/memcontrol.c: Convert to printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 25/33] clk: tegra: bpmp: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 26/33] tools/testing/nvdimm: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 27/33] powerpc: " Kent Overstreet
2022-06-04 19:30   ` Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 28/33] x86/resctrl: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 29/33] PCI/P2PDMA: " Kent Overstreet
2022-06-08 21:11   ` Bjorn Helgaas
2022-06-08 23:24     ` Kent Overstreet
2022-06-08 23:34       ` Logan Gunthorpe
2022-06-08 23:40       ` Bjorn Helgaas
2022-06-04 19:30 ` [PATCH v3 30/33] tracing: trace_events_synth: " Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 31/33] d_path: prt_path() Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 32/33] tracing: Convert to printbuf Kent Overstreet
2022-06-04 19:30 ` [PATCH v3 33/33] Delete seq_buf Kent Overstreet
2022-06-05 16:21 ` [PATCH v3 00/33] Printbufs Steven Rostedt
2022-06-05 17:55   ` Kent Overstreet

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.