libmount: separate fstype from mounttype, add config file support - #4583
Open
karelzak wants to merge 6 commits into
Open
libmount: separate fstype from mounttype, add config file support#4583karelzak wants to merge 6 commits into
karelzak wants to merge 6 commits into
Conversation
Member
|
No testcase? |
Collaborator
Author
|
Not yet. |
karelzak
marked this pull request as draft
August 27, 2026 08:09
Separate the on-disk filesystem type (fstype, e.g. "ntfs") from the kernel FS driver name (mounttype, e.g. "ntfs3"). Previously, ul_fstype_to_mounttype() completely overwrote the fstype with the driver name, causing helper lookup to search for /sbin/mount.<mounttype> instead of /sbin/mount.<fstype>. Now fstype and mounttype are stored separately in struct libmnt_fs: - fstype is used for helper search (/sbin/mount.<fstype>) and user-facing display - mounttype is used for mount(2) and fsopen() syscalls The mounttype mapping only applies to auto-detected types. When the user explicitly specifies a type via -t or fstab, it is used as-is for both helper search and the syscall -- no remapping. By default, no fstype-to-mounttype mapping is defined. Use --with-ntfs-mounttype=<type> (or -Dntfs-mounttype=<type>) to define a compile-time mapping for NTFS. Addresses: util-linux#3618 Addresses: util-linux#4307 Signed-off-by: Karel Zak <kzak@redhat.com>
karelzak
force-pushed
the
PR/libmount-mounttype
branch
from
August 27, 2026 10:46
c1f7746 to
242b254
Compare
Add /etc/mount/fs.d/<fstype>.conf config file support to override the kernel driver name (mounttype) for auto-detected filesystem types. The config file uses simple "key = value" format: # /etc/mount/fs.d/ntfs.conf mounttype = ntfs3 The config file lookup uses ul_configs_file_list() with standard three-tier priority (admin > runtime > vendor): /etc/mount/fs.d/<fstype>.conf /run/mount/fs.d/<fstype>.conf /usr/lib/mount/fs.d/<fstype>.conf Priority for mounttype resolution: config file > hardcoded ul_fstype_to_mounttype() > no remapping Config values are cached on the mount context so each fs.d/<name> is parsed only once per context lifetime. Addresses: util-linux#3618 Addresses: util-linux#4307 Signed-off-by: Karel Zak <kzak@redhat.com>
Document the new /etc/mount/fs.d/<type>.conf config file support in the mount(8) man page. Add a new FILESYSTEM TYPE CONFIGURATION section, a cross-reference from -t option description, and a FILES entry. Signed-off-by: Karel Zak <kzak@redhat.com>
Move the compile-time ntfs mounttype mapping into the config cache as a built-in default (lowest priority), making mnt_config_get_value() the single lookup point for mounttype. This eliminates ul_fstype_to_mounttype() from mount, umount, findmnt-verify and removes it from mountutils.h. Signed-off-by: Karel Zak <kzak@redhat.com>
Add TEST_PROGRAM to config.c and a test script exercising mnt_config_get_value() with subtests for basic reading, missing keys, comments, etc/usr priority, multiple keys, and the CONFIG_UL_NTFS_MOUNTTYPE built-in default. Signed-off-by: Karel Zak <kzak@redhat.com>
karelzak
force-pushed
the
PR/libmount-mounttype
branch
from
August 27, 2026 10:57
242b254 to
aece143
Compare
karelzak
marked this pull request as ready for review
August 27, 2026 10:57
Create a config file in /run/mount/fs.d/ with a fake mounttype, attempt to mount an ext2 device, and verify that mount(8) reports the configured (non-existent) kernel driver name in the error. Skip on platforms without fsopen() to avoid unstable errno differences with legacy mount(2). Signed-off-by: Karel Zak <kzak@redhat.com>
karelzak
force-pushed
the
PR/libmount-mounttype
branch
from
August 27, 2026 13:41
aece143 to
8bdb001
Compare
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.
Summary
/sbin/mount.<fstype>) uses the original detected name while mount syscalls use the configured driver name./etc/mount/fs.d/<type>.confconfig file support with standard three-tier priority (/etc>/run>/usr/lib) for mounttype overrides.mnt_config_get_value()for reading per-filesystem configuration.Fixes the problem where
ul_fstype_to_mounttype()overwrote fstype with driver name, breaking helper search (e.g., searching for/sbin/mount.ntfs3instead of/sbin/mount.ntfs).Example config (
/etc/mount/fs.d/ntfs.conf):Addresses: #3618
Addresses: #4307