diff options
| -rw-r--r-- | include/linux/string.h | 3 | ||||
| -rw-r--r-- | lib/string.c | 20 |
2 files changed, 23 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h index 7927b875f80c..6ab0a6fa512e 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
| @@ -150,6 +150,9 @@ extern void * memscan(void *,int,__kernel_size_t); | |||
| 150 | #ifndef __HAVE_ARCH_MEMCMP | 150 | #ifndef __HAVE_ARCH_MEMCMP |
| 151 | extern int memcmp(const void *,const void *,__kernel_size_t); | 151 | extern int memcmp(const void *,const void *,__kernel_size_t); |
| 152 | #endif | 152 | #endif |
| 153 | #ifndef __HAVE_ARCH_BCMP | ||
| 154 | extern int bcmp(const void *,const void *,__kernel_size_t); | ||
| 155 | #endif | ||
| 153 | #ifndef __HAVE_ARCH_MEMCHR | 156 | #ifndef __HAVE_ARCH_MEMCHR |
| 154 | extern void * memchr(const void *,int,__kernel_size_t); | 157 | extern void * memchr(const void *,int,__kernel_size_t); |
| 155 | #endif | 158 | #endif |
diff --git a/lib/string.c b/lib/string.c index 38e4ca08e757..3ab861c1a857 100644 --- a/lib/string.c +++ b/lib/string.c | |||
| @@ -866,6 +866,26 @@ __visible int memcmp(const void *cs, const void *ct, size_t count) | |||
| 866 | EXPORT_SYMBOL(memcmp); | 866 | EXPORT_SYMBOL(memcmp); |
| 867 | #endif | 867 | #endif |
| 868 | 868 | ||
| 869 | #ifndef __HAVE_ARCH_BCMP | ||
| 870 | /** | ||
| 871 | * bcmp - returns 0 if and only if the buffers have identical contents. | ||
| 872 | * @a: pointer to first buffer. | ||
| 873 | * @b: pointer to second buffer. | ||
| 874 | * @len: size of buffers. | ||
| 875 | * | ||
| 876 | * The sign or magnitude of a non-zero return value has no particular | ||
| 877 | * meaning, and architectures may implement their own more efficient bcmp(). So | ||
| 878 | * while this particular implementation is a simple (tail) call to memcmp, do | ||
| 879 | * not rely on anything but whether the return value is zero or non-zero. | ||
| 880 | */ | ||
| 881 | #undef bcmp | ||
| 882 | int bcmp(const void *a, const void *b, size_t len) | ||
| 883 | { | ||
| 884 | return memcmp(a, b, len); | ||
| 885 | } | ||
| 886 | EXPORT_SYMBOL(bcmp); | ||
| 887 | #endif | ||
| 888 | |||
| 869 | #ifndef __HAVE_ARCH_MEMSCAN | 889 | #ifndef __HAVE_ARCH_MEMSCAN |
| 870 | /** | 890 | /** |
| 871 | * memscan - Find a character in an area of memory. | 891 | * memscan - Find a character in an area of memory. |
