Page MenuHomeFreeBSD

pseudofs: Simplify pfs_readdir() and set eofflag
ClosedPublic

Authored by markj on Jul 22 2025, 1:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 9, 3:20 PM
Unknown Object (File)
Sun, Mar 8, 3:48 AM
Unknown Object (File)
Fri, Mar 6, 10:48 PM
Unknown Object (File)
Fri, Mar 6, 4:10 PM
Unknown Object (File)
Fri, Mar 6, 4:27 AM
Unknown Object (File)
Feb 8 2026, 5:28 PM
Unknown Object (File)
Jan 30 2026, 9:04 PM
Unknown Object (File)
Jan 21 2026, 4:51 PM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 65615
Build 62498: arc lint + arc unit

Event Timeline

markj requested review of this revision.Jul 22 2025, 1:31 PM
kib added inline comments.
sys/fs/pseudofs/pseudofs_vnops.c
884

This line definitely needs a comment that allproc_lock is required for pfs_iterate().
Although it is probably not needed for not-procdir directories.

This revision is now accepted and ready to land.Jul 22 2025, 2:19 PM
markj marked an inline comment as done.

Add a comment noting the reason for acquiring allproc_lock.

For now I did not attempt to make it smarter.

This revision now requires review to proceed.Jul 22 2025, 3:13 PM
This revision is now accepted and ready to land.Jul 22 2025, 3:17 PM