API to link sysctl nodes to devices
Poul-Henning Kamp
phk at phk.freebsd.dk
Mon Jun 6 05:59:42 UTC 2016
--------
In message <070D3C32-9631-49AD-85FB-53A4865AFA08 at bsdimp.com>, Warner Losh write
s:
>One way to do this would be dev.uftdi.0.%devnodes: ttyU2 ttyU3,
>which would require some new APIs for adding a dev_t to a device_t.
>But that might be backwards.
Many years ago I hacked up a "newbusfs" prototype, which cdevs under
a device_t named tree in /device, sort of like what Sun did:
/device/nexus0/acpi0/pcib1/xhci0/usbus0/uhub0/uhub3/ucom0 -> /dev/ucom0
I didn't particularly like it, and it doesn't solve the problem IMO,
but it could be one way of doing it.
The opposite would be plan-9 inspiration: Pair all cdevs with a
partner offering the information: /dev/cuaU0 has /dev/cuaU0.info
containing some lines of text with device_t linkage, serial numbers
etc.
>Of course, having a stronger coupling between device_t and dev_t would
>allow us to detect when /dev/foo isn't destroyed when the
>device_t created it gets detached.
The device_t:dev_t mapping is [0...N]:[0...M], (people tend to forget
things like multihomed disks) so that doesn't really work.
>As for sysctl, there's already a sysctl tree that's
>tightly coupled to a device instance that any device can take advantage
>of. I'm not sure what you need here, unless it's what I
>described in the last paragraph.
I think sysctl needs backpressure, it has exploded from a specialized
place for "root only handles" to a general dumping ground. In
particular it has a useless "all or nothing" attitude to jails.
--
Poul-Henning Kamp | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG | TCP/IP since RFC 956
FreeBSD committer | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
More information about the freebsd-arch
mailing list