git: c38bb48b04c9 - stable/13 - pseudofs: Allow vis callback to be called for a named node
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 29 Jun 2023 08:19:59 UTC
The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=c38bb48b04c9bb24e549eee6a099d9f9362b1ae8 commit c38bb48b04c9bb24e549eee6a099d9f9362b1ae8 Author: Dmitry Chagin <dchagin@FreeBSD.org> AuthorDate: 2023-04-02 08:21:15 +0000 Commit: Dmitry Chagin <dchagin@FreeBSD.org> CommitDate: 2023-06-29 08:15:17 +0000 pseudofs: Allow vis callback to be called for a named node This will be used later in the linsysfs module to filter out VNETs. Reviewed by: des Differential revision: https://reviews.freebsd.org/D39382 MFC after: 1 month (cherry picked from commit 405c0c04edb6143405426da6a5273f4c5998d594) --- sys/fs/pseudofs/pseudofs_internal.h | 7 ++++--- sys/fs/pseudofs/pseudofs_vnops.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/fs/pseudofs/pseudofs_internal.h b/sys/fs/pseudofs/pseudofs_internal.h index 2cc8f32b1d01..85df317d30cc 100644 --- a/sys/fs/pseudofs/pseudofs_internal.h +++ b/sys/fs/pseudofs/pseudofs_internal.h @@ -156,9 +156,10 @@ pn_vis(PFS_VIS_ARGS) { PFS_TRACE(("%s", pn->pn_name)); - KASSERT(pn->pn_vis != NULL, ("%s(): no callback", __func__)); - KASSERT(p != NULL, ("%s(): no process", __func__)); - PROC_LOCK_ASSERT(p, MA_OWNED); + if (pn->pn_vis == NULL) + return (1); + if (p != NULL) + PROC_LOCK_ASSERT(p, MA_OWNED); pfs_assert_not_owned(pn); return ((pn->pn_vis)(PFS_VIS_ARGNAMES)); } diff --git a/sys/fs/pseudofs/pseudofs_vnops.c b/sys/fs/pseudofs/pseudofs_vnops.c index 29bb1544e7ad..f58b1f8bdc47 100644 --- a/sys/fs/pseudofs/pseudofs_vnops.c +++ b/sys/fs/pseudofs/pseudofs_vnops.c @@ -119,7 +119,7 @@ pfs_visible(struct thread *td, struct pfs_node *pn, pid_t pid, if (p) *p = NULL; if (pid == NO_PID) - PFS_RETURN (1); + PFS_RETURN (pn_vis(td, NULL, pn)); proc = pfind(pid); if (proc == NULL) PFS_RETURN (0); @@ -826,7 +826,7 @@ pfs_iterate(struct thread *td, struct proc *proc, struct pfs_node *pd, } else if (proc != NULL) { visible = pfs_visible_proc(td, *pn, proc); } else { - visible = 1; + visible = pn_vis(td, NULL, *pn); } if (!visible) goto again;