dax_extract - extract each element to a padded-bytes element
cc [ flag... ] file... -ldax [ library...] #include <dax.h> dax_result_t dax_extract(dax_context_t *ctx, uint64_t flags, dax_vec_t *src, dax_vec_t *dst);
This function copies the elements of src to the corresponding elements of dst, converting each element if the width of the element differs. It copies the ith element of src to the ith element of dst.
If src is zipped, translates each code word of src using the src->codec and produces a 1 to 8 byte symbol and appends the symbol to an intermediate unzip stream. It then partitions the unzip stream into elements at src element width boundaries. Repeats each such element if src is run-length encoded and writes to dst. In a variable width src, the ith element of the src->aux_data field gives the width of the ith unzipped element. In a run-length encoded src, the ith element of the src->aux_data field gives the repeat count of the ith unzipped element as described in the dax_vec_t(3DAX) man page. The aux_data field is not in zipped form.
The parameters of this function must meet the following conditions:
The width of elements in src can be any of the following:
1 to 16 bits or 1 to 16 bytes in libdax version 1
1 to 24 bits or 1 to 16 bytes in libdax version 2
The src can be fixed-width, variable-width, or run-length encoded.
The dst->offset field must be set to 0.
The dst element width may be any of 1, 2, 4, 8, or 16 bytes.
The number of dst elements must be at least the number of src elements.
dst->data must start on a 64 byte boundary. Users must round up the size of the dst->data as described in the dax_vec_t(3DAX) man page.
The following address ranges must not overlap:
Address range of the src->data vector and the dst->data vector.
Address range of the src->aux_data vector and the dst->data vector.
The libdax library checks the overlap in the address ranges only if the DAX_DEBUG_EXTRA debug option is set. If violation of the conditions occur and are not checked, you will get undefined results.
If the width of the element in src is not a multiple of bytes, this function pads the element with 0's on the left to a byte-size boundary.
If the width of the possibly padded src element is larger than the width of the dst element, this function truncates the element by dropping bytes on the right.
If the width of the possibly padded src element is smaller than the width of the dst element, this function pads the element with 0's on the left or right as specified by flags.
When additional padding is required as described above, pads the element with 0's on the right. Without this flag, pads the element with 0's to the left.
Writes results to cache. If not specified, invalidates the address range for dst in the cache, and writes the result to the main memory. For more information, see the dax_scan_value(3DAX) man page.
If the DAX command queue is full, returns without submitting the command, instead of waiting to submit.
Returns 0 in the dax_result_t count field and sets the dax_result_t status field to one of the following values:
Operation completed successfully
Invalid argument, detected by libdax
Invalid argument, detected by DAX
The true value of an aux_data element is 0, or the width of a zip symbol is less than 1 or greater than 8, detected by DAX.
Output buffer overflow
ADI mismatch error for an input or output buffer
The calling thread did not create ctx
DAX is busy and nowait was requested
Unknown internal error. Caller must stop using ctx.
See attributes(5) for descriptions of the following attributes: