lkml.org 
[lkml]   [2000]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Re: test11-pre5
Date
karrde@callisto.yi.org (Dan Aloni) writes:
> Is there a special reason why dev->name is not a pointer?

One of the changes in 2.3 was to change dev->name from a pointer to the
char array. A little bit painful (in terms of the number of changes,
rather than the complexity).

The reason for this is that dev->name needs to be writeable, each instance
of dev->name must not be shared, and there needs to be at least IFNAMSIZ
bytes allocated.

The problem that first triggered the change was that gcc was sharing
all instances of "eth%d", so there was a problem with multiple adaptors
referenced from the same source file.

It just happens that the kernel does not implement read-only strings
(as userspace does), but it could do in the future. This would cause
problem if dev->name is a pointer.

Finally, looking through the many net drivers, many failed to reserve
IFNAMSIZ (currently 16) bytes. Some allocated 8, some 9, some 17.

--
`O O' | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 12:45    [from the cache]
©2003-2011 Jasper Spaans