compress: make Compression a regular non-sparse enum
Given we have two different types for the journal object flags and the Compression enum, let's make the latter a regular non-sparse enum, and thus remove some surprises. We have to convert anyway between the two, and already do via COMPRESSION_FROM_OBJECT().
This commit is contained in:
@@ -58,11 +58,10 @@ static int zstd_ret_to_errno(size_t ret) {
|
||||
#define ALIGN_8(l) ALIGN_TO(l, sizeof(size_t))
|
||||
|
||||
static const char* const compression_table[_COMPRESSION_MAX] = {
|
||||
[COMPRESSION_NONE] = "NONE",
|
||||
[COMPRESSION_XZ] = "XZ",
|
||||
[COMPRESSION_LZ4] = "LZ4",
|
||||
[COMPRESSION_ZSTD] = "ZSTD",
|
||||
/* If we add too many more entries here, it's going to grow quite large (and be mostly sparse), since
|
||||
* the array key is actually a bitmask, not a plain enum */
|
||||
};
|
||||
|
||||
DEFINE_STRING_TABLE_LOOKUP(compression, Compression);
|
||||
|
||||
@@ -4,12 +4,10 @@
|
||||
#include <unistd.h>
|
||||
|
||||
typedef enum Compression {
|
||||
/* These are defined the same way as the relevant object types in journal-def.h,
|
||||
* i.e. OBJECT_COMPRESSED_XZ, … */
|
||||
COMPRESSION_NONE = 0,
|
||||
COMPRESSION_XZ = 1,
|
||||
COMPRESSION_LZ4 = 2,
|
||||
COMPRESSION_ZSTD = 4,
|
||||
COMPRESSION_NONE,
|
||||
COMPRESSION_XZ,
|
||||
COMPRESSION_LZ4,
|
||||
COMPRESSION_ZSTD,
|
||||
_COMPRESSION_MAX,
|
||||
_COMPRESSION_INVALID = -EINVAL,
|
||||
} Compression;
|
||||
|
||||
Reference in New Issue
Block a user