lib/string_helpers: Add flags param to string_get_size()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 29 Feb 2024 20:52:30 +0000 (22:52 +0200)
committerKees Cook <keescook@chromium.org>
Fri, 1 Mar 2024 06:34:42 +0000 (22:34 -0800)
commitf0b7f8ade9d2532a7d7da40eb297570d48dd2147
treed0492622843644492a64744db50a1ac2e58e83f1
parentaaa8736370db1a78f0e8434344a484f9fd20be3b
lib/string_helpers: Add flags param to string_get_size()

The new flags parameter allows controlling
 - Whether or not the units suffix is separated by a space, for
   compatibility with sort -h
 - Whether or not to append a B suffix - we're not always printing
   bytes.

Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Link: https://lore.kernel.org/r/20240229205345.93902-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/string_helpers.h
lib/string_helpers.c
lib/test-string_helpers.c