accel_decompress Subroutine
Purpose
Decompresses data by using hardware accelerated memory decompression or a slower software decompression if a hardware accelerator is not available.
Syntax
Description
Given a pointer to a buffer with data to decompress (the c_buf parameter), the accel_decompress subroutine returns the decompressed data in the buffer pointed to by the uc_buf parameter.
- There is no overlapping of the uc_buf parameter and the c_buf parameter. An overlap results in an error.
- The uc_buf and c_buf parameters must be aligned at least on a 128 byte boundary. For the best result, both uc_buf and c_buf parameters must be aligned on a 4096 byte boundary.
-
The c_len and *uc_lenp parameters are limited to a maximum of 1044480 bytes per subroutine call when buffers are aligned on a 4096 byte boundary. For buffers that are not aligned on a 4096 byte boundary, but are aligned on a 128 byte boundary, the c_len and *uc_lenp parameters are limited to 1040384 bytes per subroutine call plus any alignment offset from a 4096 byte boundary.
- The uc_lenp and c_len parameters must be a multiple of 8 bytes.
- The mapping of file segments with the shmat() function and the mmap() function are not allowed. However, the mapping of non-file segments with the shmat() function and the mmap() function are allowed (for example, MMAP_ANONYMOUS).
- The caller is responsible for supplying a large enough uc_buf.
The subroutine uses the 842 algorithm to decompress the data. The compressed buffer includes a cyclic redundancy check (CRC) that is added by the accel_compress() subroutine, which is verified against the uncompressed data. If an hardware accelerator is not available in the system that is used for decompression, the call uses the software decompression method. The subroutine supports both 32 bit and 64 bit applications.
Hardware accelerators are a finite resource on any system and you must be careful to not overwhelm the accelerators. If you have a large pool of threads all competing for a few of the available accelerators, you can end up with worse performance than with pure software decompression.
Parameters
Item | Description |
---|---|
c_buf | Pointer to input buffer with data to decompress. |
c_len | Length of compressed data in the c_buf parameter. |
uc_buf | Pointer to out buffer written with decompressed data. |
uc_lenp | Pointer to in/out parameter. On entry, the uc_lenp parameter is the total available size in the uc_buf parameter and on exit, the uc_lenp parameter is the number of bytes written to the uc_buf parameter. |
flags | Reserved for future use. This parameter must be set to zero. |
Execution environment
The accel_decompress subroutine can be called from the process environment only.
Return Values
Item | Description |
---|---|
0 | Success |
1 | Error. On failure, the errno global variable is set as follows:
|