RFC: remove bcopy()
There are very few places in the kernel which use bcopy() as of 2.5.40, and every single one of them #defines it to memcpy() [some argue this should be memmove(). i'm not terribly concerned]. There's also no declaration of the bcopy() function in the kernel headers. In light of this, would anyone object to a patch removing the definitions of bcopy from lib/string.c and arch/*/lib?
Signature · 1 line
Revolutions do not require corporate support.
Quoted 7 lines · Matthew Wilcox
There are very few places in the kernel which use
bcopy()as of 2.5.40, and every single one of them #defines it tomemcpy()[some argue this should bememmove(). i'm not terribly concerned]. There's also no declaration of thebcopy()function in the kernel headers. In light of this, would anyone object to a patch removing the definitions of bcopy fromlib/string.candarch/*/lib?
Please do. But please let the defines in XFS in place - this way the source stais compatible to the IRIX version.
Quoted 2 lines · Christoph Hellwig
Please do. But please let the defines in XFS in place - this way the source stais compatible to the IRIX version.
agreed, there's a good reason to keep it there, and in the SCSI drivers ported from BSD. i doubt there's a good reason to keep it in rio though.
Signature · 1 line
Revolutions do not require corporate support.
ok, here's the patch which removes the implementation of bcopy from all architectures and lib/string.c. i also change the one actual user of bcopy to use memcpy instead and remove a few prototypes. The __ARCH_HAS_BCOPY define is also gone.
Comments from arch maintainers?
arch/ia64/lib/memcpy_mck.S +0 -9
@@ -21,15 +21,6 @@ # define EK(y,x...) x #endif -GLOBAL_ENTRY(bcopy) - .regstk 3,0,0,0 - mov r8=in0 - mov in0=in1 - ;; - mov in1=r8 - ;; -END(bcopy) - /* McKinley specific optimization */ #define retval r8
arch/ia64/lib/memcpy.S +0 -16
@@ -15,22 +15,6 @@ */ #include <asm/asmmacro.h> -GLOBAL_ENTRY(bcopy) - .regstk 3,0,0,0 - mov r8=in0 - mov in0=in1 - ;; - mov in1=r8 - // gas doesn't handle control flow across procedures, so it doesn't - // realize that a stop bit is needed before the "alloc" instruction - // below -{ - nop.m 0 - nop.f 0 - nop.i 0 -} ;; -END(bcopy) - // FALL THROUGH GLOBAL_ENTRY(memcpy) # define MEM_LAT 21 /* latency to memory */
arch/ia64/sn/io/l1_command.c +0 -2
@@ -34,8 +34,6 @@#define LBYTE (caddr) (*(char *) caddr) -extern char *bcopy (const char * src,char * dest,int count); -#define LDEBUG 0/*
arch/ia64/sn/io/module.c +1 -3
@@ -173,7 +173,6 @@ int module_probe_snum(module_t *m, nasid {lboard_t *board;klmod_serial_num_t *comp; -char *bcopy (const char * src,char * dest,int count);char serial_number[16 ];/*
@@ -222,8 +221,7 @@ int module_probe_snum(module_t *m, nasid#endif if (comp->snum.snum_str[0 ] !='\0' ) { -bcopy (comp->snum.snum_str, - m->sys_snum, +memcpy (m->sys_snum, comp->snum.snum_str,MAX_SERIAL_NUM_SIZE ); m->sys_snum_valid =1 ; }
arch/ppc/boot/common/misc-common.c +0 -1
@@ -68,7 +68,6 @@ extern char _end[];void puts (const char *);void putc (const char c);void puthex (unsigned long val); -void _bcopy (char *src,char *dst,int len);void gunzip (void *,int ,unsigned char *,int *);static int _cvt (unsigned long val,char *buf,long radix,char *digits);
arch/ppc/lib/string.S +0 -6
@@ -208,12 +208,6 @@ _GLOBAL(memset) bdnz 8b blr -_GLOBAL(bcopy) - mr r6,r3 - mr r3,r4 - mr r4,r6 - b memcpy - /* * This version uses dcbz on the complete cache lines in the * destination area to reduce memory traffic. This requires that
arch/ppc64/boot/crt0.S +0 -7
@@ -159,13 +159,6 @@ memset: bdnz 8b blr - .globl bcopy -bcopy: - mr r6,r3 - mr r3,r4 - mr r4,r6 - b memcpy - .globl memmove memmove: cmplw 0,r3,r4
arch/sparc/kernel/sparc_ksyms.c +0 -2
@@ -71,7 +71,6 @@ extern int __memcmp(const void *, constextern int __strncmp (const char *,const char *,__kernel_size_t );extern char saved_command_line[]; -extern void bcopy (const char *,char *,int );extern int __ashrdi3 (int ,int );extern int __ashldi3 (int ,int );extern int __lshrdi3 (int ,int );
@@ -233,7 +232,6 @@ EXPORT_SYMBOL(__prom_getchild);EXPORT_SYMBOL (__prom_getsibling);/* sparc library symbols */ -EXPORT_SYMBOL (bcopy);EXPORT_SYMBOL_NOVERS (memscan);EXPORT_SYMBOL_NOVERS (strlen);EXPORT_SYMBOL (strnlen);
arch/sparc/lib/memcpy.S +2 -13
@@ -1,5 +1,5 @@ -/* memcpy.S: Sparc optimized memcpy, bcopy and memmove code - * Hand optimized from GNU libc's memcpy, bcopy and memmove +/* memcpy.S: Sparc optimized memcpy and memmove code + * Hand optimized from GNU libc's memcpy and memmove * Copyright (C) 1991,1996 Free Software Foundation * Copyright (C) 1995 Linus Torvalds ([email protected]) * Copyright (C) 1996 David S. Miller ([email protected])
@@ -190,17 +190,6 @@ C_LABEL(x): #endif /* FASTER_REVERSE */ -0: - retl - nop ! Only bcopy returns here and it retuns void... - -FUNC(bcopy) - mov %o0, %o3 - mov %o1, %o0 - mov %o3, %o1 - tst %o2 - bcs 0b - /* Do the cmp in the delay slot */ #ifdef __KERNEL__ FUNC(amemmove) FUNC(__memmove)
arch/sparc64/lib/VIScopy.S +1 -14
@@ -16,7 +16,7 @@ * is put in here just for this purpose. * * For userland, compiling this without __KERNEL__ defined makes - * it work just fine as a generic libc bcopy and memcpy. + * it work just fine as a generic libc memcpy. * If for userland it is compiled with a 32bit gcc (but you need * -Wa,-Av9a for as), the code will just rely on lower 32bits of * IEU registers, if you compile it with 64bit gcc (ie. define
@@ -300,9 +300,6 @@ .globl memcpy .type memcpy,@function - .globl bcopy - .type bcopy,@function - #ifdef __KERNEL__ .globl __memcpy_begin __memcpy_begin:
@@ -340,17 +337,7 @@ __copy_in_user: rd %asi, asi_src ! IE mov asi_src, asi_dest ! IEU1 retl ! CTI Group clr %o0 ! IEU0 Group -#endif - -bcopy: or %o0, 0, %g3 ! IEU0 Group - addcc %o1, 0, %o0 ! IEU1 - brgez,pt %o2, memcpy_private ! CTI - or %g3, 0, %o1 ! IEU0 Group - retl ! CTI Group brk forced - clr %o0 ! IEU0 - -#ifdef __KERNEL__ #define BRANCH_ALWAYS 0x10680000 #define NOP 0x01000000 #define ULTRA3_DO_PATCH(OLD, NEW) \
arch/sparc64/lib/VIS.h +1 -1
@@ -14,7 +14,7 @@* is put in here just for this purpose. * * For userland, compiling this without __KERNEL__ defined makes -* it work just fine as a generic libc bcopy and memcpy. +* it work just fine as a generic libc memcpy. * If for userland it is compiled with a 32bit gcc (but you need * -Wa,-Av9a), the code will just rely on lower 32bits of * IEU registers, if you compile it with 64bit gcc (ie. define
arch/x86_64/kernel/x8664_ksyms.c +0 -3
@@ -149,12 +149,10 @@ EXPORT_SYMBOL(rtc_lock);#undef strncpy#undef strchr#undef strcmp -#undef bcopy#undef strcpyextern void *memset (void *,int ,__kernel_size_t );extern size_t strlen (const char *); -extern char *bcopy (const char * src,char * dest,int count);extern void *memmove (void * dest,const void *src,size_t count);extern char *strcpy (char * dest,const char *src);extern int strcmp (const char * cs,const char * ct);
@@ -173,7 +171,6 @@ EXPORT_SYMBOL_NOVERS(memchr);EXPORT_SYMBOL_NOVERS (strrchr);EXPORT_SYMBOL_NOVERS (strnlen);EXPORT_SYMBOL_NOVERS (memscan); -EXPORT_SYMBOL_NOVERS (bcopy);EXPORT_SYMBOL (empty_zero_page);
include/asm-ia64/string.h +0 -1
@@ -14,7 +14,6 @@#define __HAVE_ARCH_STRLEN 1/* see arch/ia64/lib/strlen.S */ #define __HAVE_ARCH_MEMSET 1/* see arch/ia64/lib/memset.S */ #define __HAVE_ARCH_MEMCPY 1/* see arch/ia64/lib/memcpy.S */ -#define __HAVE_ARCH_BCOPY 1/* see arch/ia64/lib/memcpy.S */ extern __kernel_size_t strlen (const char *);extern void *memcpy (void *,const void *,__kernel_size_t );
include/asm-mips/string.h +0 -3
@@ -131,9 +131,6 @@ extern void *memcpy(void *__to, __const_#define __HAVE_ARCH_MEMMOVE extern void *memmove(void *__dest, __const__ void *__src, size_t __n); -/* Don't build bcopy at all ... */ -#define __HAVE_ARCH_BCOPY -#define __HAVE_ARCH_MEMSCANextern __inline__void *memscan (void *__addr,int __c,size_t __size) {
include/asm-mips64/string.h +0 -3
@@ -18,7 +18,4 @@ extern void *memcpy(void *__to, __const_#define __HAVE_ARCH_MEMMOVE extern void *memmove(void *__dest, __const__ void *__src, size_t __n); -/* Don't build bcopy at all ... */ -#define __HAVE_ARCH_BCOPY -#endif /* _ASM_STRING_H */
include/asm-ppc/string.h +0 -1
@@ -9,7 +9,6 @@#define __HAVE_ARCH_STRCMP#define __HAVE_ARCH_STRCAT#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_BCOPY#define __HAVE_ARCH_MEMCPY#define __HAVE_ARCH_MEMMOVE#define __HAVE_ARCH_MEMCMP
include/asm-ppc64/string.h +0 -1
@@ -14,7 +14,6 @@#define __HAVE_ARCH_STRCMP#define __HAVE_ARCH_STRCAT#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_BCOPY#define __HAVE_ARCH_MEMCPY#define __HAVE_ARCH_MEMMOVE#define __HAVE_ARCH_MEMCMP
include/asm-s390/string.h +0 -1
@@ -34,7 +34,6 @@#undef __HAVE_ARCH_STRSPN#undef __HAVE_ARCH_STRPBRK#undef __HAVE_ARCH_STRTOK -#undef __HAVE_ARCH_BCOPY#undef __HAVE_ARCH_MEMCMP#undef __HAVE_ARCH_MEMSCAN#undef __HAVE_ARCH_STRSTR
include/asm-s390x/string.h +0 -1
@@ -34,7 +34,6 @@#undef __HAVE_ARCH_STRSPN#undef __HAVE_ARCH_STRPBRK#undef __HAVE_ARCH_STRTOK -#undef __HAVE_ARCH_BCOPY#undef __HAVE_ARCH_MEMCMP#undef __HAVE_ARCH_MEMSCAN#undef __HAVE_ARCH_STRSTR
include/asm-sh/string.h +0 -3
@@ -124,7 +124,4 @@ extern void *memchr(const void *__s, int#define __HAVE_ARCH_STRLENextern size_t strlen (const char *); -/* Don't build bcopy at all ... */ -#define __HAVE_ARCH_BCOPY -#endif /* __ASM_SH_STRING_H */
include/asm-sparc/string.h +0 -1
@@ -22,7 +22,6 @@ extern __kernel_size_t __memset(void *,i#ifndef EXPORT_SYMTAB_STROPS /* First the mem*() things. */ -#define __HAVE_ARCH_BCOPY#define __HAVE_ARCH_MEMMOVE#undef memmove#define memmove (_to, _from, _n) \
include/asm-sparc64/string.h +0 -1
@@ -24,7 +24,6 @@ extern void *__builtin_memset(void *,int#ifndef EXPORT_SYMTAB_STROPS /* First the mem*() things. */ -#define __HAVE_ARCH_BCOPY#define __HAVE_ARCH_MEMMOVE#undef memmove
lib/string.c +0 -24
@@ -340,30 +340,6 @@ void * memset(void * s,int c,size_t coun }#endif -#ifndef __HAVE_ARCH_BCOPY -/** -* bcopy - Copy one area of memory to another -* @src: Where to copy from -* @dest: Where to copy to -* @count: The size of the area. -* -* Note that this is the same as memcpy(), with the arguments reversed. -* memcpy() is the standard, bcopy() is a legacy BSD function. -* -* You should not use this function to access IO space, use memcpy_toio() -* or memcpy_fromio() instead. -*/ -char *bcopy (const char * src,char * dest,int count) -{ -char *tmp = dest; - -while (count--) - *tmp++ = *src++; - -return dest; -} -#endif -#ifndef __HAVE_ARCH_MEMCPY/** * memcpy - Copy one area of memory to another
Signature · 1 line
Revolutions do not require corporate support.