From nobody Mon May 29 08:20:10 2023 X-Original-To: dev-commits-src-main@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 4QV7kM037Fz4XNVB; Mon, 29 May 2023 08:20:11 +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 4QV7kL5pyZz47Zr; Mon, 29 May 2023 08:20:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685348410; 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=rdP1lrI+1ZY37WNAdbd10b+1Xz6U8UIMTZ8mG/jD3xU=; b=xVUSNjDKIUFxGqa5HJ52lrn+5HQHnoGjL5mS/M81izOPc2iLJFQISOxOlLTq/r5g5HC0wo pExyD9BdKiSwYdqUER9UrE14ZyGVevr5D9Avn6MvtmXy233B168ot9cqAU5w0Ka43wAUV6 +35t32n6oaUfqTLhmAMUwLiJndKFMH56jDwbZwAG/1Oo4G4qIbXMajUQflLadMmcz4iJRi 8V/F8qbDpS2/JjkpdJ3/5bYOoPDFMqckWiuDSHvp30n13bybAm0g84ccbZE9mWReQTqu0r Q81zSbUnTGWVgCNHbbWHhxuo/0STx1YDYLwFqaBTK/mWEexL0PJnWP5xRzNFdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1685348410; 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=rdP1lrI+1ZY37WNAdbd10b+1Xz6U8UIMTZ8mG/jD3xU=; b=I8b0mGhecVSztpl70wUPIl47ymchAf8poRvwFPe9hGbIWtntCVSGejKl7Wa64+vuHJcoMg Us7ZjJYRaby3k3HxGG8Nt7F7FLo9EKV4d8CqRMZIZP2EXW59GR0PtF61ZR/jhyOaDYz02M OO5juXGuKfMsZWeSPBYhiSs8BbbLRfW3eqsiKAou6yjM8422VjY+jfwDkWRN9941IgcnPz DbtTglmNAX4GapM1umpR67DOoI8PcEe50X60Aj9Yt0UDU+/l8vh3I0IdRvmXpvE5gswLcI kEH7ygWEN38xfs8wNDCfGUCNkOVOl5lDpPsl65oZWVk6BU10azns94+hWjFpRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685348410; a=rsa-sha256; cv=none; b=YL9hU1vUBC2emFJesrZW/OzFtwRjG4UMQJkf5kMnpxYGMHFdSSEY689WtHp2F97OtCHf9i k0zpFGOYIWdEeTp3ZJ+C3cuMfSOwbOaXb3Z4CsNErutFwbM9S7Zl64kEyLA2fdCwWAQCHf kVpe9vr1tYhbzDLPQ+f1xMl552Dc6KG1Ifv8n0by84IjiNdbll4KpTN5ktykl4XtarDJCQ KephiRtkvWJrgSR2AJ3FMCWixHlEkG2U49wgJEC/GMugwDakZwi3BEHJ7nJ8vDrM5ARQ/O NqUEQ8NIU9Qq1ff2/y8SClXhvvZRXRvDCUw2Vm87S0qtVEY8RjBbmEVZ0relOQ== 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 4QV7kL4Kgsz14JG; Mon, 29 May 2023 08:20:10 +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 34T8KAMS068920; Mon, 29 May 2023 08:20:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34T8KACC068913; Mon, 29 May 2023 08:20:10 GMT (envelope-from git) Date: Mon, 29 May 2023 08:20:10 GMT Message-Id: <202305290820.34T8KACC068913@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: a482fffc7ebf - main - linprocfs: Rework according to the new ABI altroot facility List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a482fffc7ebf41c306d0020da37fea174de68fa5 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=a482fffc7ebf41c306d0020da37fea174de68fa5 commit a482fffc7ebf41c306d0020da37fea174de68fa5 Author: Dmitry Chagin AuthorDate: 2023-05-29 08:18:37 +0000 Commit: Dmitry Chagin CommitDate: 2023-05-29 08:18:37 +0000 linprocfs: Rework according to the new ABI altroot facility By 3d2fec7d the ABI prefix path added to the struct pwd. Use it in the mounts, mountinfo filler functions. Differential revision: https://reviews.freebsd.org/D39438 MFC after: 2 month --- sys/compat/linprocfs/linprocfs.c | 52 ++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index a150019ae5ef..90eab8ba5f4d 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -526,29 +526,26 @@ _sbuf_mntoptions_helper(struct sbuf *sb, uint64_t f_flags) static int linprocfs_domtab(PFS_FILL_ARGS) { - struct nameidata nd; - const char *lep, *mntto, *mntfrom, *fstype; + const char *mntto, *mntfrom, *fstype; char *dlep, *flep; + struct vnode *vp; + struct pwd *pwd; size_t lep_len; int error; struct statfs *buf, *sp; size_t count; - /* resolve symlinks etc. in the emulation tree prefix */ /* - * Ideally, this would use the current chroot rather than some - * hardcoded path. + * Resolve emulation tree prefix */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path); flep = NULL; - error = namei(&nd); - lep = linux_emul_path; - if (error == 0) { - if (vn_fullpath(nd.ni_vp, &dlep, &flep) == 0) - lep = dlep; - vrele(nd.ni_vp); - } - lep_len = strlen(lep); + pwd = pwd_hold(td); + vp = pwd->pwd_adir; + error = vn_fullpath_global(vp, &dlep, &flep); + pwd_drop(pwd); + if (error != 0) + return (error); + lep_len = strlen(dlep); buf = NULL; error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count, @@ -567,7 +564,7 @@ linprocfs_domtab(PFS_FILL_ARGS) } /* determine mount point */ - if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/') + if (strncmp(mntto, dlep, lep_len) == 0 && mntto[lep_len] == '/') mntto += lep_len; sbuf_printf(sb, "%s %s %s ", mntfrom, mntto, fstype); @@ -584,28 +581,25 @@ linprocfs_domtab(PFS_FILL_ARGS) static int linprocfs_doprocmountinfo(PFS_FILL_ARGS) { - struct nameidata nd; const char *mntfrom, *mntto, *fstype; - const char *lep; char *dlep, *flep; struct statfs *buf, *sp; size_t count, lep_len; + struct vnode *vp; + struct pwd *pwd; int error; /* - * Ideally, this would use the current chroot rather than some - * hardcoded path. + * Resolve emulation tree prefix */ - NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, linux_emul_path); flep = NULL; - error = namei(&nd); - lep = linux_emul_path; - if (error == 0) { - if (vn_fullpath(nd.ni_vp, &dlep, &flep) == 0) - lep = dlep; - vrele(nd.ni_vp); - } - lep_len = strlen(lep); + pwd = pwd_hold(td); + vp = pwd->pwd_adir; + error = vn_fullpath_global(vp, &dlep, &flep); + pwd_drop(pwd); + if (error != 0) + return (error); + lep_len = strlen(dlep); buf = NULL; error = kern_getfsstat(td, &buf, SIZE_T_MAX, &count, @@ -620,7 +614,7 @@ linprocfs_doprocmountinfo(PFS_FILL_ARGS) continue; } - if (strncmp(mntto, lep, lep_len) == 0 && mntto[lep_len] == '/') + if (strncmp(mntto, dlep, lep_len) == 0 && mntto[lep_len] == '/') mntto += lep_len; #if 0 /*