Ignore:
Timestamp:
Mar 23, 1999, 10:39:13 PM (22 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
f1f42b4
Parents:
ca3fec49
Message:

Patch from Eric Norum <eric@…> to improve parsing of
network interface names. This change does not introduce any
compatibility problems.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/gen68360/network/network.c

    rca3fec49 rb6f5f93  
    853853        struct ifnet *ifp;
    854854        int mtu;
    855         int i;
    856 
    857         /*
    858          * Find a free driver
    859          */
    860         for (i = 0 ; i < NSCCDRIVER ; i++) {
    861                 sc = &scc_softc[i];
    862                 ifp = &sc->arpcom.ac_if;
    863                 if (ifp->if_softc == NULL)
    864                         break;
    865         }
    866         if (i >= NSCCDRIVER) {
    867                 printf ("Too many SCC drivers.\n");
     855        int unitNumber;
     856        char *unitName;
     857
     858        /*
     859         * Parse driver name
     860         */
     861        if ((unitNumber = rtems_bsdnet_parse_driver_name (config, &unitName)) < 0)
     862                return 0;
     863       
     864        /*
     865         * Is driver free?
     866         */
     867        if ((unitNumber <= 0) || (unitNumber > NSCCDRIVER)) {
     868                printf ("Bad SCC unit number.\n");
     869                return 0;
     870        }
     871        sc = &scc_softc[unitNumber - 1];
     872        ifp = &sc->arpcom.ac_if;
     873        if (ifp->if_softc != NULL) {
     874                printf ("Driver already in use.\n");
    868875                return 0;
    869876        }
     
    931938         */
    932939        ifp->if_softc = sc;
    933         ifp->if_unit = i + 1;
    934         ifp->if_name = "scc";
     940        ifp->if_unit = unitNumber;
     941        ifp->if_name = unitName;
    935942        ifp->if_mtu = mtu;
    936943        ifp->if_init = scc_init;
Note: See TracChangeset for help on using the changeset viewer.