Skip to content

retire bcmp, a redundant wrapper around memcmp

Mateusz Guzik lkml llvm oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/callthunks: s/bcmp/memcmp/arch/x86/kernel/callthunks.c+3 -30 replies
2/2string: retire bcmp()arch/x86/boot/string.c arch/x86/boot/string.h include/linux/string.h +2 more+1 -334 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] retire bcmp, a redundant wrapper around memcmp

Reasoning copied from patch 2:

Quoted 11 lines

While architectures could override it thanks to __HAVE_ARCH_BCMP, none of them did. Instead it was implemented as a call to memcmp().

These routines differ in the API contract: memcmp()'s result indicates which way the difference goes (making it usable for sorting), whereas bcmp()'s result merely states whether the buffers differ in any way.

This means that a dedicated optimized bcmp() is cheaper to execute than memcmp() for differing buffers as there is no need to compute the return value.

Quoted 5 lines

However, per the above nobody bothered to write one and it is unclear if it makes sense to do it.

Users which really want to compare stuff may want to handle it differently (like e.g., the path lookup).

Mateusz Guzik (2):
x86/callthunks: s/bcmp/memcmp/
string: retire bcmp()

 arch/x86/boot/string.c       |  8 --------
 arch/x86/boot/string.h       |  1 -
 arch/x86/kernel/callthunks.c |  6 +++---
 include/linux/string.h       |  3 ---
 lib/Makefile                 |  3 +--
 lib/string.c                 | 19 -------------------
 6 files changed, 4 insertions(+), 36 deletions(-)
Signature · 1 line
2.43.0