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)
Sat, Jun 13, 11:58 AM
Unknown Object (File)
May 7 2026, 12:29 AM
Unknown Object (File)
May 3 2026, 8:39 PM
Unknown Object (File)
May 3 2026, 5:57 PM
Unknown Object (File)
May 3 2026, 11:31 AM
Unknown Object (File)
Apr 30 2026, 8:35 AM
Unknown Object (File)
Apr 29 2026, 9:24 AM
Unknown Object (File)
Apr 29 2026, 9:17 AM
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 65616
Build 62499: 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
888

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