aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorAlan Somers <asomers@FreeBSD.org>2019-07-25 03:55:05 +0000
committerAlan Somers <asomers@FreeBSD.org>2019-07-25 03:55:05 +0000
commitab8cabb1ca9dbff39da55b17d8810a3bcefc6c80 (patch)
tree756bfd6fda221cf92c5a793761d35a63a56a6b7d /lib/libc
parent7c382eea3051833bf7664f9742fc96b463d23d32 (diff)
parent822f5b1dadf2b5b69f4a3314dfa0d6bd7e1f1126 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getvfsbyname.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/libc/gen/getvfsbyname.c b/lib/libc/gen/getvfsbyname.c
index 70c744c369ed..91f4490bf504 100644
--- a/lib/libc/gen/getvfsbyname.c
+++ b/lib/libc/gen/getvfsbyname.c
@@ -37,10 +37,26 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
/*
+ * fusefs(5) file systems may have a "subtype" which gets appended to
+ * statfs(2)'s f_fstypename field on a per-mount basis. Allow getvfsbyname to
+ * match either the full "fusefs.foobar" or the more general "fusefs".
+ */
+static bool
+are_fusefs(const char *fsname, const char *vfc_name)
+{
+ const static char fusefs[] = "fusefs";
+ const static char fusefs_dot[] = "fusefs.";
+
+ return (strncmp(fsname, fusefs_dot, sizeof(fusefs_dot) - 1) == 0 &&
+ strcmp(fusefs, vfc_name) == 0);
+}
+
+/*
* Given a filesystem name, determine if it is resident in the kernel,
* and if it is resident, return its xvfsconf structure.
*/
@@ -62,7 +78,8 @@ getvfsbyname(const char *fsname, struct xvfsconf *vfcp)
}
cnt = buflen / sizeof(struct xvfsconf);
for (i = 0; i < cnt; i++) {
- if (strcmp(fsname, xvfsp[i].vfc_name) == 0) {
+ if (strcmp(fsname, xvfsp[i].vfc_name) == 0 ||
+ are_fusefs(fsname, xvfsp[i].vfc_name)) {
memcpy(vfcp, xvfsp + i, sizeof(struct xvfsconf));
free(xvfsp);
return (0);