|
|
udi_buf_write(3udi)
Write data bytes into a logical buffer
#include <udi.h>void udi_buf_write ( udi_buf_write_call_t *callback, udi_cb_t *gcb, const void *src_mem, udi_size_t src_len, udi_buf_t *dst_buf, udi_size_t dst_off, udi_size_t dst_len, udi_buf_path_t path_handle ); typedef void udi_buf_write_call_t ( udi_cb_t *gcb, udi_buf_t *new_dst_buf );ARGUMENTS callback, gcb are standard arguments described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".
src_mem is a pointer to caller memory where the first byte of data is to be copied from. If NULL, the resulting data values are unspecified.
src_len Number of bytes to be copied from src_mem, replacing the specified dst_len bytes in dst_buf. If src_mem is NULL the dst_len bytes in dst_buf are replaced by src_len bytes of unspecified data values. If src_len is zero, src_mem is ignored.
dst_buf are the same arguments as used in udi_buf_copy.
DESCRIPTION udi_buf_write copies data bytes from virtually contiguous driver memory area to a logical buffer. This function works like udi_buf_copy except that the data source is a virtually-contiguous memory area, rather than another buffer. No endianness conversion will be performed by udi_buf_write.
If src_mem is NULL, data in the resulting range of the destination buffer will have unspecified values. This is useful for ensuring that a buffer is instantiated to a certain size, without taking the expense of copying data into the buffer. This mechanism should only be used when the instantiated data must exist.
WARNINGS A NULL src_mem with nonzero src_len and dst_len can produce unspecified data values in the middle of valid data (e.g., src_mem=NULL, src_len=6, and dst_len=4 produces at least two bytes of unspecified data within the valid data area of dst_buf). While this is a legal operation, the results may be unexpected.
Control block usage must follow the rules described in the "Asynchronous Service Calls" section of "Calling Sequence and Naming Conventions".
Use of the src_mem parameter must conform to the rules described in Section 5.2.1.1, "Using Memory Pointers with Asynchronous Service Calls".
If this operation is cancelled with udi_cancel, any pre-existing dst_buf buffer will be discarded (see udi_cancel for an explanation of why this is so).