lkml.org 
[lkml]   [2000]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [patch] 2.3.99-pre3-3: dev_alloc_name
On Mon, 20 Mar 2000, Jeff Garzik wrote:

> This is not correct, Linus please don't apply.

I think it is, Jeff. Try this patch:

Index: net/core/dev.c
===================================================================
RCS file: /usr/local/src/cvsroot/linux/net/core/dev.c,v
retrieving revision 1.1.1.18
diff -d -u -r1.1.1.18 dev.c
--- net/core/dev.c 2000/03/03 11:16:06 1.1.1.18
+++ net/core/dev.c 2000/03/21 10:26:38
@@ -358,7 +358,15 @@
for (i = 0; i < 100; i++) {
sprintf(buf,name,i);
if (__dev_get_by_name(buf) == NULL) {
+ printk (KERN_DEBUG "this name: %s\n", dev->name);
+ if (dev->next)
+ printk (KERN_DEBUG
+ "next name: %s\n", dev->next->name);
strcpy(dev->name, buf);
+ printk (KERN_DEBUG "this name: %s\n", dev->name);
+ if (dev->next)
+ printk (KERN_DEBUG
+ "next name: %s\n", dev->next->name);
return i;
}
}
With egcs-2.91.66 I get this:

this name: eth%d
next name: eth%d
this name: eth0
next name: eth0

I.e. the string literals in Space.c that look like "eth%d" are all in the
same place. Replacing 'strcpy(dev->name, buf)' with 'dev->name = strdup
(buf)' obviously gives the correct output:

this name: eth%d
next name: eth%d
this name: eth0
next name: eth%d

The next thing to fix is actually putting the command-line ether=
parameters _somewhere_. My plan for that is to assume that the user is
correct, and then to just count from the first '...%d' that we find in
dev_base. Does that sound right?

Tim.
*/



-
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/

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