lkml.org 
[lkml]   [2004]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: struct_cpy() and kAFS (was: Re: Linux 2.6.8-rc1)
Christoph Hellwig <hch@infradead.org> wrote:
>
> struct_cpy is used nowehre except in arch/i386/kernel/process.c and AFS,
> so we should probably better kill it before people start using it in other
> places.

yup.

diff -puN arch/i386/kernel/process.c~remove-struct_cpy arch/i386/kernel/process.c
--- 25/arch/i386/kernel/process.c~remove-struct_cpy 2004-07-12 11:39:05.821241928 -0700
+++ 25-akpm/arch/i386/kernel/process.c 2004-07-12 11:39:38.202319256 -0700
@@ -355,7 +355,7 @@ int copy_thread(int nr, unsigned long cl
int err;

childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
- struct_cpy(childregs, regs);
+ *childregs = *regs;
childregs->eax = 0;
childregs->esp = esp;
p->set_child_tid = p->clear_child_tid = NULL;
diff -puN include/asm-x86_64/string.h~remove-struct_cpy include/asm-x86_64/string.h
--- 25/include/asm-x86_64/string.h~remove-struct_cpy 2004-07-12 11:39:05.862235696 -0700
+++ 25-akpm/include/asm-x86_64/string.h 2004-07-12 11:39:43.049582360 -0700
@@ -3,8 +3,6 @@

#ifdef __KERNEL__

-#define struct_cpy(x,y) (*(x)=*(y))
-
/* Written 2002 by Andi Kleen */

/* Only used for special circumstances. Stolen from i386/string.h */
diff -puN include/asm-i386/string.h~remove-struct_cpy include/asm-i386/string.h
--- 25/include/asm-i386/string.h~remove-struct_cpy 2004-07-12 11:39:05.885232200 -0700
+++ 25-akpm/include/asm-i386/string.h 2004-07-12 11:39:52.558136840 -0700
@@ -277,22 +277,6 @@ static __inline__ void *__memcpy3d(void

#endif

-/*
- * struct_cpy(x,y), copy structure *x into (matching structure) *y.
- *
- * We get link-time errors if the structure sizes do not match.
- * There is no runtime overhead, it's all optimized away at
- * compile time.
- */
-extern void __struct_cpy_bug (void);
-
-#define struct_cpy(x,y) \
-({ \
- if (sizeof(*(x)) != sizeof(*(y))) \
- __struct_cpy_bug(); \
- memcpy(x, y, sizeof(*(x))); \
-})
-
#define __HAVE_ARCH_MEMMOVE
void *memmove(void * dest,const void * src, size_t n);

_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.051 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site