How miemhse/erlangio works
Project Type and Purpose
• This is not a full-blown application but rather a proof-of-technology integration between an Erlang application and a Linux kernel driver.
• The README emphasizes connecting the Erlang VM to a device driver by way of procfs, highlighting both Erlang and C components meant to interact with the Linux kernel.
Main Components
• Erlang Application:
• Found in the src directory (files like erlangio.app.src, erlangio.erl, erlangio_app.erl, erlangio_sup.erl).
• This part sets up the Erlang application, its supervision tree, and general runtime behavior.
• C Source Module:
• Located in the c_src directory (erlangio.c, erlangio.h, and Makefile) and include directory (erlangio.hrl).
• This module is responsible for interactions at the system level that interface with the Linux kernel.
• Kernel Driver (External Component):
• While the driver itself isn’t in the file tree, it is referenced in the usage instructions (via insmod and rmmod commands). Consider the driver as an external component that is dynamically loaded into the Linux kernel.
• Procfs Interface:
• Acts as the communication channel between the Erlang application (via the C module) and the Linux kernel.
• Environment/Deployment:
• Vagrantfile and manifests (for example, the precise64.sh script) suggest that a consistent, possibly virtualized, testing or deployment environment is in place.
Relationships and Interactions
• That the Erlang application (running on the Erlang VM) calls upon the C modules.
• The C module then communicates with the Linux kernel driver via the procfs interface.
• Feedback or response flow from the kernel driver back through the same chain when data is read or requests are processed.
• Build and Deployment:
• Role of build tools (Rebar for Erlang code and Makefile for the C components) ensuring that updates to the system propagate correctly.
• The Vagrantfile and manifests help illustrate how the system is provisioned and tested.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly differentiate between the Erlang application logic and the low-level C interactions with the kernel.
• Modular Design: Highlight how components (Erlang, C code, kernel module) are developed and maintained separately, yet work in tandem.
• Use of Supervision: Note the inclusion of supervision structures in the Erlang code (erlangio_sup.erl) which is key in Erlang systems for maintaining fault-tolerance.
Preventing Syntax Errors
• All labels are properly quoted if the syntax requires it.
• There are no stray special characters that may confuse the parser.