# ciubotaru/eca-lkm architecture

> Architecture diagram of the GitHub repository ciubotaru/eca-lkm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ciubotaru/eca-lkm
- Repository: https://github.com/ciubotaru/eca-lkm

## Overview

eca-lkm is a Linux kernel module that exposes a Rule 30 pseudo-random number generator as the /dev/eca30 character device. The user workflow is to write bytes to seed or alter the internal pool, then read generated random bytes; reads refill a drained pool from the kernel random source. Device registration and teardown support that workflow. The sampled source shows these relationships directly; the README documents the device interface and udev rule capability, but not the rule’s runtime behavior.

Main entry points: [`eca30.c`](https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c) (Device operations), [`99-eca30.rules`](https://github.com/ciubotaru/eca-lkm/blob/stable/99-eca30.rules) (udev rule)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Character device"]
  node_device_ops["Device operations<br/>[eca30.c]"]
  node_device_lifecycle["Device lifecycle<br/>[eca30.c]"]
end

subgraph group_rng["Random generator"]
  node_rule30["Rule 30 pool<br/>[eca30.c]"]
end

node_user(("Process"))
node_kernel_rng["Kernel random"]
node_device_node["/dev/eca30"]
node_udev_rules["udev rule<br/>[99-eca30.rules]"]

node_user -->|"reads / writes"| node_device_node
node_device_node -->|"dispatches I/O"| node_device_ops
node_device_ops -->|"updates pool"| node_rule30
node_rule30 -->|"generates bytes"| node_device_ops
node_device_ops -->|"refills pool"| node_kernel_rng
node_device_lifecycle -->|"creates device"| node_device_node
node_udev_rules -.->|"sets attributes"| node_device_node

click node_device_ops "https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c"
click node_device_lifecycle "https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c"
click node_rule30 "https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c"
click node_udev_rules "https://github.com/ciubotaru/eca-lkm/blob/stable/99-eca30.rules"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_device_ops,node_device_lifecycle toneBlue
class node_rule30 toneAmber
class node_user,node_kernel_rng,node_device_node toneIndigo
class node_udev_rules toneTeal
```

## Components

### Character device

- [Device operations](https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c): `eca30.c`
- [Device lifecycle](https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c): `eca30.c`

### Random generator

- [Rule 30 pool](https://github.com/ciubotaru/eca-lkm/blob/stable/eca30.c): `eca30.c`

### Other components

- **Process**
- **Kernel random**
- **/dev/eca30**
- [udev rule](https://github.com/ciubotaru/eca-lkm/blob/stable/99-eca30.rules): `99-eca30.rules`

## Connections

- Process → /dev/eca30: reads / writes (evidence: `README`)
- /dev/eca30 → Device operations: dispatches I/O (evidence: `eca30.c`)
- Device operations → Rule 30 pool: updates pool (evidence: `eca30.c`)
- Rule 30 pool → Device operations: generates bytes (evidence: `eca30.c`)
- Device operations → Kernel random: refills pool (evidence: `eca30.c`)
- Device lifecycle → /dev/eca30: creates device (evidence: `eca30.c`)
- udev rule → /dev/eca30: sets attributes (evidence: `README`)
