55 const char *file,
unsigned int line ) {
60 okx ( iobuf !=
NULL, file, line );
61 DBGC ( &iobuf_test,
"IOBUF %p (%#08lx+%#zx) for %#zx align %#zx "
62 "offset %#zx\n", iobuf, virt_to_phys ( iobuf->
data ),
66 okx ( ( ( (
intptr_t ) iobuf ) & ( __alignof__ ( *iobuf ) - 1 ) ) == 0,
69 okx ( ( ( align == 0 ) ||
70 ( ( virt_to_phys ( iobuf->
data ) & ( align - 1 ) ) ==
71 (
offset & ( align - 1 ) ) ) ), file, line );
85#define alloc_iob_ok( len, align, offset ) \
86 alloc_iob_okx ( len, align, offset, __FILE__, __LINE__ )
98 const char *file,
unsigned int line ) {
103 okx ( iobuf ==
NULL, file, line );
105#define alloc_iob_fail_ok( len, align, offset ) \
106 alloc_iob_fail_okx ( len, align, offset, __FILE__, __LINE__ )
#define NULL
NULL pointer (VOID *)
uint16_t offset
Offset to command line.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
void * memset(void *dest, int character, size_t len) __nonnull
void free_iob(struct io_buffer *iobuf)
Free I/O buffer.
struct io_buffer * alloc_iob_raw(size_t len, size_t align, size_t offset)
Allocate I/O buffer with specified alignment and offset.
#define IOB_ZLEN
Minimum I/O buffer length and alignment.
#define iob_put(iobuf, len)
static size_t iob_tailroom(struct io_buffer *iobuf)
Calculate available space at end of an I/O buffer.
#define alloc_iob_ok(len, align, offset)
static void iobuf_test_exec(void)
Perform I/O buffer self-tests.
#define alloc_iob_fail_ok(len, align, offset)
static void alloc_iob_okx(size_t len, size_t align, size_t offset, const char *file, unsigned int line)
Report I/O buffer allocation test result.
static void alloc_iob_fail_okx(size_t len, size_t align, size_t offset, const char *file, unsigned int line)
Report I/O buffer allocation failure test result.
void * data
Start of data.
void * end
End of the buffer.
void * head
Start of the buffer.
Self-test infrastructure.
#define okx(success, file, line)
Report test result.
#define __self_test
Declare a self-test.