Page MenuHomeFreeBSD

pseudofs: Simplify pfs_readdir() and set eofflag
ClosedPublic

Authored by markj on Tue, Jul 22, 1:31 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 28, 11:47 AM
Unknown Object (File)
Sun, Jul 27, 9:06 PM
Unknown Object (File)
Sun, Jul 27, 7:39 AM
Unknown Object (File)
Sun, Jul 27, 1:45 AM
Unknown Object (File)
Sat, Jul 26, 9:02 PM
Unknown Object (File)
Sat, Jul 26, 8:02 PM
Unknown Object (File)
Sat, Jul 26, 7:15 AM
Unknown Object (File)
Wed, Jul 23, 4:31 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

markj requested review of this revision.Tue, Jul 22, 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.Tue, Jul 22, 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.Tue, Jul 22, 3:13 PM
This revision is now accepted and ready to land.Tue, Jul 22, 3:17 PM