ether= breakage (was Re: [patch] 2.3.99-pre3-3: dev_alloc_name)

From: Tim Waugh (twaugh@redhat.com)
Date: Tue Mar 21 2000 - 06:01:32 EST


On Tue, 21 Mar 2000, Tim Waugh wrote:

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

To show what I mean with code, here's an untested patch to eth_setup.

Tim.
*/

Index: linux/net/ethernet/eth.c
diff -u linux/net/ethernet/eth.c:1.1.1.2 linux/net/ethernet/eth.c:1.2
--- linux/net/ethernet/eth.c:1.1.1.2 Mon Jan 24 10:17:56 2000
+++ linux/net/ethernet/eth.c Tue Mar 21 11:00:38 2000
@@ -64,16 +64,26 @@
 {
         int ints[5];
         struct net_device *d;
+ int namelen, n, count = 0;
 
         str = get_options(str, ARRAY_SIZE(ints), ints);
 
         if (!str || !*str)
                 return 0;
 
+ for (namelen = 0; str[namelen]; namelen++)
+ if (str[namelen] >= '0' &&
+ str[namelen] <= '9')
+ break;
+
+ n = simple_strtoul (str + namelen, NULL, 0);
+
         d = dev_base;
         while (d)
         {
- if (!strcmp(str,d->name))
+ if (!strcmp(str,d->name) /* exact match */
+ || (strchr(d->name, '%') /* format string */
+ && !strncmp(str, d->name, namelen) && n == count++))
                 {
                         if (ints[0] > 0)
                                 d->irq=ints[1];

-
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 : Thu Mar 23 2000 - 21:00:32 EST