aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2021-09-05 20:38:12 +0300
committerLasse Collin <lasse.collin@tukaani.org>2021-09-05 20:38:12 +0300
commitd267d109c370a40b502e73f8664b154b15e4f253 (patch)
tree0159c362319f4c47d309b8ed09db97998ddbf02d
parentxzdiff: Update the man page about the exit status. (diff)
downloadxz-d267d109c370a40b502e73f8664b154b15e4f253.tar.xz
liblzma: Rename EROFS LZMA to MicroLZMA.
It still exists primarily for EROFS but MicroLZMA is a more generic name (that hopefully doesn't clash with something that already exists).
Diffstat (limited to '')
-rw-r--r--src/liblzma/api/lzma/container.h33
-rw-r--r--src/liblzma/common/Makefile.inc4
-rw-r--r--src/liblzma/common/microlzma_decoder.c (renamed from src/liblzma/common/erofs_decoder.c)32
-rw-r--r--src/liblzma/common/microlzma_encoder.c (renamed from src/liblzma/common/erofs_encoder.c)30
4 files changed, 52 insertions, 47 deletions
diff --git a/src/liblzma/api/lzma/container.h b/src/liblzma/api/lzma/container.h
index 4ad7ce6a..cbb37c8b 100644
--- a/src/liblzma/api/lzma/container.h
+++ b/src/liblzma/api/lzma/container.h
@@ -445,18 +445,18 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
/**
- * \brief EROFS LZMA encoder
+ * \brief MicroLZMA encoder
*
- * The EROFS LZMA format is a raw LZMA stream whose first byte (always 0x00)
+ * The MicroLZMA format is a raw LZMA stream whose first byte (always 0x00)
* has been replaced with bitwise-negation of the LZMA properties (lc/lp/pb).
- * This encoding ensures that the first byte of EROFS LZMA stream is never
+ * This encoding ensures that the first byte of MicroLZMA stream is never
* 0x00. There is no end of payload marker and thus the uncompressed size
* must be stored separately. For the best error detection the dictionary
* size should be stored separately as well but alternatively one may use
* the uncompressed size as the dictionary size when decoding.
*
- * With the EROFS LZMA encoder, lzma_code() behaves slightly unusually.
- * The action argument must be LZMA_FINISH and the return value cannot be
+ * With the MicroLZMA encoder, lzma_code() behaves slightly unusually.
+ * The action argument must be LZMA_FINISH and the return value will never be
* LZMA_OK. Thus the encoding is always done with a single lzma_code() after
* the initialization. The benefit of the combination of initialization
* function and lzma_code() is that memory allocations can be re-used for
@@ -479,6 +479,11 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
* size is 4 KiB, dictionary size of 32 KiB or 64 KiB is good. If the
* data compresses extremely well, even 128 KiB may be useful.
*
+ * The MicroLZMA format and this encoder variant were made with the EROFS
+ * file system in mind. This format may be convenient in other embedded
+ * uses too where many small streams are needed. XZ Embedded includes a
+ * decoder for this format.
+ *
* \return - LZMA_STREAM_END: All good. Check the amounts of input used
* and output produced. Store the amount of input used
* (uncompressed size) as it needs to be known to decompress
@@ -487,9 +492,9 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
* - LZMA_MEM_ERROR
* - LZMA_PROG_ERROR: In addition to the generic reasons for this
* error code, this may also be returned if there isn't enough
- * output space (6 bytes) to create a valid EROFS LZMA stream.
+ * output space (6 bytes) to create a valid MicroLZMA stream.
*/
-extern LZMA_API(lzma_ret) lzma_erofs_encoder(
+extern LZMA_API(lzma_ret) lzma_microlzma_encoder(
lzma_stream *strm, const lzma_options_lzma *options);
@@ -682,17 +687,17 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
/**
- * \brief EROFS LZMA decoder
+ * \brief MicroLZMA decoder
*
- * See lzma_erofs_decoder() for more information.
+ * See lzma_microlzma_decoder() for more information.
*
- * The lzma_code() usage with this decoder is completely normal.
- * The special behavior of lzma_code() applies to lzma_erofs_encoder() only.
+ * The lzma_code() usage with this decoder is completely normal. The
+ * special behavior of lzma_code() applies to lzma_microlzma_encoder() only.
*
* \param strm Pointer to properly prepared lzma_stream
- * \param comp_size Compressed size of the EROFS LZMA stream.
+ * \param comp_size Compressed size of the MicroLZMA stream.
* The caller must somehow know this exactly.
- * \param uncomp_size Uncompressed size of the EROFS LZMA stream.
+ * \param uncomp_size Uncompressed size of the MicroLZMA stream.
* If the exact uncompressed size isn't known, this
* can be set to a value that is at most as big as
* the exact uncompressed size would be, but then the
@@ -715,7 +720,7 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
* affect the memory usage if one specifies bigger
* dictionary than actually required.)
*/
-extern LZMA_API(lzma_ret) lzma_erofs_decoder(
+extern LZMA_API(lzma_ret) lzma_microlzma_decoder(
lzma_stream *strm, uint64_t comp_size,
uint64_t uncomp_size, lzma_bool uncomp_size_is_exact,
uint32_t dict_size);
diff --git a/src/liblzma/common/Makefile.inc b/src/liblzma/common/Makefile.inc
index 8205eb7f..1a4fb126 100644
--- a/src/liblzma/common/Makefile.inc
+++ b/src/liblzma/common/Makefile.inc
@@ -36,7 +36,7 @@ liblzma_la_SOURCES += \
common/easy_buffer_encoder.c \
common/easy_encoder.c \
common/easy_encoder_memusage.c \
- common/erofs_encoder.c \
+ common/microlzma_encoder.c \
common/filter_buffer_encoder.c \
common/filter_encoder.c \
common/filter_encoder.h \
@@ -66,7 +66,7 @@ liblzma_la_SOURCES += \
common/block_decoder.h \
common/block_header_decoder.c \
common/easy_decoder_memusage.c \
- common/erofs_decoder.c \
+ common/microlzma_decoder.c \
common/file_info.c \
common/filter_buffer_decoder.c \
common/filter_decoder.c \
diff --git a/src/liblzma/common/erofs_decoder.c b/src/liblzma/common/microlzma_decoder.c
index 9264adda..37907109 100644
--- a/src/liblzma/common/erofs_decoder.c
+++ b/src/liblzma/common/microlzma_decoder.c
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
//
-/// \file erofs_decoder.c
-/// \brief Decode EROFS LZMA format
+/// \file microlzma_decoder.c
+/// \brief Decode MicroLZMA format
//
// Author: Lasse Collin
//
@@ -39,19 +39,19 @@ typedef struct {
/// uncomp_size may never be bigger than the real uncompressed size.
bool uncomp_size_is_exact;
- /// True once the first byte of the EROFS LZMA stream
+ /// True once the first byte of the MicroLZMA stream
/// has been processed.
bool props_decoded;
-} lzma_erofs_coder;
+} lzma_microlzma_coder;
static lzma_ret
-erofs_decode(void *coder_ptr, const lzma_allocator *allocator,
+microlzma_decode(void *coder_ptr, const lzma_allocator *allocator,
const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size, uint8_t *restrict out,
size_t *restrict out_pos, size_t out_size, lzma_action action)
{
- lzma_erofs_coder *coder = coder_ptr;
+ lzma_microlzma_coder *coder = coder_ptr;
// Remember the in start position so that we can update comp_size.
const size_t in_start = *in_pos;
@@ -157,9 +157,9 @@ erofs_decode(void *coder_ptr, const lzma_allocator *allocator,
static void
-erofs_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
+microlzma_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
- lzma_erofs_coder *coder = coder_ptr;
+ lzma_microlzma_coder *coder = coder_ptr;
lzma_next_end(&coder->lzma, allocator);
lzma_free(coder, allocator);
return;
@@ -167,23 +167,23 @@ erofs_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
static lzma_ret
-erofs_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
+microlzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
uint64_t comp_size,
uint64_t uncomp_size, bool uncomp_size_is_exact,
uint32_t dict_size)
{
- lzma_next_coder_init(&erofs_decoder_init, next, allocator);
+ lzma_next_coder_init(&microlzma_decoder_init, next, allocator);
- lzma_erofs_coder *coder = next->coder;
+ lzma_microlzma_coder *coder = next->coder;
if (coder == NULL) {
- coder = lzma_alloc(sizeof(lzma_erofs_coder), allocator);
+ coder = lzma_alloc(sizeof(lzma_microlzma_coder), allocator);
if (coder == NULL)
return LZMA_MEM_ERROR;
next->coder = coder;
- next->code = &erofs_decode;
- next->end = &erofs_decoder_end;
+ next->code = &microlzma_decode;
+ next->end = &microlzma_decoder_end;
coder->lzma = LZMA_NEXT_CODER_INIT;
}
@@ -205,11 +205,11 @@ erofs_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
-lzma_erofs_decoder(lzma_stream *strm, uint64_t comp_size,
+lzma_microlzma_decoder(lzma_stream *strm, uint64_t comp_size,
uint64_t uncomp_size, lzma_bool uncomp_size_is_exact,
uint32_t dict_size)
{
- lzma_next_strm_init(erofs_decoder_init, strm, comp_size,
+ lzma_next_strm_init(microlzma_decoder_init, strm, comp_size,
uncomp_size, uncomp_size_is_exact, dict_size);
strm->internal->supported_actions[LZMA_RUN] = true;
diff --git a/src/liblzma/common/erofs_encoder.c b/src/liblzma/common/microlzma_encoder.c
index 4cdd08f1..072b500f 100644
--- a/src/liblzma/common/erofs_encoder.c
+++ b/src/liblzma/common/microlzma_encoder.c
@@ -1,7 +1,7 @@
///////////////////////////////////////////////////////////////////////////////
//
-/// \file erofs_encoder.c
-/// \brief Encode into EROFS LZMA format
+/// \file microlzma_encoder.c
+/// \brief Encode into MicroLZMA format
//
// Author: Lasse Collin
//
@@ -19,16 +19,16 @@ typedef struct {
/// LZMA properties byte (lc/lp/pb)
uint8_t props;
-} lzma_erofs_coder;
+} lzma_microlzma_coder;
static lzma_ret
-erofs_encode(void *coder_ptr, const lzma_allocator *allocator,
+microlzma_encode(void *coder_ptr, const lzma_allocator *allocator,
const uint8_t *restrict in, size_t *restrict in_pos,
size_t in_size, uint8_t *restrict out,
size_t *restrict out_pos, size_t out_size, lzma_action action)
{
- lzma_erofs_coder *coder = coder_ptr;
+ lzma_microlzma_coder *coder = coder_ptr;
// Remember *out_pos so that we can overwrite the first byte with
// the LZMA properties byte.
@@ -80,9 +80,9 @@ erofs_encode(void *coder_ptr, const lzma_allocator *allocator,
static void
-erofs_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
+microlzma_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
{
- lzma_erofs_coder *coder = coder_ptr;
+ lzma_microlzma_coder *coder = coder_ptr;
lzma_next_end(&coder->lzma, allocator);
lzma_free(coder, allocator);
return;
@@ -90,21 +90,21 @@ erofs_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
static lzma_ret
-erofs_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
+microlzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
const lzma_options_lzma *options)
{
- lzma_next_coder_init(&erofs_encoder_init, next, allocator);
+ lzma_next_coder_init(&microlzma_encoder_init, next, allocator);
- lzma_erofs_coder *coder = next->coder;
+ lzma_microlzma_coder *coder = next->coder;
if (coder == NULL) {
- coder = lzma_alloc(sizeof(lzma_erofs_coder), allocator);
+ coder = lzma_alloc(sizeof(lzma_microlzma_coder), allocator);
if (coder == NULL)
return LZMA_MEM_ERROR;
next->coder = coder;
- next->code = &erofs_encode;
- next->end = &erofs_encoder_end;
+ next->code = &microlzma_encode;
+ next->end = &microlzma_encoder_end;
coder->lzma = LZMA_NEXT_CODER_INIT;
}
@@ -128,9 +128,9 @@ erofs_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
extern LZMA_API(lzma_ret)
-lzma_erofs_encoder(lzma_stream *strm, const lzma_options_lzma *options)
+lzma_microlzma_encoder(lzma_stream *strm, const lzma_options_lzma *options)
{
- lzma_next_strm_init(erofs_encoder_init, strm, options);
+ lzma_next_strm_init(microlzma_encoder_init, strm, options);
strm->internal->supported_actions[LZMA_FINISH] = true;