HomeFreeBSD

vmbus: Avoid gratuitous ifdef and use more generic implementation instead

Description

vmbus: Avoid gratuitous ifdef and use more generic implementation instead

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).

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D50630

Details

Provenance
jrtc27Authored on Jul 10 2025, 7:33 PM
Reviewer
jhb
Differential Revision
D50630: vmbus: Avoid gratuitous ifdef and use more generic implementation instead
Parents
rG2c444fdb0c75: libc,libthr: Remove __pthread_distribute_static_tls
Branches
Unknown
Tags
Unknown