Re: where did memset go?

From: Jakub Jelinek (jakub@redhat.com)
Date: Wed Feb 02 2000 - 07:11:28 EST


On Wed, Feb 02, 2000 at 12:34:25PM +0100, Jeroen Massar wrote:
>
>
> On Wed, 2 Feb 2000, Jakub Jelinek wrote:
>
> > On Wed, Feb 02, 2000 at 11:32:13AM +0100, Jeroen Massar wrote:
> > >
> > >
> > > On 31 Jan 2000, Miquel van Smoorenburg wrote:
> > >
> >
> > Did you
> > #include <linux/string.h>
> > ?
>
> Ehmmm 3 letters: Yep
>
> Ofcourse I did.... it did work for 2.2.10 and earlier, something in
> 2.2.10+ simply has changed or I did something otherwise wrong which
> broke... ?
>
> It compiles 100% correctly, it doesn't link though on insmod....
> (Works now... as I've include the memset routine i the same .c file...)
>
> Check the diff here: http://unfix.org/projects/changer/ page for the last
> diff...
>
> Any other suggestions are welcome :)

Ok then. The issue is that gcc generates internally that memset for the
local structure assignment. You can workaround it by doing what the patchlet
sais. I think this is a bug in gcc because it normally expands memcpy/memset
internally on i386.
But I wonder why i386 does not export memcpy/memset for such cases, IMHO it
should.
But the patch below gives you more efficient code anyway.

--- changer.c Wed Feb 2 12:53:09 2000
+++ changer.c Wed Feb 2 12:59:33 2000
@@ -932,11 +932,13 @@ static void __init changer_cleanup(void)
         unregister_blkdev(MAJOR_NR,c_short);
 }
 
+static struct cdrom_device_info fake_cdi __initdata = {&changer_dops,0,0,0,0,0,0,0,0,0,"ChangerFake"};
+
 /* Test if all OK (Called at boot/module-init time). */
 static int __init changer_init(void)
 {
         int minor=0,result=0,ret,slot,i;
- struct cdrom_device_info fake_cdi = {&changer_dops,0,0,0,0,0,0,0,0,0,"ChangerFake"},*cdi;
+ struct cdrom_device_info *cdi;
         struct changer_set set = {CHANGER_VERSION_SET,sizeof(struct changer_set),0,0,0,""};
 
         DEBUG(LEVEL_FUNC,"changer_init()\n");

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jakub@redhat.com | http://sunsite.mff.cuni.cz/~jj
Linux version 2.3.41 on a sparc64 machine (1343.49 BogoMips)
___________________________________________________________________

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



This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 21:00:07 EST