Page MenuHomeFreeBSD

LinuxKPI: add __struct_size
ClosedPublic

Authored by bz on Aug 21 2025, 9:00 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 12, 12:27 PM
Unknown Object (File)
Sun, Oct 12, 12:27 PM
Unknown Object (File)
Sun, Oct 12, 1:29 AM
Unknown Object (File)
Sun, Oct 12, 1:29 AM
Unknown Object (File)
Sun, Oct 12, 1:29 AM
Unknown Object (File)
Sat, Oct 11, 3:58 PM
Unknown Object (File)
Thu, Oct 9, 8:50 PM
Unknown Object (File)
Sat, Oct 4, 9:53 AM

Details

Summary

Use builtin_object_size() by default.
If
builtin_dynamic_object_size() is available use that instead.

I would hope that in a future version we can remove the conditional
checks but in order to be able to MFC this without checking all
compiler versions simply keep it this way for now.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bz requested review of this revision.Aug 21 2025, 9:00 AM
dumbbell added inline comments.
sys/compat/linuxkpi/common/include/linux/compiler.h
133

Just a tiny comment: I find easier to reason about when a check is if (condition) rather than if (!condition). Any reason to handle the negative code path first?

bz marked an inline comment as done.Sep 3 2025, 10:05 PM
This revision is now accepted and ready to land.Sep 4 2025, 4:15 PM
This revision was automatically updated to reflect the committed changes.