Skip to content

Add the automount service; FAT and exFAT are mounted by dmfatfs - #2

Merged
JohnAmadis merged 2 commits into
mainfrom
feature/automount
Sep 30, 2026
Merged

JohnAmadis merged 2 commits into
mainfrom
feature/automount

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

dmblkid now reports vfat and exfat with module "dmfatfs" and as mountable, now that dmfatfs mounts them straight from a node.

services/automount: one instance per block node dmdevfs reports ([class=block] start=automount@%name). It probes the node with dmblkid and mounts a mountable file system at /mnt/, or at /mnt/ when the volume has no label or that path is taken. Characters that do not belong in a path or a shell word become '_'. A partition table, unknown contents or dmffs leave it with nothing to do (exit 0); a mounted instance waits for its stop (node removed, or "service stop") and unmounts. Picking the path and mounting happen under a lock shared by all instances; only /mnt itself is created, as dmvfs needs no directory under a mount point.

The mount logic (automount.c) is tested on the host with a fake tree and images probed by the real dmblkid (test_automount).

CI: clone dmod for dmod_loader into a fresh directory - the dmod:1.0.4 image already has a /tmp/dmod, which made the step fail on main - and run test_automount.

Tested on STM32F746G-DISCO: the card's partition was mounted at boot, the whole-medium instance exited, "service stop" unmounted it (the node could be mounted by hand again), "service start" mounted it again.

JohnAmadis and others added 2 commits September 30, 2026 13:13
dmblkid now reports vfat and exfat with module "dmfatfs" and as
mountable, now that dmfatfs mounts them straight from a node.

services/automount: one instance per block node dmdevfs reports
([class=block] start=automount@%name). It probes the node with dmblkid
and mounts a mountable file system at /mnt/<volume label>, or at
/mnt/<node name> when the volume has no label or that path is taken.
Characters that do not belong in a path or a shell word become '_'. A
partition table, unknown contents or dmffs leave it with nothing to do
(exit 0); a mounted instance waits for its stop (node removed, or
"service stop") and unmounts. Picking the path and mounting happen under
a lock shared by all instances; only /mnt itself is created, as dmvfs
needs no directory under a mount point.

The mount logic (automount.c) is tested on the host with a fake tree and
images probed by the real dmblkid (test_automount).

CI: clone dmod for dmod_loader into a fresh directory - the dmod:1.0.4
image already has a /tmp/dmod, which made the step fail on main - and run
test_automount.

Tested on STM32F746G-DISCO: the card's partition was mounted at boot, the
whole-medium instance exited, "service stop" unmounted it (the node could
be mounted by hand again), "service start" mounted it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Applications run once per instance, libraries are loaded once: with the
mount logic inside the automount application, every mounted volume carried
its own ~6 KB copy of it. libs/libautomount now holds all of it -
probe, label, path choice, mount/unmount, the lock shared by the
instances and the libsystemd stop handling (libautomount_run()) - and the
automount service is only a main() calling libautomount_run(): 484 B
instead of 6032 B (cortex-m7 .dmf).

The logic no longer takes a table of function pointers: the dmvfs access
is in libautomount_os.c, which the host tests replace with fakes at link
time (test_automount -> test_libautomount).

Checked on STM32F746G-DISCO: the partition is mounted at boot, the
whole-medium instance exits, "service stop"/"service start" unmount and
mount it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JohnAmadis
JohnAmadis merged commit 4949de0 into main Sep 30, 2026
3 checks passed
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