The device Structure in Detail
The device
structure is at the very core of network drivers
and deserves a complete description. At a first reading, however, you
can skip this section, because you don’t need a thorough understanding of
the structure to get started. This list describes all the fields,
but more to provide a reference rather than to be memorized.
The rest of this chapter briefly describes each field as soon
as it is used in the sample code, so you don’t need to keep referring back to
this section.
struct device
can be conceptually divided into two parts:
``visible'' and ``invisible.'' The visible part of the
structure is made up of the fields that are explicitly assigned in
static device
structures, like the two items appearing in
snull and shown above. The remaining fields are used
internally. Some are accessed by drivers (for example, the
ones that are assigned at initialization time), while some shouldn’t be
touched. This section is complete up to kernel version 2.0.30.
The Visible Head
The first part of struct device
is composed of the following
fields, in this order:
-
char *name;
The name of the device. If the first character of the name is zero (the
NUL
character) or a blank, register_netdev assigns it the nameeth
n
, with a suitable numeric n.-
unsigned long rmem_end;
,unsigned long rmem_start;
,unsigned long mem_end;
,unsigned long mem_start;
These fields hold the beginning and ending addresses of the shared memory used by the device. If the device has ...
Get Linux Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.