Pádraig Brady wrote:
> The above idea is implemented in the attached.

But now 'mountlist' depends indirectly on 'cygpath'. It does not need to.
This patch restructures the module, so as to get rid of this unnecessary
dependency.


2026-02-28  Bruno Haible  <[email protected]>

        filesystem-remote: New module.
        * lib/filesystem-remote.h: New file, based on lib/file-remote.h.
        * lib/filesystem-remote.c: New file, based on lib/file-remote.c.
        * lib/file-remote.h (is_remote_fs_type_name): Remove declaration.
        * lib/file-remote.c (is_remote_fs_type_name): Remove function.
        * modules/filesystem-remote: New file.
        * lib/mountlist.c: Include filesystem-remote.h instead of file-remote.h.
        * modules/mountlist (Depends-on): Add filesystem-remote. Remove
        file-remote.

>From 2a893de047b7be60f86e9dff0e91b5e7467d2c2c Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
Date: Sat, 28 Feb 2026 22:13:14 +0100
Subject: [PATCH] filesystem-remote: New module.

* lib/filesystem-remote.h: New file, based on lib/file-remote.h.
* lib/filesystem-remote.c: New file, based on lib/file-remote.c.
* lib/file-remote.h (is_remote_fs_type_name): Remove declaration.
* lib/file-remote.c (is_remote_fs_type_name): Remove function.
* modules/filesystem-remote: New file.
* lib/mountlist.c: Include filesystem-remote.h instead of file-remote.h.
* modules/mountlist (Depends-on): Add filesystem-remote. Remove
file-remote.
---
 ChangeLog                 | 12 +++++++++
 lib/file-remote.c         | 35 ------------------------
 lib/file-remote.h         |  4 ---
 lib/filesystem-remote.c   | 57 +++++++++++++++++++++++++++++++++++++++
 lib/filesystem-remote.h   | 32 ++++++++++++++++++++++
 lib/mountlist.c           |  2 +-
 modules/filesystem-remote | 25 +++++++++++++++++
 modules/mountlist         |  2 +-
 8 files changed, 128 insertions(+), 41 deletions(-)
 create mode 100644 lib/filesystem-remote.c
 create mode 100644 lib/filesystem-remote.h
 create mode 100644 modules/filesystem-remote

diff --git a/ChangeLog b/ChangeLog
index 75f242528a..9b9be2f842 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2026-02-28  Bruno Haible  <[email protected]>
+
+	filesystem-remote: New module.
+	* lib/filesystem-remote.h: New file, based on lib/file-remote.h.
+	* lib/filesystem-remote.c: New file, based on lib/file-remote.c.
+	* lib/file-remote.h (is_remote_fs_type_name): Remove declaration.
+	* lib/file-remote.c (is_remote_fs_type_name): Remove function.
+	* modules/filesystem-remote: New file.
+	* lib/mountlist.c: Include filesystem-remote.h instead of file-remote.h.
+	* modules/mountlist (Depends-on): Add filesystem-remote. Remove
+	file-remote.
+
 2026-02-28  Collin Funk  <[email protected]>
 
 	cygpath: Use _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE.
diff --git a/lib/file-remote.c b/lib/file-remote.c
index 21fe63851a..8fe6bc78a7 100644
--- a/lib/file-remote.c
+++ b/lib/file-remote.c
@@ -56,41 +56,6 @@
 # endif
 #endif
 
-int _GL_ATTRIBUTE_CONST
-is_remote_fs_type_name (const char *fs_type)
-{
-  return (   streq (fs_type, "acfs")
-          || streq (fs_type, "afs")
-          || streq (fs_type, "autofs")
-          || streq (fs_type, "auristorfs")
-          || streq (fs_type, "cachefs")
-          || streq (fs_type, "ceph")
-          || streq (fs_type, "cifs")
-          || streq (fs_type, "coda")
-          || streq (fs_type, "fhgfs")
-          || streq (fs_type, "gfs")
-          || streq (fs_type, "gfs2")
-          || streq (fs_type, "gpfs")
-          || streq (fs_type, "ibrix")
-          || streq (fs_type, "lustre")
-          || streq (fs_type, "ncpfs")
-          || streq (fs_type, "netfs")
-          || streq (fs_type, "nfs")
-          || streq (fs_type, "nfs3")
-          || streq (fs_type, "nfs4")
-          || streq (fs_type, "ocfs2")
-          || streq (fs_type, "panfs")
-          || streq (fs_type, "smb")
-          || streq (fs_type, "smb2")
-          || streq (fs_type, "smb3")
-          || streq (fs_type, "smbfs")
-          || streq (fs_type, "snfs")
-          || streq (fs_type, "stnfs")
-          || streq (fs_type, "userlandfs")
-          || streq (fs_type, "vxfs")
-          || streq (fs_type, "websearchfs"));
-}
-
 #if defined _WIN32 || defined __CYGWIN__                    /* Windows */
 # define WIN32_LEAN_AND_MEAN  /* avoid including junk */
 # include <windows.h>
