[issue1616] hotplug notification
Alex Hornung (via DragonFly issue tracker)
sinknull at leaf.dragonflybsd.org
Thu Nov 26 23:26:01 PST 2009
Alex Hornung <ahornung at gmail.com> added the comment:
in devfs_alias_create(), you are notifying hotplug about the attach of the
underlying device and not the alias. As such, if there was an alias such as
serno/00001 for da0, you'd get two attach notices for da0 and none for
serno/00001.
devfs links are no cdev_t, they are synthetic devfs nodes. The name that
should be passed to hotplug at this point is the function parameter name_orig.
I don't know how you want to handle that, but I don't think synthesizing a
cdev_t just to pass the name and/or type to hotplug is a good idea. You could
pass in this case both the underlying cdev_t (which is what you are doing
now, 'target') and the name of the link/alias.
Another option could be to pass devfs nodes to hotplug, which contain a lot
more information than the cdev_t, but that causes a number of problems:
- you'd need to acquire a lock (and also release it) for every node you use
- devfs would not be well encapsulated anymore
- for links and aliases you would need to use a function to get the full path,
as each node only stores its name; for this you would just iterate up to the
root node across ->parent elements, and stashsing the nodes. Then, just walk
through that stash in reverse order, putting together the path.
In any case, I'm more inclined to the solution of creating some
struct hotplug_device {
cdev_t dev;
char *name;
};
or similar. This will make it much easier to add new information/options in
the future.
Cheers,
Alex Hornung
----------
assignedto: -> alexh
nosy: +alexh
status: unread -> chatting
_____________________________________________________
DragonFly issue tracker <bugs at lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1616>
_____________________________________________________
More information about the Submit
mailing list