Skip to content

Commit

Permalink
Merge pull request #129 from Gottox/improve/rearrange-data-definitions
Browse files Browse the repository at this point in the history
rearrange data definitions
  • Loading branch information
Gottox committed Sep 7, 2023
2 parents 8e60931 + 77f23db commit 8e52424
Show file tree
Hide file tree
Showing 74 changed files with 714 additions and 753 deletions.
1 change: 1 addition & 0 deletions include/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ headers = files(
'sqsh_archive.h',
'sqsh_archive_private.h',
'sqsh_common.h',
'sqsh_data.h',
'sqsh_data_private.h',
'sqsh_directory.h',
'sqsh_directory_private.h',
Expand Down
72 changes: 1 addition & 71 deletions include/sqsh_archive.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#define SQSH_ARCHIVE_H

#include "sqsh_common.h"
#include "sqsh_data.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -137,36 +138,6 @@ SQSH_NO_UNUSED int sqsh_inode_map_set2(
* archive/superblock_context.c
*/

/**
* @brief The compression used in the archive.
*/
enum SqshSuperblockCompressionId {
SQSH_COMPRESSION_GZIP = 1,
SQSH_COMPRESSION_LZMA = 2,
SQSH_COMPRESSION_LZO = 3,
SQSH_COMPRESSION_XZ = 4,
SQSH_COMPRESSION_LZ4 = 5,
SQSH_COMPRESSION_ZSTD = 6
};

/**
* @brief The flags used in the superblock.
*/
enum SqshSuperblockFlags {
SQSH_SUPERBLOCK_UNCOMPRESSED_INODES = 0x0001,
SQSH_SUPERBLOCK_UNCOMPRESSED_DATA = 0x0002,
SQSH_SUPERBLOCK_CHECK = 0x0004,
SQSH_SUPERBLOCK_UNCOMPRESSED_FRAGMENTS = 0x0008,
SQSH_SUPERBLOCK_NO_FRAGMENTS = 0x0010,
SQSH_SUPERBLOCK_ALWAYS_FRAGMENTS = 0x0020,
SQSH_SUPERBLOCK_DUPLICATES = 0x0040,
SQSH_SUPERBLOCK_EXPORTABLE = 0x0080,
SQSH_SUPERBLOCK_UNCOMPRESSED_XATTRS = 0x0100,
SQSH_SUPERBLOCK_NO_XATTRS = 0x0200,
SQSH_SUPERBLOCK_COMPRESSOR_OPTIONS = 0x0400,
SQSH_SUPERBLOCK_UNCOMPRESSED_IDS = 0x0800
};

struct SqshSuperblock;

/**
Expand Down Expand Up @@ -602,47 +573,6 @@ int sqsh_archive_close(struct SqshArchive *archive);
* archive/compression_options_context.c
*/

/**
* @brief definitions of gzip strategies
*/
enum SqshGzipStrategies {
SQSH_GZIP_STRATEGY_NONE = 0x0,
SQSH_GZIP_STRATEGY_DEFAULT = 0x0001,
SQSH_GZIP_STRATEGY_FILTERED = 0x0002,
SQSH_GZIP_STRATEGY_HUFFMAN_ONLY = 0x0004,
SQSH_GZIP_STRATEGY_RLE = 0x0008,
SQSH_GZIP_STRATEGY_FIXED = 0x0010
};
/**
* @brief definitions xz filters
*/
enum SqshXzFilters {
SQSH_XZ_FILTER_NONE = 0x0,
SQSH_XZ_FILTER_X86 = 0x0001,
SQSH_XZ_FILTER_POWERPC = 0x0002,
SQSH_XZ_FILTER_IA64 = 0x0004,
SQSH_XZ_FILTER_ARM = 0x0008,
SQSH_XZ_FILTER_ARMTHUMB = 0x0010,
SQSH_XZ_FILTER_SPARC = 0x0020
};
/**
* @brief definitions of lz4 flags
*/
enum SqshLz4Flags {
SQS_LZ4_FLAG_NONE = 0x0,
SQSH_LZ4_HIGH_COMPRESSION = 0x0001
};
/**
* @brief definitions of Lzo algorithms
*/
enum SqshLzoAlgorithm {
SQSH_LZO_ALGORITHM_LZO1X_1 = 0x0000,
SQSH_LZO_ALGORITHM_LZO1X_1_11 = 0x0001,
SQSH_LZO_ALGORITHM_LZO1X_1_12 = 0x0002,
SQSH_LZO_ALGORITHM_LZO1X_1_15 = 0x0003,
SQSH_LZO_ALGORITHM_LZO1X_999 = 0x0004
};

/**
* @memberof SqshCompressionOptions
* @brief Initializes a SqshCompressionOptions struct.
Expand Down
141 changes: 141 additions & 0 deletions include/sqsh_data.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/******************************************************************************
* *
* Copyright (c) 2023, Enno Boland <[email protected]> *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions are *
* met: *
* *
* * Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* * Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS *
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, *
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR *
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR *
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
******************************************************************************/

/**
* @author Enno Boland ([email protected])
* @file sqsh_data.h
*/

#ifndef SQSH_DATA_H
#define SQSH_DATA_H

#include "sqsh_common.h"

#ifdef __cplusplus
extern "C" {
#endif

/***************************************
* data/superblock_data.c
*/

/**
* @brief The compression used in the archive.
*/
enum SqshSuperblockCompressionId {
SQSH_COMPRESSION_GZIP = 1,
SQSH_COMPRESSION_LZMA = 2,
SQSH_COMPRESSION_LZO = 3,
SQSH_COMPRESSION_XZ = 4,
SQSH_COMPRESSION_LZ4 = 5,
SQSH_COMPRESSION_ZSTD = 6
};

/**
* @brief The flags used in the superblock.
*/
enum SqshSuperblockFlags {
SQSH_SUPERBLOCK_UNCOMPRESSED_INODES = 0x0001,
SQSH_SUPERBLOCK_UNCOMPRESSED_DATA = 0x0002,
SQSH_SUPERBLOCK_CHECK = 0x0004,
SQSH_SUPERBLOCK_UNCOMPRESSED_FRAGMENTS = 0x0008,
SQSH_SUPERBLOCK_NO_FRAGMENTS = 0x0010,
SQSH_SUPERBLOCK_ALWAYS_FRAGMENTS = 0x0020,
SQSH_SUPERBLOCK_DUPLICATES = 0x0040,
SQSH_SUPERBLOCK_EXPORTABLE = 0x0080,
SQSH_SUPERBLOCK_UNCOMPRESSED_XATTRS = 0x0100,
SQSH_SUPERBLOCK_NO_XATTRS = 0x0200,
SQSH_SUPERBLOCK_COMPRESSOR_OPTIONS = 0x0400,
SQSH_SUPERBLOCK_UNCOMPRESSED_IDS = 0x0800
};

/***************************************
* data/compression_options_data.c
*/

/**
* @brief definitions of gzip strategies
*/
enum SqshGzipStrategies {
SQSH_GZIP_STRATEGY_NONE = 0x0,
SQSH_GZIP_STRATEGY_DEFAULT = 0x0001,
SQSH_GZIP_STRATEGY_FILTERED = 0x0002,
SQSH_GZIP_STRATEGY_HUFFMAN_ONLY = 0x0004,
SQSH_GZIP_STRATEGY_RLE = 0x0008,
SQSH_GZIP_STRATEGY_FIXED = 0x0010
};

/**
* @brief definitions xz filters
*/
enum SqshXzFilters {
SQSH_XZ_FILTER_NONE = 0x0,
SQSH_XZ_FILTER_X86 = 0x0001,
SQSH_XZ_FILTER_POWERPC = 0x0002,
SQSH_XZ_FILTER_IA64 = 0x0004,
SQSH_XZ_FILTER_ARM = 0x0008,
SQSH_XZ_FILTER_ARMTHUMB = 0x0010,
SQSH_XZ_FILTER_SPARC = 0x0020
};

/**
* @brief definitions of lz4 flags
*/
enum SqshLz4Flags {
SQS_LZ4_FLAG_NONE = 0x0,
SQSH_LZ4_HIGH_COMPRESSION = 0x0001
};

/**
* @brief definitions of Lzo algorithms
*/
enum SqshLzoAlgorithm {
SQSH_LZO_ALGORITHM_LZO1X_1 = 0x0000,
SQSH_LZO_ALGORITHM_LZO1X_1_11 = 0x0001,
SQSH_LZO_ALGORITHM_LZO1X_1_12 = 0x0002,
SQSH_LZO_ALGORITHM_LZO1X_1_15 = 0x0003,
SQSH_LZO_ALGORITHM_LZO1X_999 = 0x0004
};

/***************************************
* data/xattr_data.c
*/

/**
* @brief The type of an external attribute.
*/
enum SqshXattrType {
SQSH_XATTR_USER = 0,
SQSH_XATTR_TRUSTED = 1,
SQSH_XATTR_SECURITY = 2
};

#ifdef __cplusplus
}
#endif
#endif /* SQSH_DATA_H */
Loading

0 comments on commit 8e52424

Please sign in to comment.