udi_buf_t(3udi)


Logical buffer type

SYNOPSIS

#include <udi.h>

typedef struct {

	udi_size_t buf_size;

} udi_buf_t;
 

MEMBERS buf_size is the current size of the buffer data, in bytes. The environment will adjust this as necessary as a result of service calls that change the buffer's content. The driver may also change the value, to indicate a desired size change, which will affect subsequent service calls.

description The udi_buf_t structure is used to reference a collection of data that is passing through a driver, typically between an application and a device or communications medium.

The udi_buf_t structure is a semi-opaque type, and must only be allocated by environment service calls. UDI buffers are transferable between regions.

If a buffer is used with a service call that retrieves the contents of some or all of the buffer data (such as udi_buf_read or udi_buf_copy) and the buf_size value is larger than the extent of data explicitly written into the buffer, the values retrieved for the un-written range are unspecified.

If data is written into the buffer (such as with udi_buf_write or udi_buf_copy), and the starting offset at which the data is written is greater than the extent of data previously explicitly written into the buffer, an values subsequently retrieved for the un-written range are unspecified.

Any service call that potentially modifies a buffer's contents returns a new buffer pointer in the corresponding callback. While this pointer may in many cases be equal to the original buffer pointer, the environment may in fact have reallocated the buffer, so drivers must always replace all subsequent use of the original buffer pointer with the new pointer. This is also true of buffers passed to channel operations.


UDI Core Specification Contents