summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/untar/untar.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-10-12 09:15:23 +1100
committerChris Johns <chrisj@rtems.org>2016-10-13 13:11:40 +1100
commit826f3afaf3e4682c3ab7110648327217b0cd9e44 (patch)
treeb378ea695ba466a14220a6274ec5570a66e9457d /cpukit/libmisc/untar/untar.h
parentscore: More robust linker sets (diff)
downloadrtems-826f3afaf3e4682c3ab7110648327217b0cd9e44.tar.bz2
libmisc/xz: Add xz decompression.
Add support to untar XZ compressed files.
Diffstat (limited to 'cpukit/libmisc/untar/untar.h')
-rw-r--r--cpukit/libmisc/untar/untar.h63
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.