Page MenuHomeFreeBSD

vfs: Export get_next_dirent() as vn_dir_next_dirent()
ClosedPublic

Authored by olce on Apr 21 2023, 9:14 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Oct 31, 7:29 PM
Unknown Object (File)
Wed, Oct 30, 11:46 AM
Unknown Object (File)
Sun, Oct 20, 3:22 AM
Unknown Object (File)
Sep 26 2024, 9:58 PM
Unknown Object (File)
Sep 26 2024, 9:54 PM
Unknown Object (File)
Sep 25 2024, 9:20 PM
Unknown Object (File)
Sep 18 2024, 2:11 PM
Unknown Object (File)
Sep 18 2024, 9:05 AM

Details

Summary

Move internal-to-'vfs_default.c' get_next_dirent() to 'vfs_vnops.c' and export
it for use by other parts of the VFS. This is a preparatory change for using it
in vfs_emptydir().

No functional change.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51120
Build 48011: arc lint + arc unit

Event Timeline

olce requested review of this revision.Apr 21 2023, 9:14 PM

The patch definitely needs a split into several. An immediate candidate is the code refactoring without a change in behavior, then introduce the fixes on top of it.

sys/kern/vfs_subr.c
6555

The args should start on the previous line

6562

int_fast16_t is not fast. I do not see why not use plain int there.

sys/sys/dirent.h
129

Static_assert should not be used in app-visible headers, there is no point to add such asserts to the third party code. Placing them in kernel sources should be enough.

Keep just the get_next_dirent() => vfs_next_dirent() refactoring

And update according to feedback.

olce marked 3 inline comments as done.Apr 22 2023, 4:30 PM

I've also changed a bit the initial diff so as to minimize differences (order of declarations).

(@kib You said that uint_fast16_t is not fast. While I understand the requested change from an aesthetic point of view, I don't think uint_fast16_t is not fast, it is in fact as fast as int, since it expands to __uint32_t. But yes, it's not faster than an int, which you probably meant?)

olce retitled this revision from vfs: Fix "emptydir" mount option, export vfs_next_dirent() to vfs: Simplify, harden and export get_next_dirent() as vfs_next_dirent().
olce edited the summary of this revision. (Show Details)

Change summary

Can we split it even more? The move of vfs_next_dirent() and its rename, then the changes you do over the moved code.
I expect the changes would be easier to grasp this way.

sys/kern/vfs_subr.c
6421

Call it vn_dir_next_dirent() and put at the end of vfs_vnops.c instead of vfs_subr.c.

6517

The blank line is not needed

sys/sys/dirent.h
68

This should be a separate change. Please mail me a git format-patch with proper commit message and metadata (mostly the author name/mail) correct.

olce retitled this revision from vfs: Simplify, harden and export get_next_dirent() as vfs_next_dirent() to vfs: Export get_next_dirent() as vn_dir_next_dirent().
olce edited the summary of this revision. (Show Details)
olce edited the test plan for this revision. (Show Details)

Keep just the move and rename. Next commits to be added as child revisions.

Further diff simplification

This revision is now accepted and ready to land.Apr 25 2023, 12:16 AM
This revision was automatically updated to reflect the committed changes.