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
This commit is contained in:
Dmitry Chagin 2023-04-02 11:21:15 +03:00
parent 7f72324346
commit 405c0c04ed
2 changed files with 6 additions and 5 deletions

View File

@ -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));
}

View File

@ -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;