aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/string_helpers.h
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2021-06-30 18:55:29 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2021-07-01 11:06:05 -0700
commit259fa5d7d825122c30ad4122c6a1cc937eb74c2d (patch)
treef0541cdb8220e81ddaacd4a5ba179b0becf43f55 /include/linux/string_helpers.h
parentlib/test-string_helpers: get rid of trailing comma in terminators (diff)
downloadlinux-dev-259fa5d7d825122c30ad4122c6a1cc937eb74c2d.tar.xz
linux-dev-259fa5d7d825122c30ad4122c6a1cc937eb74c2d.zip
lib/test-string_helpers: add test cases for new features
We have got new flags and hence new features of string_escape_mem(). Add test cases for that. Link: https://lkml.kernel.org/r/20210504180819.73127-10-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Chuck Lever <chuck.lever@oracle.com> Cc: "J. Bruce Fields" <bfields@fieldses.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/string_helpers.h')
-rw-r--r--include/linux/string_helpers.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index f8728ed4d563..9b0eca2badf2 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -26,6 +26,8 @@ void string_get_size(u64 size, u64 blk_size, enum string_size_units units,
#define UNESCAPE_ANY \
(UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
+#define UNESCAPE_ALL_MASK GENMASK(3, 0)
+
int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
static inline int string_unescape_inplace(char *buf, unsigned int flags)
@@ -56,6 +58,8 @@ static inline int string_unescape_any_inplace(char *buf)
#define ESCAPE_NAP BIT(7)
#define ESCAPE_APPEND BIT(8)
+#define ESCAPE_ALL_MASK GENMASK(8, 0)
+
int string_escape_mem(const char *src, size_t isz, char *dst, size_t osz,
unsigned int flags, const char *only);