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

Where should devctl notifications be sent from?



In message: <20040327085537_(_dot_)_GC33016_(_at_)_clan_(_dot_)_nothing-going-on_(_dot_)_org>
            Nik Clayton <nik_(_at_)_freebsd_(_dot_)_org> writes:
: The specific problem I'm trying to solve involves an iPod connected
: through firewire.  I'd like to be able to have devd be notified when the
: iPod arrives, so that various processes can kick off automatically.  In
: an ideal world, I'll drop the iPod in the dock, and some backup
: processes start, thereby allowing me to justify the purchase of a model
: several sizes larger than I actually need :-)
: 
: It looks like there are several places where the devctl_queue_data() and
: related calls could be placed:
: 
:     firewire(4) -- when the device is plugged in
:     fwohci(4) -- when the interface arrives
:     sbp(4) -- when it's recognised as a mass storage device

These are all inapprorpiate.  The devctl_queue_data is already called
from the bus level for these device.  Either there is a driver, in
which case a driver added is called, or there isn't, in which case the
no driver routine is called.

:     geom(4) -- when geom creates the device (/dev/da2 (and da2s2) in my
:                case).  Robert Watson has a patch that implements this.

These patches need some more work.  We need to get closure on how to
do notifications in different name spaces and Robert and I are working
on that.  This is likely the most appropriate place to deal in the
short term, however.

:     devfs -- specifically, in make_dev(9) and destroy_dev(9)

This is clearly wrong.  devd will soon grow the ability to do actions
based on files appearing in a directory tree.  Since /dev is a
directory tree, that will be a more appropriate way of dealing.  devd
does not know about dev_t things from the devctl interface, nor should
it in my opinion.  However, the tree stuff should be sufficiently
general to do what you need (and may obviate the need for robert's
patches, since geom name space is a subset of dev by convention).

: The limited research that I've done suggests that the most generic place
: to put this code is inside make_dev(9) and destroy_dev(9).  But this
: seems so trivial that I can't believe no one else hasn't done the work,
: so I figure there's probably something important that I'm missing.

That's because most people have been able to make the device (as
opposed to the /dev entry) added work.

Warner