From nobody Tue Mar 28 17:58:25 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PmHV96GwDz42DVj; Tue, 28 Mar 2023 17:58:25 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PmHV95qDlz3svp; Tue, 28 Mar 2023 17:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680026305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Khe9YncGwTjGhgJ16g+zSVMyFi1vaiDqbhuAy7AG4nI=; b=dy50MYUfjGVtMF3G9rY8OM39q65IXR4YeS5pqdBe68lHchT5EP8G2XdqzyhuF7UfSrFe33 0VIaIBn7LLtD7H1Zkx6BNGiMaNJCTDb21XkL/G4LLvwUS550GcRYHstL1mUsY0l5zJrDgL +NlhpKZKaf6nsCQoLRabTsVjpHBHyKRh3DvUcZsvWJ2/iWUxhQslCy9IIgInSy7CVv14C6 oTzAvpev7GCyhRhSwWugDDsW1lz262/xEiNb3SU83dgiKnsUtOFLlvBAaaxq8fzInft0sN PfaAGiLFTAOV71fkg2sLqGuXLf/D9UAzu7eLzIjbJ2mGroAK2AdRFe8N8Cq5wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680026305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Khe9YncGwTjGhgJ16g+zSVMyFi1vaiDqbhuAy7AG4nI=; b=IMzF89ACIIgjLtKyGJW1/xK77bWqEaor/Y4CPsdCgyCthJDDckYta+AdnY4TpQozss+Fyn dm24HGMydgqff1eSJ456V0UOtRfn0RtQB9Ew1Jg7m6hOIsITASieKeZ2XFb+7O2m1Ajk1v ezg4D0gnKjrzQt8WKlx4LNL1fX0J6KDvba9dh4jUiSc/FctBGNbC19AJQntlGy53v/7/Cz 6pIJ/y21p4Z6UGeyW8oQ7t2ZM+lSh4pR74x/FYIYpyxGbfgStJMWRhPEPNM0O7uM5ef/pM N0aZlpQDAclU1pRRPpIqE8wL5diKm6ilwSALrhOKpRrd/IbvMqEE8wpu5ktwmw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680026305; a=rsa-sha256; cv=none; b=T6Bd2mnpMgP9UfgsX5ef2GDv+xadDQUIHGa4dmxteFGpAuZCrsBEhSIQdeIThpt2XShZMu +vD6YlqeMyHXmlc8KY9fM7BimQGhwO3DTEISnn/3GFoAU8+JqmI1MDxGCVAqjaUDutRnta zfvRIZXYtZ7hock6QPTFrCFH3XSmjPet1Y8XXyBuGC94P+p11YvEQJ0eCwjjDaUiby3wzG BoDoZ4FvdXoXyJ30HTVbr8OX9euHmmdYKn+1qu+IXDT4dawNfOFuxaJ8P2htcTOrC7OEfN oLGF2yKF4kYjNy7gQxqFKSyIbUeUpVxG+c+gNUe4Nbd+wmtSg2A5vMs+3mzu1w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PmHV94t47z1Cht; Tue, 28 Mar 2023 17:58:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32SHwPbA071175; Tue, 28 Mar 2023 17:58:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32SHwPLt071174; Tue, 28 Mar 2023 17:58:25 GMT (envelope-from git) Date: Tue, 28 Mar 2023 17:58:25 GMT Message-Id: <202303281758.32SHwPLt071174@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Simon J. Gerraty" Subject: git: a02d9cad77c1 - main - tarfs_mount allow control of vfs_mountedfrom List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: sjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a02d9cad77c1207eb809ba49fc1595c8ebb2da26 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by sjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a02d9cad77c1207eb809ba49fc1595c8ebb2da26 commit a02d9cad77c1207eb809ba49fc1595c8ebb2da26 Author: Simon J. Gerraty AuthorDate: 2023-03-28 17:57:26 +0000 Commit: Simon J. Gerraty CommitDate: 2023-03-28 17:57:26 +0000 tarfs_mount allow control of vfs_mountedfrom We default to passing the path of the tar file to vfs_mountedfrom so we can tell where a filesystem was mounted from. However this can make the output of mount(8) hard to read. Allow things like: mount -t tarfs -o as=`basename $tar` $tar /mnt so "as" is recorded instead of $tar Reviewed by: des Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D39273 --- sys/fs/tarfs/tarfs_vfsops.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/fs/tarfs/tarfs_vfsops.c b/sys/fs/tarfs/tarfs_vfsops.c index 17d6814ba973..4489b41699ec 100644 --- a/sys/fs/tarfs/tarfs_vfsops.c +++ b/sys/fs/tarfs/tarfs_vfsops.c @@ -108,7 +108,7 @@ static vfs_statfs_t tarfs_statfs; static vfs_fhtovp_t tarfs_fhtovp; static const char *tarfs_opts[] = { - "from", "gid", "mode", "uid", "verify", + "as", "from", "gid", "mode", "uid", "verify", NULL }; @@ -905,11 +905,11 @@ tarfs_mount(struct mount *mp) struct tarfs_mount *tmp = NULL; struct thread *td = curthread; struct vnode *vp; - char *from; + char *as, *from; uid_t root_uid; gid_t root_gid; mode_t root_mode; - int error, flags, len; + int error, flags, aslen, len; if (mp->mnt_flag & MNT_UPDATE) return (EOPNOTSUPP); @@ -936,10 +936,14 @@ tarfs_mount(struct mount *mp) error = vfs_getopt(mp->mnt_optnew, "from", (void **)&from, &len); if (error != 0 || from[len - 1] != '\0') return (EINVAL); + error = vfs_getopt(mp->mnt_optnew, "as", (void **)&as, &aslen); + if (error != 0 || as[aslen - 1] != '\0') + as = from; /* Find the source tarball */ - TARFS_DPF(FS, "%s(%s, uid=%u, gid=%u, mode=%o)\n", __func__, - from, root_uid, root_gid, root_mode); + TARFS_DPF(FS, "%s(%s%s%s, uid=%u, gid=%u, mode=%o)\n", __func__, + from, (as != from) ? " as " : "", (as != from) ? as : "", + root_uid, root_gid, root_mode); flags = FREAD; if (vfs_flagopt(mp->mnt_optnew, "verify", NULL, 0)) { flags |= O_VERIFY; @@ -995,7 +999,7 @@ tarfs_mount(struct mount *mp) MNT_IUNLOCK(mp); vfs_getnewfsid(mp); - vfs_mountedfrom(mp, from); + vfs_mountedfrom(mp, as); TARFS_DPF(FS, "%s: success\n", __func__); return (0);