Compaq AA-RNG2A-TE Network Card User Manual


 
7 Casts the data argument to a data structure of type ifdevea for use
with the SIOCRPHYSADDR ioctl command.
8 Casts the data argument to a data structure of type ctrreq for use
with the SIOCRDCTRS and SIOCRDZCTRS ioctl commands.
9 Casts the data argument to a data structure of type ifchar for use
with the SIOCIFSETCHAR ioctl command.
10 Declares a lock_on variable and sets it to the value 1 (true), which
indicates that the simple lock is held. The el_ioctl( ) routine sets this
variable to the value 0 (false) when the simple lock is no longer in effect.
Declares a status variable and sets it to the constant ESUCCESS.
11 Declares an ifmtu variable that stores the requested MTU value for
the SIOCIPMTU command.
Declares a speed variable that stores the requested network speed
for the SIOCMACSPEED command.
12 Declares an mclist_buf buffer, which holds a character string. This
string is a list of all multicast addresses currently in use on the device.
12.2 Determining Whether the User Has Removed the
PCMCIA Card from the Slot
The following code shows how the el_ioctl( ) routine determines whether
the user has removed the PCMCIA card from the slot:
if (sc->cardout) return(EIO); 1
1 Examines the value of the cardout member of the el_softc data
structure for this device. If it is set to 1 (true), the user has removed
the PCMCIA card from the slot, and the driver returns the EIO error
constant to indicate an I/O error.
12.3 Setting the IPL and Obtaining the Simple Lock
The following code shows how the el_ioctl( ) routine sets the IPL and
obtains the simple lock:
s = splimp();
1
simple_lock(&sc->el_softc_lock); 2
1 Calls the splimp( ) routine to mask all LAN hardware interrupts.
On successful completion, splimp( ) stores an integer value in the s
variable that represents the CPU priority level that existed before the
call to splimp( ).
2 Calls the simple_lock( ) routine to assert a lock with exclusive access
for the resource that is associated with el_softc_lock. This means
that no other kernel thread can gain access to the locked resource until
Implementing the ioctl Section 123