Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys move the bcopy macro back to generating memcpy.



details:   https://anonhg.NetBSD.org/src/rev/6ecc3fa63c58
branches:  trunk
changeset: 512154:6ecc3fa63c58
user:      perry <perry%NetBSD.org@localhost>
date:      Sat Jul 07 04:14:43 2001 +0000

description:
move the bcopy macro back to generating memcpy.

Here is why:

kernel bcopy and userland bcopy semantics were never the same. bcopy
in the kernel did not traditionally handle overlap.
ovbcopy in the kernel was the traditional "overlapping bcopy".

Lets take a step back here. The point of the macros was to provide
legacy interfaces so we could transition to mem* without disrupting
large parts of the code still being repeatedly merged, like the KAME
merges in net*/. Having purged the last ovbcopy from the kernel,
replacing them all with memmove, we didn't need ovbcopy any more so we
didn't need a macro.

Now, by leaving bcopy as memcpy, we make it clear that if you are
purging bcopys, you should replace them with memcpys. If we used
memmoves everywhere, it would lose very painstaking optimizations made
in the original code during which the ovbcopy/bcopy distinction was
held. Making bcopy into memmove is BAD BAD BAD.

It has been argued we should add an ovbcopy->memmove macro, but that
is precisely what we do not want -- if someone needs ovbcopy, what
they really want to write memmove, not ovbcopy. We don't want NEW code
with ovbcopy, having laboriously gotten rid of it.

In fact, the bcopy/bzero/bcmps in the kernel should all be purged. We
held off on doing net*/ to make the kame merge easier, and similarly
held off on some other places, but the time has come.

Anyway, for all these reasons, bcopy is changed back to memcpy.

diffstat:

 sys/sys/systm.h |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 175a6bbac90c -r 6ecc3fa63c58 sys/sys/systm.h
--- a/sys/sys/systm.h   Sat Jul 07 02:37:34 2001 +0000
+++ b/sys/sys/systm.h   Sat Jul 07 04:14:43 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: systm.h,v 1.130 2001/07/06 15:59:23 perry Exp $        */
+/*     $NetBSD: systm.h,v 1.131 2001/07/07 04:14:43 perry Exp $        */
 
 /*-
  * Copyright (c) 1982, 1988, 1991, 1993
@@ -210,7 +210,7 @@
 
 int    kcopy __P((const void *, void *, size_t));
 
-#define bcopy(src, dst, len)   memmove((dst), (src), (len))
+#define bcopy(src, dst, len)   memcpy((dst), (src), (len))
 #define bzero(src, len)                memset((src), 0, (len))
 #define bcmp(a, b, len)                memcmp((a), (b), (len))
 



Home | Main Index | Thread Index | Old Index