Page MenuHomeFreeBSD

vmbus: Avoid gratuitous ifdef and use more generic implementation instead
ClosedPublic

Authored by jrtc27 on May 31 2025, 7:04 PM.
Tags
None
Referenced Files
F134951984: D50630.id156356.diff
Wed, Nov 5, 9:58 AM
F134915540: D50630.id.diff
Wed, Nov 5, 4:41 AM
F134910282: D50630.diff
Wed, Nov 5, 4:00 AM
F134873755: D50630.id.diff
Tue, Nov 4, 11:49 PM
Unknown Object (File)
Mon, Nov 3, 10:17 PM
Unknown Object (File)
Thu, Oct 30, 11:41 PM
Unknown Object (File)
Sun, Oct 26, 11:37 AM
Unknown Object (File)
Sun, Oct 26, 1:24 AM
Subscribers

Details

Summary

Checking for LP64 is non-portable as it assumes that ILP32 and LP64
are the only two ABIs that exist, but CheriBSD supports an additional
ABI where long is still 64-bit but pointers are 128-bit capabilities,
and thus LP64 is not defined. We could change this to check the
value of SIZEOF_LONG, since the code here only cares about that
aspect of the ABI, however in this instance, the only real reason an
ifdef is used at all is to be able to get log2(sizeof(u_long)), but if
we instead multiply and divide rather than shift, and let the compiler
optimise that to a shift, we can just use sizeof(u_long) instead. Note
also that VMBUS_EVTFLAGS_MAX could always just have been defined as
VMBUS_EVTFLAGS_SIZE / sizeof(u_long).

Diff Detail

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