Repository navigation
Add the automount service; FAT and exFAT are mounted by dmfatfs - #2
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.