]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: move fstype_to_mounttype() to include/
authorKarel Zak <kzak@redhat.com>
Tue, 13 Jan 2026 17:36:39 +0000 (18:36 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Jan 2026 17:46:11 +0000 (18:46 +0100)
Make the workaround function globally available.

Signed-off-by: Karel Zak <kzak@redhat.com>
include/mountutils.h
libmount/src/context.c
libmount/src/context_umount.c
libmount/src/mountP.h
libmount/src/utils.c

index e77f20c2af273b2b55bb493c29ea10f90a1ee120..b2c4f750958c1e34eddf1f765e14a08e5379eb37 100644 (file)
@@ -483,7 +483,31 @@ static inline int has_listmount(void)
 #endif
 
 #endif /* HAVE_STATMOUNT_API */
-
 #endif /* HAVE_LINUX_MOUNT_H */
 
+/*
+ * Default NTFS mount type (used by libmount and libblkid)
+ */
+#ifndef CONFIG_UL_NTFS_MOUNTTYPE
+# define CONFIG_UL_NTFS_MOUNTTYPE "ntfs3"
+#endif
+
+/*
+ * Convert FS-type (as provided by libblkid or udev) to the preferred
+ * kernel FS driver (type used to mount the FS).
+ *
+ * This is a temporary solution; the final solution should be based on config
+ * files like /etc/mount/fs.d/<name> (from lib/configs.c) and managed by
+ * libmount.
+ */
+static inline const char *ul_fstype_to_mounttype(const char *fstype)
+{
+       if (!fstype)
+               return NULL;
+
+       if (strcmp(fstype, "ntfs") == 0)
+               return CONFIG_UL_NTFS_MOUNTTYPE;
+
+       return NULL;
+}
 #endif /* UTIL_LINUX_MOUNTUTILS_H */
index 9d6e0e59bd61ab2b18b7728e95ce0c9cd81721eb..53464f19ae30a264e22daec7762514c739291389 100644 (file)
@@ -2090,7 +2090,7 @@ int mnt_context_guess_srcpath_fstype(struct libmnt_context *cxt, char **type)
        }
 
        if (rc == 0 && *type) {
-               const char *x = mnt_fstype_to_mounttype(*type);
+               const char *x = ul_fstype_to_mounttype(*type);
 
                if (x) {
                        free(*type);
index 7a452ea0a3fc4a54df9af438d44c380cef02952f..68b93ef06a461e7684b23debbc1b9799b35da93e 100644 (file)
@@ -298,7 +298,7 @@ static int lookup_umount_fs_by_statfs(struct libmnt_context *cxt, const char *tg
                        close(fd);
                }
                if (type) {
-                       const char *x = mnt_fstype_to_mounttype(type);
+                       const char *x = ul_fstype_to_mounttype(type);
                        int rc = mnt_fs_set_fstype(cxt->fs, x ? x : type);
 
                        if (rc)
index abe7c6fc65783a23bd7db8515cef57d5e1ea7c62..7a6a4fbe2bbf2d5ceb7fbd991dd2c991c7fdad27 100644 (file)
@@ -109,7 +109,6 @@ struct libmnt_listmnt;
 extern int mnt_valid_tagname(const char *tagname);
 
 extern const char *mnt_statfs_get_fstype(struct statfs *vfs);
-extern const char *mnt_fstype_to_mounttype(const char *fstype);
 extern int is_file_empty(const char *name);
 
 extern int mnt_is_readonly(const char *path)
index 863879718dfd031b8e673975f9bb25f2978ddb2e..3d220e9c584bb425fa073bd488d8ea7863084160 100644 (file)
@@ -542,31 +542,6 @@ const char *mnt_statfs_get_fstype(struct statfs *vfs)
        return NULL;
 }
 
-/*
- * Default NTFS mount type (used by libmount and libblkid)
- */
-#ifndef CONFIG_UL_NTFS_MOUNTTYPE
-# define CONFIG_UL_NTFS_MOUNTTYPE "ntfs3"
-#endif
-
-/*
- * Convert FS-type (as provided by libblkid or udev) to the preferred
- * kernel FS driver (type used to mount the FS).
- *
- * This is a temporary solution; the final solution should be
- * based on config files like /etc/mount/fs.d/<name> (from lib/configs.c).
- */
-const char *mnt_fstype_to_mounttype(const char *fstype)
-{
-       if (!fstype)
-               return NULL;
-
-       if (strcmp(fstype, "ntfs") == 0)
-               return CONFIG_UL_NTFS_MOUNTTYPE;
-
-       return NULL;
-}
-
 /**
  * mnt_match_fstype:
  * @type: filesystem type