tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Lockless IP input queue, the pktqueue interface



Darren Reed <darrenr%netbsd.org@localhost> wrote:
> > No, there is no need to expose the structure.  Even if there would be
> > another internal component using the structure(s) one should consider
> > accessors/mutators.  Even if that component would have a good reason
> > not to use accessors/mutators, the structure should be placed under
> > #ifdef __SUBSYSTEM_PRIVATE (and certainly #ifdef _KERNEL).  However,
> > I strongly discourage to start from the last step without having a
> > necessity first.
> > 
> > One of the main reasons why we ended up with our network stack being
> > such a mess is exactly this: the internal structures are exposed and
> > accessed all over the place, there is a lack of strict interfacing,
> > and the information hiding principle is not followed.
> 
> So if someone were to write a program to grovel through a crash dump
> or /dev/mem and print out these structures, how would they get the
> definition of it?

This is getting off-topic, but for the sake of wondering readers:

Serialize and export the structure, or create a wrapper structure used
for data transportation, or implement interface with accessors/mutators.
If you think that you should be able to fiddle with any structure in the
kernel (as it would be 1980s) then you are plain wrong (do I really need
to explain this?).

-- 
Mindaugas


Home | Main Index | Thread Index | Old Index