HomeFreeBSD

iovec: macros to manipulate len and base together

Description

iovec: macros to manipulate len and base together

A set of convenience macros to initialize struct iovec's and increment
the base and length together.

IOVEC_INIT - sets iov_base and iov_len
IOVEC_INIT_CSTR - takes a string and sets iov_len to strlen + 1
IOVEC_INIT_OBJ - takes an object and sets iov_len to sizeof obj
IOVEC_ADVANCE - increments iov_base and decrements iov_len

On CheriBSD these present the opportunity to insert more precise bounds
on some objects and hide differences in casts in hybrid kernels (where
some, but not all pointers are capabilities and require annotation).
Here in FreeBSD the resulting code is tidier, particularly in the
IOVEC_ADVANCE case where the need to cast iov_base to (char *) is
avoided.

Reviewed by: kib
Feedback from: des, jrtc27
MFC after: 1 week
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D45422

Details

Provenance
brooksAuthored on Jun 2 2024, 6:36 PM
Reviewer
kib
Differential Revision
D45422: iovec: macros to manipulate len and base together
Parents
rGe50fec56bfa2: Revert "release/Makefile.vm: Use qemu-user-static-devel"
Branches
Unknown
Tags
Unknown