Date: Mon, 20 May 2019 19:36:36 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r348007 - projects/fuse2/lib/libc/gen Message-ID: <201905201936.x4KJaaIC023310@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Mon May 20 19:36:36 2019 New Revision: 348007 URL: https://svnweb.freebsd.org/changeset/base/348007 Log: special-case getvfsbyname(3) for fusefs(5) fusefs file systems may have a fsname subtype (set by mount_fusefs's "-o subtype" option) that gets appended to the fsname as returned by statfs(2). The subtype is set on a per-mount basis so it isn't part of the struct vfsconf. Special-case getvfsbyname to match either the full "fusefs.foobar" or short "fusefs" fsname. Sponsored by: The FreeBSD Foundation Modified: projects/fuse2/lib/libc/gen/getvfsbyname.c Modified: projects/fuse2/lib/libc/gen/getvfsbyname.c ============================================================================== --- projects/fuse2/lib/libc/gen/getvfsbyname.c Mon May 20 19:31:49 2019 (r348006) +++ projects/fuse2/lib/libc/gen/getvfsbyname.c Mon May 20 19:36:36 2019 (r348007) @@ -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 char fusefs[] = "fusefs"; + const char fusefs_dot[] = "fusefs."; + + return (strncmp(fsname, fusefs_dot, strlen(fusefs_dot)) == 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,9 @@ 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905201936.x4KJaaIC023310>