Re: [patch] Space.c and -fwritable-strings

From: Linus Torvalds (torvalds@transmeta.com)
Date: Wed Apr 05 2000 - 11:14:33 EST


On Wed, 5 Apr 2000, Andrew Morton wrote:
>
> Tim and I come to you hand-in-hand with a patch to Space.c.
>
> It does the following:
>
> - Arranges for the eight "eth%d" and "tr%d" strings to be generated
> separately, rather than commoned up by the compiler.

Ok, I have an alternative approach that I think should be a lot cleaner
and that looks obviously correct. How about this one-liner patch instead:

include/linux/netdevice.h:

        struct net_device {
        ...
        - char *name;
        + char name[16];
        ...

The above gets rid of _all_ of the problems, and gets rid of the need to
use the silly PAD macros - both the writable-strings and the PAD macro are
only needed because this thing was misdesigned in the first place. Putting
the device name into the net_device thing just automagically makes both
things work correctly.

Sure, some drivers would have to be changed to do

        strcpy(dev->name, namelist[index]);

instead of doing the current

        dev->name = namelist[index];

but looking at at least one of the drivers (3c503.c), the whole and only
reason for the name games is _again_ that what 3c503.c really wanted in
the first place was really to have the name be done as an array rather
than as a pointer (so at least 3c503.c would be trivially cleaned up a bit
by that simple change too).

Comments? David?

                Linus

-
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 : Fri Apr 07 2000 - 21:00:14 EST