Skip to content

Add runtime configuration sources to mounted dmdevfs instances - #76

Open
JaxCalder wants to merge 2 commits into
mainfrom
feat/runtime-config-sources
Open

JaxCalder wants to merge 2 commits into
mainfrom
feat/runtime-config-sources

Conversation

@JaxCalder

@JaxCalder JaxCalder commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

An already mounted dmdevfs instance can load and remove additional driver configuration trees through DMDEVFS_IOCTL_ADD_CONFIG and DMDEVFS_IOCTL_REMOVE_CONFIG. Callers pass a directory path through any handle belonging to that mount, preferably its built-in null node. Configurations from internal flash, external flash and an SD card can coexist without remounting.

Each configured device, hot-plug child and partition points to a source record containing only the directory path, removal state and reference count. The mount's existing dmlist owns both active nodes and source-removed nodes awaiting their last reference. Removed nodes are skipped by lookup and directory enumeration. Source records do not hold a reverse device list; all collections use dmlist, with no custom linked-list fields.

Removing a source withdraws only its nodes, notifies libsystemd and friends, invalidates its file handles, and defers driver/module release until retained file and directory references are closed. Removal works after the source files are gone. Commands run on the hot-plug worker; duplicate/overlapping trees are rejected and failed additions roll back their new nodes. Shared modules remain alive for surviving instances, and queued notifications from freed contexts are discarded before context addresses can be reused.

Validation of the current revision:

  • Full host CTest suite: 11/11 passed, including 10 runtime-source scenarios and the existing device-key tests.
  • STM32F7 builds of dmdevfs, the runtime-source test and the mock driver passed.
  • Coverage includes independent/nested sources, path validation, collisions and partial failures, unavailable files, repeat cycles, shared-driver lifetime, descendants, open files and directory snapshots. A regression explicitly checks re-adding a source while its previous handles remain open and hidden nodes remain in the owning list.

Related: #75 also addresses runtime configuration loading, using mount-point APIs and automatic mount tracking. This PR provides explicit IOCTL management of a selected dmdevfs instance and does not add the mountcfg service or its new dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant