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
Unknown Object (File)
Thu, Oct 9, 9:05 PM
Unknown Object (File)
Tue, Sep 30, 11:38 PM
Unknown Object (File)
Fri, Sep 26, 2:20 AM
Unknown Object (File)
Wed, Sep 24, 9:55 AM
Unknown Object (File)
Sun, Sep 21, 11:02 PM
Unknown Object (File)
Thu, Sep 18, 5:31 AM
Unknown Object (File)
Wed, Sep 17, 6:57 PM
Unknown Object (File)
Sep 16 2025, 1:34 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