diff options
Diffstat (limited to 'cpukit/libmisc/untar/untar.h')
-rw-r--r-- | cpukit/libmisc/untar/untar.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/cpukit/libmisc/untar/untar.h b/cpukit/libmisc/untar/untar.h index 3c8bb74130..b97d1d5154 100644 --- a/cpukit/libmisc/untar/untar.h +++ b/cpukit/libmisc/untar/untar.h @@ -21,6 +21,7 @@ #include <stddef.h> #include <tar.h> #include <zlib.h> +#include <xz.h> #include <rtems/print.h> @@ -117,6 +118,34 @@ typedef struct { } Untar_GzChunkContext; +typedef struct { + /** + * @brief Instance of Chunk Context needed for tar decompression. + */ + Untar_ChunkContext base; + + /** + * @brief Xz context. + */ + struct xz_dec* strm; + + /** + * @brief Xz buffer. + */ + struct xz_buf buf; + + /** + * @brief Buffer that contains the inflated data. + */ + void *inflateBuffer; + + /** + * @brief Size of buffer that contains the inflated data. + */ + size_t inflateBufferSize; + +} Untar_XzChunkContext; + /** * @brief Initializes the Untar_ChunkContext files out of a part of a block of * memory. @@ -175,6 +204,40 @@ int Untar_FromGzChunk_Print( const rtems_printer* printer ); +/** + * @brief Initializes the Untar_ChunkXzContext. + * + * @param Untar_ChunkXzContext *context [in] Pointer to a context structure. + * @param enum xz_mode mode [in] Dictionary mode. + * @param uint32_t dict_max [in] Maximum size of dictionary. + * @param void *inflateBuffer [in] Pointer to a context structure. + * @param size_t inflateBufferSize [in] Size of inflateBuffer. + */ +int Untar_XzChunkContext_Init( + Untar_XzChunkContext *ctx, + enum xz_mode mode, + uint32_t dict_max, + void *inflateBuffer, + size_t inflateBufferSize +); + +/* + * @brief Untars a XZ compressed POSIX TAR file. + * + * This is a subroutine used to rip links, directories, and + * files out of a tar.gz/tgz file. + * + * @param Untar_ChunkContext *context [in] Pointer to a context structure. + * @param ssize buflen [in] Size of valid bytes in input buffer. + * @param z_stream *strm [in] Pointer to the current zlib context. + */ +int Untar_FromXzChunk_Print( + Untar_XzChunkContext *ctx, + void *chunk, + size_t chunk_size, + const rtems_printer* printer +); + /************************************************************************** * This converts octal ASCII number representations into an * unsigned long. Only support 32-bit numbers for now. |