nic_create_dev

In working on a network driver (for Neutrino), I came across a possible
error situation. I cannot tell (without source or documentation) what
the nic_create_dev() function acually does. Of course, I can guess that
it allocates a Nic_t structure and an ext structure, and links them
together. What I do not know, is how much of the Nic_t structure it
fills in, and with what contents. This becomes more important, when I
look at the pcnet example driver. In this driver, the pcnet_args_t
structure has its own Nic_t structure as an element, and that one has had
some values (I am guessing) filled in by calling nic_drvr_options().
The Nic_t structure in the pcneet_args_t has not had nic_create_dev()
called to initialize it in any way, only nic_drvr_options().
Then later, in pcnet_init_start_driver, the Nic_t structure allocated by
nic_create_dev() has the Nic_t structure from pcnet_args_t copied over
top of it with a memcpy(). If the nic_create_dev() filled in any fields
at all of the Nic_t, they have just been wiped out by the memcpy()!
Is this a bug? Is nic_create_dev() so close to a no-op routine that it
does not fill in any important fields of the Nic_t structure at all?
Note that the link to the ext structure is re-created in the code, but
nothing else. Is this all there is to nic_create_dev()??

Stephen Munnings
Software Developer
Corman Technologies Inc.

Stephen Munnings <steve@cormantech.com> wrote:
: In working on a network driver (for Neutrino), I came across a possible
: error situation. I cannot tell (without source or documentation) what
: the nic_create_dev() function acually does. Of course, I can guess that
: it allocates a Nic_t structure and an ext structure, and links them
: together. What I do not know, is how much of the Nic_t structure it
: fills in, and with what contents. This becomes more important, when I
: look at the pcnet example driver. In this driver, the pcnet_args_t
: structure has its own Nic_t structure as an element, and that one has had
: some values (I am guessing) filled in by calling nic_drvr_options().
: The Nic_t structure in the pcneet_args_t has not had nic_create_dev()
: called to initialize it in any way, only nic_drvr_options().
: Then later, in pcnet_init_start_driver, the Nic_t structure allocated by
: nic_create_dev() has the Nic_t structure from pcnet_args_t copied over
: top of it with a memcpy(). If the nic_create_dev() filled in any fields
: at all of the Nic_t, they have just been wiped out by the memcpy()!
: Is this a bug? Is nic_create_dev() so close to a no-op routine that it
: does not fill in any important fields of the Nic_t structure at all?
: Note that the link to the ext structure is re-created in the code, but
: nothing else. Is this all there is to nic_create_dev()??

Yes. Basically two callocs().

-seanb