mdev daemon workalike, written in pure rust
mdev and mdevd are uevent managers, they listen for kernel object userspace events and react according to a set of rules that are coded in their mdev.conf format.
Any uevent manager daemon has 4 primary components:
- A netlink listener, in our case netlink-sys provides us already some level of abstraction
- Something that parses the messages encoded in the netlink packets
- A set of rules on how to react to the events, we use the same mdev.conf format
- The actual code that reacts to the events according to the rules
- It matches events with rules
- [] It executes the actual action and make sure to log the results of it
βββββββββββ βββββββββββββ
β Linux β Uevent Packets β Netlink β UEvents
β Kernel ββββββββββββββββββΊβ Listener βββββββββββββββββββ
β β β β βΌ
βββββββββββ βββββββββββββ ββββββββββββ
β UEvent β
β Daemon β
βββββββββββββ βββββββββββββ βββββββββ¬βββ
β mdev.conf β mdev lines β Rules β β² β
β ββββββββββββββββΊβ Parser βββββββββββββββββββ β
β β β β Rules β
βββββββββββββ βββββββββββββ βΌ
ββββββββββββββ
β Actions β
ββββββββββββββ