RE: [PATCH v4] lib/string.c: implement a basic bcmp

From: David Laight
Date: Thu Mar 14 2019 - 05:56:31 EST


From: Nick Desaulniers
> Sent: 13 March 2019 21:14
...
> 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);
> #ifndef __HAVE_ARCH_MEMCMP
> extern int memcmp(const void *,const void *,__kernel_size_t);
> #endif
> +#ifndef __HAVE_ARCH_BCMP
> +extern int bcmp(const void *,const void *,__kernel_size_t);
> +#endif

Shouldn't that prototype always be present?
Any architecture specific implementation better have the same definition.
This is particularly true here since the compiler is going to assume
the default calling convention.

The only time you wouldn't want it is when the architecture specific
implementation is inline asm.
If that were an option the default implementation would need to be
excluded using a different #define.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)