[PATCH 0/8] membuff: Add tests and update to support a flag for empty/full

Simon Glass sjg at chromium.org
Fri Oct 18 05:00:19 CEST 2024


The membuff implementation curently has no tests. It also assumes that
head and tail can never correspond unless the buffer is empty.

This series provides a compile-time flag to support a 'full' flag. It
also adds some tests of the main routines.

The data structure is also renamed to membuf which fits better with
U-Boot.

There may be some cases in the code which could be optimised a little,
but the implementation is functional.


Simon Glass (8):
  membuff: Rename functions to have membuf_ prefix
  membuff: Rename the files to membuf
  membuf: Rename struct
  membuf: Include stdbool
  membuf: Correct implementation of membuf_dispose()
  membuf: Add some tests
  membuf: Minor code-style improvements
  membuf: Support a flag for being full

 MAINTAINERS                       |   7 +
 arch/sandbox/include/asm/serial.h |   2 +-
 boot/bootmeth_extlinux.c          |   8 +-
 common/console.c                  |  32 ++--
 drivers/serial/sandbox.c          |  10 +-
 drivers/usb/emul/sandbox_keyb.c   |   8 +-
 include/asm-generic/global_data.h |   6 +-
 include/{membuff.h => membuf.h}   |  98 ++++++------
 lib/Makefile                      |   2 +-
 lib/{membuff.c => membuf.c}       | 134 ++++++++++------
 test/lib/Makefile                 |   1 +
 test/lib/membuf.c                 | 244 ++++++++++++++++++++++++++++++
 12 files changed, 427 insertions(+), 125 deletions(-)
 rename include/{membuff.h => membuf.h} (67%)
 rename lib/{membuff.c => membuf.c} (69%)
 create mode 100644 test/lib/membuf.c

-- 
2.34.1



More information about the U-Boot mailing list