From owner-svn-src-all@freebsd.org Fri Sep 6 19:07:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E23AD4400; Fri, 6 Sep 2019 19:07:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Q6WW0tsYz4lwk; Fri, 6 Sep 2019 19:07:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0113621656; Fri, 6 Sep 2019 19:07:35 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x86J7YAd049663; Fri, 6 Sep 2019 19:07:34 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x86J7YCv049662; Fri, 6 Sep 2019 19:07:34 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201909061907.x86J7YCv049662@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Sep 2019 19:07:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351955 - stable/12/lib/libc/gen X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/lib/libc/gen X-SVN-Commit-Revision: 351955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Sep 2019 19:07:35 -0000 Author: asomers Date: Fri Sep 6 19:07:34 2019 New Revision: 351955 URL: https://svnweb.freebsd.org/changeset/base/351955 Log: MFC r350314: 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. This is a merge of r348007, r348054, and r350093 from projects/fuse2 Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21043 Modified: stable/12/lib/libc/gen/getvfsbyname.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/getvfsbyname.c ============================================================================== --- stable/12/lib/libc/gen/getvfsbyname.c Fri Sep 6 19:05:01 2019 (r351954) +++ stable/12/lib/libc/gen/getvfsbyname.c Fri Sep 6 19:07:34 2019 (r351955) @@ -37,10 +37,26 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include /* + * 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);