> On 16.03.2015 19:49, Natanael Copa wrote:
> >> netlink reader | tee /dev/ttyX | device operation handler
> >
> > This looks good to me.
> >
> > If you want avoid that this netlink reader in your example is in memory
> > at all times, then feel free to use my netlink socket activator to
> > activate it. Otherwise, please ignore it.
>
> Your activator wouldn't be of much benefit, as the netlink reader itself
> tries to stay as small as possible. So your gain may be a single page of
> user space, but pay for this with an extra process descriptor in the
> kernel. Not really a difference, but needs extra CPU power to fire up
> the netlink reader. Not to note, that inactive memor may be swapped out
> by the kernel, so your approach may be a "for resource constraint
> purposes special solution".
>
> The netlink reader does:
>
> establish network socket
> wait for incoming event
> gather event information
> write textual event message to stdout
The concept of a simple netlink reader daemon seems nice.
But would seem extra to having another reader that reads this reader.
The concept of whole /sys tree is being re-done, even if its just not
visible(memory). I could add/suggest few changes.
Please consider concept/flow below as theoretical.
Netlink listener (nlplugd) + config file(simple by design, but extend-able)
configFile example (/etc/nlplugd.conf)
<keyword> <handler>
eg. <handler>= mdev, modprobe
eg. <keyword>= ALL(reserved), modalias
default behaviour for empty config file is
ALL for mdev except modalias
modalias for modprobe
A
nlplugd parses events and outputs to /sys/partials
tree format (1)
/sys/partials/<handler>/<sequence>/eventSymlinkToActualDeviceLink
tree format (2)(alternative)
/sys/partials/<handler>/<sequence>/someSimpleTreeRepresentation
(try not to re-invent /sys)
B
nlplugd check for running <handler>
nlplugd re-nice/suspends if <handler> is running (avoid race condition)
not sure if this is possible
nlplugd outputs to /sys/partials/actors/<handler>
(value is numerical, increments)
nlplugd un-suspends <handler>
C
nlplugd activates <handler> if not running
D
nlplugd continues with A+B+C
E
New "mdev" option for partials (mdev -p)
this is similar to mdev -s, but now it parses
/sys/partials/<handler>/ , since it just follows the symlink,
there might not be need for lot of extra code here.
E2
It decrements /sys/partials/actors/<handler> number
It follows /sys/partials/<handler>/<sequence> to activate devices
It removes /sys/partials/<handler>/<sequence> node
Before quiting checks /sys/partials/actors/<handler> number, if
greater > 0, rescan /sys/partials/<handler>/ (repeat E2)
F
New "modprobe" option for partials (modprobe -p)
(have not thought on it, yet, but similar to E2 possible)
Note:
I am assuming any write to /sys/partials/actors/<handler>
is done by write lock.
--
Regards.
V.Krishn
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox