patch-2.1.29 linux/include/asm-sparc/string.h

Next file: linux/include/asm-sparc/termbits.h
Previous file: linux/include/asm-sparc/smp_lock.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.28/linux/include/asm-sparc/string.h linux/include/asm-sparc/string.h
@@ -1,8 +1,9 @@
-/* $Id: string.h,v 1.28 1997/01/15 16:01:54 jj Exp $
+/* $Id: string.h,v 1.30 1997/03/03 17:11:12 jj Exp $
  * string.h: External definitions for optimized assembly string
  *           routines for the Linux Kernel.
  *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  */
 
 #ifndef __SPARC_STRING_H__
@@ -10,22 +11,26 @@
 
 /* Really, userland/ksyms should not see any of this stuff. */
 
-#if defined(__KERNEL__) && !defined(EXPORT_SYMTAB)
+#ifdef __KERNEL__
+
+extern void __memmove(void *,const void *,__kernel_size_t);
+extern __kernel_size_t __memcpy(void *,const void *,__kernel_size_t);
+extern __kernel_size_t __memset(void *,int,__kernel_size_t);
+
+#ifndef EXPORT_SYMTAB
 
 /* First the mem*() things. */
 #define __HAVE_ARCH_BCOPY
 #define __HAVE_ARCH_MEMMOVE
-extern void __memmove(void *,const void *,__kernel_size_t);
-
 #undef memmove
 #define memmove(_to, _from, _n) \
 ({ \
-	__memmove(_to, _from, _n); \
-	_to; \
+	void *_t = (_to); \
+	__memmove(_t, (_from), (_n)); \
+	_t; \
 })
 
 #define __HAVE_ARCH_MEMCPY
-extern void __memcpy(void *,const void *,__kernel_size_t);
 
 extern inline void *__constant_memcpy(void *to, const void *from, __kernel_size_t n)
 {
@@ -59,12 +64,11 @@
  __nonconstant_memcpy((t),(f),(n)))
 
 #define __HAVE_ARCH_MEMSET
-extern void *__memset(void *,int,__kernel_size_t);
 
-extern inline void *__constant_c_and_count_memset(void *s, char c, size_t count)
+extern inline void *__constant_c_and_count_memset(void *s, char c, __kernel_size_t count)
 {
 	extern void *bzero_1page(void *);
-	extern void *__bzero(void *, size_t);
+	extern __kernel_size_t __bzero(void *, __kernel_size_t);
 
 	if(!c) {
 		if(count == 4096)
@@ -77,9 +81,9 @@
 	return s;
 }
 
-extern inline void *__constant_c_memset(void *s, char c, size_t count)
+extern inline void *__constant_c_memset(void *s, char c, __kernel_size_t count)
 {
-	extern void *__bzero(void *, size_t);
+	extern __kernel_size_t __bzero(void *, __kernel_size_t);
 
 	if(!c)
 		__bzero(s, count);
@@ -88,12 +92,18 @@
 	return s;
 }
 
+extern inline void *__nonconstant_memset(void *s, char c, __kernel_size_t count)
+{
+	__memset(s, c, count);
+	return s;
+}
+
 #undef memset
 #define memset(s, c, count) \
 (__builtin_constant_p(c) ? (__builtin_constant_p(count) ? \
                             __constant_c_and_count_memset((s), (c), (count)) : \
                             __constant_c_memset((s), (c), (count))) \
-                         : __memset((s), (c), (count)))
+                          : __nonconstant_memset((s), (c), (count)))
 
 #define __HAVE_ARCH_MEMSCAN
 
@@ -181,7 +191,9 @@
 (__builtin_constant_p(__arg2) ?	\
  __constant_strncmp(__arg0, __arg1, __arg2) : \
  __strncmp(__arg0, __arg1, __arg2))
+ 
+#endif /* EXPORT_SYMTAB */
 
-#endif /* (__KERNEL__) && !(_KSYMS_INTERNEL) */
+#endif /* __KERNEL__ */
 
 #endif /* !(__SPARC_STRING_H__) */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov