Go to main content

man pages section 3: DAX Library Functions

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

dax_extract (3DAX)

Name

dax_extract - extract each element to a padded-bytes element

Synopsis

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);

Description

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.

Supported Flags

DAX_PAD_RIGHT

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.

DAX_CACHE_DST

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.

DAX_NOWAIT

If the DAX command queue is full, returns without submitting the command, instead of waiting to submit.

Return Values

Returns 0 in the dax_result_t count field and sets the dax_result_t status field to one of the following values:

DAX_SUCCESS

Operation completed successfully

DAX_EINVAL

Invalid argument, detected by libdax

DAX_EPARSE

Invalid argument, detected by DAX

DAX_EDATAFMT

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.

DAX_EOVERFLOW

Output buffer overflow

DAX_EADI

ADI mismatch error for an input or output buffer

DAX_ETHREAD

The calling thread did not create ctx

DAX_EBUSY

DAX is busy and nowait was requested

DAX_EINTERNAL

Unknown internal error. Caller must stop using ctx.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/library
Interface Stability
Committed

See Also

libdax(3LIB), dax_vec_t(3DAX), dax_adi(3DAX), dax_dtrace(3DAX), dax_scan_value(3DAX), dax_zip(3DAX)