diff --git a/lib/file-remote.h b/lib/file-remote.h
index de7f09ea4f..05c0d930f2 100644
--- a/lib/file-remote.h
+++ b/lib/file-remote.h
@@ -30,10 +30,6 @@ extern "C" {
      - -1 with errno set, upon error (e.g. if the file is not accessible).  */
 extern int file_is_remote (const char *file);
 
-/* Returns 1 if the filesystem type name FS_TYPE is known to be a
-   remote filesystem type, 0 otherwise.  */
-extern int is_remote_fs_type_name (const char *fs_type);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/filesystem-remote.c b/lib/filesystem-remote.c
new file mode 100644
index 0000000000..082b74e0b5
--- /dev/null
+++ b/lib/filesystem-remote.c
@@ -0,0 +1,57 @@
+/* Determination whether a file system is local or remote.
+   Copyright (C) 2025-2026 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "filesystem-remote.h"
+
+#include <string.h>
+
+int _GL_ATTRIBUTE_CONST
+is_remote_fs_type_name (const char *fs_type)
+{
+  return (   streq (fs_type, "acfs")
+          || streq (fs_type, "afs")
+          || streq (fs_type, "autofs")
+          || streq (fs_type, "auristorfs")
+          || streq (fs_type, "cachefs")
+          || streq (fs_type, "ceph")
+          || streq (fs_type, "cifs")
+          || streq (fs_type, "coda")
+          || streq (fs_type, "fhgfs")
+          || streq (fs_type, "gfs")
+          || streq (fs_type, "gfs2")
+          || streq (fs_type, "gpfs")
+          || streq (fs_type, "ibrix")
+          || streq (fs_type, "lustre")
+          || streq (fs_type, "ncpfs")
+          || streq (fs_type, "netfs")
+          || streq (fs_type, "nfs")
+          || streq (fs_type, "nfs3")
+          || streq (fs_type, "nfs4")
+          || streq (fs_type, "ocfs2")
+          || streq (fs_type, "panfs")
+          || streq (fs_type, "smb")
+          || streq (fs_type, "smb2")
+          || streq (fs_type, "smb3")
+          || streq (fs_type, "smbfs")
+          || streq (fs_type, "snfs")
+          || streq (fs_type, "stnfs")
+          || streq (fs_type, "userlandfs")
+          || streq (fs_type, "vxfs")
+          || streq (fs_type, "websearchfs"));
+}
diff --git a/lib/filesystem-remote.h b/lib/filesystem-remote.h
new file mode 100644
index 0000000000..9d0a7c9183
--- /dev/null
+++ b/lib/filesystem-remote.h
@@ -0,0 +1,32 @@
+/* Determination whether a file system is local or remote.
+   Copyright (C) 2026 Free Software Foundation, Inc.
+
+   This file is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   This file is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#ifndef _FILESYSTEM_REMOTE_H
+#define _FILESYSTEM_REMOTE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Returns 1 if the filesystem type name FS_TYPE is known to be a
+   remote filesystem type, 0 otherwise.  */
+extern int is_remote_fs_type_name (const char *fs_type);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _FILESYSTEM_REMOTE_H */
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 21f6c05613..77ea8cee7e 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -29,7 +29,7 @@
 #include <unistd.h>
 
 #include "c-ctype.h"
-#include "file-remote.h"
+#include "filesystem-remote.h"
 #include "xalloc.h"
 
 #if HAVE_SYS_PARAM_H
diff --git a/modules/filesystem-remote b/modules/filesystem-remote
new file mode 100644
index 0000000000..f3cb8ab1d7
--- /dev/null
+++ b/modules/filesystem-remote
@@ -0,0 +1,25 @@
+Description:
+Determine whether a file system is local or remote.
+
+Files:
+lib/filesystem-remote.h
+lib/filesystem-remote.c
+
+Depends-on:
+streq
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += filesystem-remote.c
+
+Include:
+"filesystem-remote.h"
+
+Link:
+
+License:
+GPL
+
+Maintainer:
+all
diff --git a/modules/mountlist b/modules/mountlist
index e6e788e6d9..dc2e1d07d2 100644
--- a/modules/mountlist
+++ b/modules/mountlist
@@ -9,7 +9,7 @@ m4/mountlist.m4
 
 Depends-on:
 c-ctype
-file-remote
+filesystem-remote
 fopen-gnu
 free-posix
 getline
-- 
2.52.0

Reply via email to