17typedef enum :
size_t {
24 if ((sink ==
nullptr) || (sink->
write ==
nullptr) || ((data ==
nullptr) && (length != 0U))) {
29 while (offset < length) {
32 sink->
write(sink->
ctx, &((
const uint8_t*)data)[offset], length - offset, &written);
33 if ((status !=
k_cb_io_ok) || (written == 0U) || (written > (length - offset))) {
47 if ((sink ==
nullptr) || (format ==
nullptr)) {
51 const int length = vsnprintf(buffer,
sizeof(buffer), format, args);
52 if ((length < 0) || ((
size_t)length >=
sizeof(buffer))) {
61 va_start(args, format);
cb_io_status_t cb_sink_write_all(cb_sink_t *sink, const void *data, size_t length)
Write every byte, retrying bounded short writes.
@ k_cb_write_limit
Fail-closed short-write retry bound.
@ k_cb_format_capacity
Largest single report fragment.
cb_io_status_t cb_sink_format(cb_sink_t *sink, const char *format,...)
Format one bounded record and publish it atomically to the sink seam.
cb_io_status_t cb_sink_vformat(cb_sink_t *sink, const char *format, va_list args)
Format one bounded record and publish it atomically to the sink seam.
Bounded byte-source and text-sink seams for cache_bench.
cb_io_status_t
Status returned by tool-local injected I/O callbacks.
@ k_cb_io_ok
Operation completed.
@ k_cb_io_fault
Backing device or sink failed.
@ k_cb_io_capacity
Caller-owned storage was too small.
cb_sink_write_fn write
Write implementation.
void * ctx
Caller-owned binding.