HomeFreeBSD

pseudofs: Simplify pfs_readdir() and set eofflag

Description

pseudofs: Simplify pfs_readdir() and set eofflag

There were two loops, one to skip entries before the requested offset,
and one to populate entries. Merge them and use the return value of
pfs_iterate() to decide whether to set eofflag.

As a side effect, this fixes a small bug: the first loop would decrement
offset to zero, and the second loop would increment it again.
However, offset was used to set d_off, and we should include the
starting offset there.

Add a comment explaining the use of the allproc lock.

Reviewed by: des, kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51462

Details

Provenance
markjAuthored on Jul 23 2025, 1:52 AM
Reviewer
des
Differential Revision
D51462: pseudofs: Simplify pfs_readdir() and set eofflag
Parents
rG48266828f5bb: bhyve: use speed in hci to allow backend modify it.
Branches
Unknown
Tags
Unknown