[issue1616] hotplug notification
Alex Hornung <ahornung@gmail.com> added the comment:
in devfs_alias_create(), you are notifying hotplug about the attach of the=20
underlying device and not the alias. As such, if there was an alias such as=
=20
serno/00001 for da0, you'd get two attach notices for da0 and none for=20
serno/00001.
devfs links are no cdev_t, they are synthetic devfs nodes. The name that=20
should be passed to hotplug at this point is the function parameter name_or=
ig.
I don't know how you want to handle that, but I don't think synthesizing a=20
cdev_t just to pass the name and/or type to hotplug is a good idea. You cou=
ld=20
pass in this case both the underlying cdev_t (which is what you are doing=20
now, 'target') and the name of the link/alias.
Another option could be to pass devfs nodes to hotplug, which contain a lot=
=20
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 pa=
th,=20
as each node only stores its name; for this you would just iterate up to th=
e=20
root node across ->parent elements, and stashsing the nodes. Then, just wal=
k=20
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=
=20
the future.
Cheers,
Alex Hornung
----------
assignedto: -> alexh
nosy: +alexh
status: unread -> chatting
_____________________________________________________
DragonFly issue tracker <bugs@lists.dragonflybsd.org>
<http://bugs.dragonflybsd.org/issue1616>
_____________________________________________________
討論串 (同標題文章)
完整討論串 (本文為第 1 之 4 篇):