6.5 Printing a Success Message
The following code shows how the el_attach( ) routine prints a success message:
printf("el%d: %s, hardware address: %s\n", unit,
1
1Calls the printf( ) routine to display the following information message on the console terminal:
•The controller number that is stored in the unit variable.
•The version of the network interface that is stored in the if_version member of the ifnet data structure pointer.
•The hardware address that is accessed through the is_addr member of the el_softc data structure for this device. The if_el device driver maps the ac_enaddr member of the arpcom data structure to the alternate name is_addr.
The argument list that is passed to printf( ) contains a call to the ether_sprintf( ) routine. The ether_sprintf( ) routine converts an Ethernet address to a printable ASCII string representation.
Make sure that your driver prints a similar message during its attach( ) routine.
6.6 Specifying the Network Driver Interfaces
The following code shows how the el_attach( ) routine specifies the network driver interfaces for the if_el driver:
3
mb();
5
7
8
1
2
Sets the if_ioctl member of the ifnet data structure for this device to el_ioctl, which is the if_el device driver’s ioctl interface.
Sets the if_watchdog member of the ifnet data structure for this device to el_watch, which is the if_el device driver’s watchdog interface.