rust-italia / mdev

mdev daemon workalike, written in pure rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mdev

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.

Structure and components

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    │
                                                    └────────────┘

About

mdev daemon workalike, written in pure rust


Languages

Language:Rust 100.0%