Determining Whether The User Has Removed The Pcmcia; Setting The Ipl And Obtaining The Simple Lock; Card From The Slot - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

Casts the data argument to a data structure of type ifdevea for use
7
with the SIOCRPHYSADDR ioctl command.
Casts the data argument to a data structure of type ctrreq for use
8
with the SIOCRDCTRS and SIOCRDZCTRS ioctl commands.
Casts the data argument to a data structure of type ifchar for use
9
with the SIOCIFSETCHAR ioctl command.
Declares a lock_on variable and sets it to the value 1 (true), which
10
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.
Declares an ifmtu variable that stores the requested MTU value for
11
the SIOCIPMTU command.
Declares a speed variable that stores the requested network speed
for the SIOCMACSPEED command.
Declares an mclist_buf buffer, which holds a character string. This
12
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);
Examines the value of the cardout member of the el_softc data
1
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();
simple_lock(&sc->el_softc_lock);
Calls the splimp( ) routine to mask all LAN hardware interrupts.
1
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( ).
Calls the simple_lock( ) routine to assert a lock with exclusive access
2
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
1
1
2
Implementing the ioctl Section 12–3

Advertisement

Table of Contents
loading

Table of Contents