4
Declares a pointer to the external
task_t
data structure called
first_task
. The
task_t
data structure is an opaque data structure;
that is, all of its associated members are referenced and manipulated by
the Tru64 UNIX operating system and not by the user of kernel threads.
Every kernel thread must be part of a task.
The
if_el
driver’s
el_probe
interface uses this data structure when
it creates a kernel thread.
1.2.2 Declaring softc and controller Data Structure Arrays
The following code shows the declarations for the
el_softc
and
controller
data structure arrays. The system uses these arrays to find out
which
softc
and
controller
data structures are associated with a specific
3Com 3C5x9 device. The driver’s
el_probe
interface initializes these arrays
if the probe operation is successful.
The arrays of
el_softc
and
controller
data structures need to be static
for the
if_el
device driver. Be aware that static arrays fix the maximum
number of devices that the user can configure on the system.
#define
el_MAXDEV 7
1
static struct el_softc *el_softc[el_MAXDEV]={0};
2
static struct controller *el_info[el_MAXDEV]={0};
3
static int el_isa_tag = 0;
4
static int el_isa_reset = 0;
5
decl_simple_lock_info(static, el_lock_info);
6
1
Defines a constant called
el_MAXDEV
, which allocates data structures
that the
if_el
device driver needs. A maximum of seven instances of
the 3C5x9 controller can be on the system. This means that
el_MAXDEV
is the maximum number of controllers that the
if_el
driver can
support. This is a small number of instances of the driver, and the data
structures themselves are not large, so it is acceptable to allocate for the
maximum configuration.
2
Declares an array of pointers to
el_softc
data structures and calls it
el_softc
. The
el_MAXDEV
constant specifies the size of this array.
3
Declares an array of pointers to
controller
data structures and calls
it
el_info
. The
el_MAXDEV
constant specifies the size of this array.
4
Declares a variable called
el_isa_tag
and initializes it to the value
0 (zero). The
if_el
driver’s
el_isa_activate
interface uses this
variable.
5
Declares a variable called
el_isa_reset
and initializes it to the value
0 (zero). The
if_el
driver’s
el_probe
interface uses this variable.
6
Uses the
decl_simple_lock_info( )
routine to declare a simple lock
data structure called
el_lock_info
.
1–6 Network Device Driver Environment