]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] uml: fix hugest stack users
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Wed, 1 Feb 2006 11:06:25 +0000 (03:06 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 1 Feb 2006 16:53:22 +0000 (08:53 -0800)
The C99 initialization, with GCC's bad handling, for 6K wide structs (which
_aren't_ on the stack), is causing GCC to use 12K for these silly procs with 3
vars.  Workaround this.

Note that .name = { '\0' } translates to memset(->name, 0, '->name' size) - I verified
this with GCC's docs and a testprogram.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/um/drivers/slip_common.h
arch/um/drivers/slip_kern.c
arch/um/drivers/slirp_kern.c

index 2ae76d8f1be1ee594a74d54ea9a64c0f068803d9..d574e0a9dc13c307f7a78894a8f08713ff227817 100644 (file)
@@ -88,12 +88,13 @@ struct slip_proto {
        int esc;
 };
 
-#define SLIP_PROTO_INIT { \
-       .ibuf   = { '\0' }, \
-       .obuf   = { '\0' }, \
-        .more  = 0, \
-       .pos    = 0, \
-       .esc    = 0 \
+static inline void slip_proto_init(struct slip_proto * slip)
+{
+       memset(slip->ibuf, 0, sizeof(slip->ibuf));
+       memset(slip->obuf, 0, sizeof(slip->obuf));
+       slip->more = 0;
+       slip->pos = 0;
+       slip->esc = 0;
 }
 
 extern int slip_proto_read(int fd, void *buf, int len,
index 9a6f5c85f902ad997a11538a51c8015a99fb5209..a62f5ef445cfec0c06a266730d9e171dadb768fb 100644 (file)
@@ -21,13 +21,14 @@ void slip_init(struct net_device *dev, void *data)
 
        private = dev->priv;
        spri = (struct slip_data *) private->user;
-       *spri = ((struct slip_data)
-               { .name         = { '\0' },
-                 .addr         = NULL,
-                 .gate_addr    = init->gate_addr,
-                 .slave        = -1,
-                 .slip         = SLIP_PROTO_INIT,
-                 .dev          = dev });
+
+       memset(spri->name, 0, sizeof(spri->name));
+       spri->addr = NULL;
+       spri->gate_addr = init->gate_addr;
+       spri->slave = -1;
+       spri->dev = dev;
+
+       slip_proto_init(&spri->slip);
 
        dev->init = NULL;
        dev->header_cache_update = NULL;
index 9864d27afdbe22f27319042030116caef12f93d9..33d7982be5d3aebe901b993020eb1edfb2142c6d 100644 (file)
@@ -21,12 +21,13 @@ void slirp_init(struct net_device *dev, void *data)
 
        private = dev->priv;
        spri = (struct slirp_data *) private->user;
-       *spri = ((struct slirp_data)
-               { .argw         = init->argw,
-                 .pid          = -1,
-                 .slave        = -1,
-                 .slip         = SLIP_PROTO_INIT,
-                 .dev          = dev });
+
+       spri->argw = init->argw;
+       spri->pid = -1;
+       spri->slave = -1;
+       spri->dev = dev;
+
+       slip_proto_init(&spri->slip);
 
        dev->init = NULL;
        dev->hard_header_len = 0;