summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sqfs/block.h140
-rw-r--r--include/sqfs/data_writer.h109
-rw-r--r--lib/sqfs/Makemodule.am2
-rw-r--r--lib/sqfs/data_reader.c2
-rw-r--r--lib/sqfs/data_writer/internal.h1
-rw-r--r--lib/sqfs/io.c2
-rw-r--r--lib/sqfshelper/data_reader_dump.c2
-rw-r--r--lib/sqfshelper/data_writer.c2
8 files changed, 147 insertions, 113 deletions
diff --git a/include/sqfs/block.h b/include/sqfs/block.h
new file mode 100644
index 0000000..5216fd7
--- /dev/null
+++ b/include/sqfs/block.h
@@ -0,0 +1,140 @@
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
+/*
+ * block.h - This file is part of libsquashfs
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+#ifndef SQFS_BLOCK_H
+#define SQFS_BLOCK_H
+
+#include "sqfs/predef.h"
+
+/**
+ * @file block.h
+ *
+ * @brief Contains the definition of the @ref sqfs_block_t data structure.
+ */
+
+/**
+ * @enum E_SQFS_BLK_FLAGS
+ *
+ * @brief Generic flags that tell the processor what to do with a block and
+ * flags that the processor sets when it is done with a block.
+ */
+typedef enum {
+ /**
+ * @brief Only calculate checksum, do NOT compress the data.
+ */
+ SQFS_BLK_DONT_COMPRESS = 0x0001,
+
+ /**
+ * @brief Indicates that an equeued block is the first block of a file.
+ */
+ SQFS_BLK_FIRST_BLOCK = 0x0002,
+
+ /**
+ * @brief Indicates that an equeued block is the last block of a file.
+ */
+ SQFS_BLK_LAST_BLOCK = 0x0004,
+
+ /**
+ * @brief Allign the block on disk to device block size.
+ *
+ * If set in combination with @ref SQFS_BLK_FIRST_BLOCK, the output
+ * file is padded to a multiple of the device block size before writing
+ * the block.
+ *
+ * If used with @ref SQFS_BLK_LAST_BLOCK, the output file is padded
+ * after writing the block.
+ */
+ SQFS_BLK_ALLIGN = 0x0008,
+
+ /**
+ * @brief Indicates that a block is a tail end of a file and the block
+ * processor should take care of fragment packing and accounting.
+ */
+ SQFS_BLK_IS_FRAGMENT = 0x0010,
+
+ /**
+ * @brief Set by the block processor on fragment blocks that
+ * it generates.
+ */
+ SQFS_BLK_FRAGMENT_BLOCK = 0x4000,
+
+ /**
+ * @brief Set by compressor worker if the block was actually compressed.
+ */
+ SQFS_BLK_IS_COMPRESSED = 0x8000,
+
+ /**
+ * @brief The combination of all flags that are user settable.
+ */
+ SQFS_BLK_USER_SETTABLE_FLAGS = 0x001F,
+} E_SQFS_BLK_FLAGS;
+
+/**
+ * @struct sqfs_block_t
+ *
+ * @brief Encapsulates a chunk of data to be processed by the block processor.
+ */
+struct sqfs_block_t {
+ /**
+ * @brief Used internally, existing value is ignored and overwritten
+ * when enqueueing a block.
+ */
+ sqfs_block_t *next;
+
+ /**
+ * @brief Used internally, existing value is ignored and overwritten
+ * when enqueueing a block.
+ */
+ uint32_t sequence_number;
+
+ /**
+ * @brief Size of the data area.
+ */
+ uint32_t size;
+
+ /**
+ * @brief Checksum of the input data.
+ */
+ uint32_t checksum;
+
+ /**
+ * @brief Data block index within the inode.
+ */
+ uint32_t index;
+
+ /**
+ * @brief The squashfs inode related to this block.
+ */
+ sqfs_inode_generic_t *inode;
+
+ /**
+ * @brief User settable flag field.
+ *
+ * A combination of @ref E_SQFS_BLK_FLAGS and custom, user
+ * settable flags.
+ */
+ uint32_t flags;
+
+ /**
+ * @brief Raw data to be processed.
+ */
+ uint8_t data[];
+};
+
+#endif /* SQFS_BLOCK_H */
diff --git a/include/sqfs/data_writer.h b/include/sqfs/data_writer.h
index 8dedba0..3f1ad02 100644
--- a/include/sqfs/data_writer.h
+++ b/include/sqfs/data_writer.h
@@ -42,115 +42,6 @@
* is called for each one.
*/
-/**
- * @enum E_SQFS_BLK_FLAGS
- *
- * @brief Generic flags that tell the processor what to do with a block and
- * flags that the processor sets when it is done with a block.
- */
-typedef enum {
- /**
- * @brief Only calculate checksum, do NOT compress the data.
- */
- SQFS_BLK_DONT_COMPRESS = 0x0001,
-
- /**
- * @brief Indicates that an equeued block is the first block of a file.
- */
- SQFS_BLK_FIRST_BLOCK = 0x0002,
-
- /**
- * @brief Indicates that an equeued block is the last block of a file.
- */
- SQFS_BLK_LAST_BLOCK = 0x0004,
-
- /**
- * @brief Allign the block on disk to device block size.
- *
- * If set in combination with @ref SQFS_BLK_FIRST_BLOCK, the output
- * file is padded to a multiple of the device block size before writing
- * the block.
- *
- * If used with @ref SQFS_BLK_LAST_BLOCK, the output file is padded
- * after writing the block.
- */
- SQFS_BLK_ALLIGN = 0x0008,
-
- /**
- * @brief Indicates that a block is a tail end of a file and the block
- * processor should take care of fragment packing and accounting.
- */
- SQFS_BLK_IS_FRAGMENT = 0x0010,
-
- /**
- * @brief Set by the block processor on fragment blocks that
- * it generates.
- */
- SQFS_BLK_FRAGMENT_BLOCK = 0x4000,
-
- /**
- * @brief Set by compressor worker if the block was actually compressed.
- */
- SQFS_BLK_IS_COMPRESSED = 0x8000,
-
- /**
- * @brief The combination of all flags that are user settable.
- */
- SQFS_BLK_USER_SETTABLE_FLAGS = 0x001F,
-} E_SQFS_BLK_FLAGS;
-
-/**
- * @struct sqfs_block_t
- *
- * @brief Encapsulates a chunk of data to be processed by the block processor.
- */
-struct sqfs_block_t {
- /**
- * @brief Used internally, existing value is ignored and overwritten
- * when enqueueing a block.
- */
- sqfs_block_t *next;
-
- /**
- * @brief Used internally, existing value is ignored and overwritten
- * when enqueueing a block.
- */
- uint32_t sequence_number;
-
- /**
- * @brief Size of the data area.
- */
- uint32_t size;
-
- /**
- * @brief Checksum of the input data.
- */
- uint32_t checksum;
-
- /**
- * @brief Data block index within the inode.
- */
- uint32_t index;
-
- /**
- * @brief The squashfs inode related to this block.
- */
- sqfs_inode_generic_t *inode;
-
- /**
- * @brief User settable flag field.
- *
- * A combination of @ref E_SQFS_BLK_FLAGS and custom, user
- * settable flags.
- */
- uint32_t flags;
-
- /**
- * @brief Raw data to be processed.
- */
- uint8_t data[];
-};
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am
index 459f359..b07cc5b 100644
--- a/lib/sqfs/Makemodule.am
+++ b/lib/sqfs/Makemodule.am
@@ -6,7 +6,7 @@ LIBSQFS_HEARDS = include/sqfs/data.h include/sqfs/meta_writer.h \
include/sqfs/table.h include/sqfs/predef.h \
include/sqfs/error.h include/sqfs/dir_reader.h \
include/sqfs/dir_writer.h include/sqfs/io.h \
- include/sqfs/data_reader.h
+ include/sqfs/data_reader.h include/sqfs/block.h
libsquashfs_la_SOURCES = $(LIBSQFS_HEARDS) lib/sqfs/id_table.c lib/sqfs/super.c
libsquashfs_la_SOURCES += lib/sqfs/readdir.c lib/sqfs/io_file.c lib/sqfs/xattr.c
diff --git a/lib/sqfs/data_reader.c b/lib/sqfs/data_reader.c
index 0ea08ee..d8645d1 100644
--- a/lib/sqfs/data_reader.c
+++ b/lib/sqfs/data_reader.c
@@ -7,9 +7,9 @@
#define SQFS_BUILDING_DLL
#include "config.h"
-#include "sqfs/data_writer.h"
#include "sqfs/data_reader.h"
#include "sqfs/compress.h"
+#include "sqfs/block.h"
#include "sqfs/error.h"
#include "sqfs/table.h"
#include "sqfs/inode.h"
diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/data_writer/internal.h
index 10cc82c..69de9ac 100644
--- a/lib/sqfs/data_writer/internal.h
+++ b/lib/sqfs/data_writer/internal.h
@@ -14,6 +14,7 @@
#include "sqfs/inode.h"
#include "sqfs/table.h"
#include "sqfs/error.h"
+#include "sqfs/block.h"
#include "sqfs/data.h"
#include "sqfs/io.h"
#include "util.h"
diff --git a/lib/sqfs/io.c b/lib/sqfs/io.c
index 40bf5d8..f4ffda2 100644
--- a/lib/sqfs/io.c
+++ b/lib/sqfs/io.c
@@ -9,7 +9,7 @@
#include "sqfs/io.h"
#include "sqfs/error.h"
-#include "sqfs/data_writer.h"
+#include "sqfs/block.h"
#include "util.h"
#include <stdlib.h>
diff --git a/lib/sqfshelper/data_reader_dump.c b/lib/sqfshelper/data_reader_dump.c
index fa876c3..5675469 100644
--- a/lib/sqfshelper/data_reader_dump.c
+++ b/lib/sqfshelper/data_reader_dump.c
@@ -6,8 +6,8 @@
*/
#include "config.h"
-#include "sqfs/data_writer.h"
#include "sqfs/data_reader.h"
+#include "sqfs/block.h"
#include "highlevel.h"
#include "util.h"
diff --git a/lib/sqfshelper/data_writer.c b/lib/sqfshelper/data_writer.c
index e2a8538..4134035 100644
--- a/lib/sqfshelper/data_writer.c
+++ b/lib/sqfshelper/data_writer.c
@@ -7,6 +7,8 @@
#include "config.h"
#include "sqfs/data_writer.h"
+#include "sqfs/block.h"
+
#include "data_writer.h"
#include "highlevel.h"
#include "util.h"