aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-28 21:23:21 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-01-29 17:22:50 +0100
commit9d5b0c381a7961a14d2a94a6b31a4e25a2543eae (patch)
tree089a3cc96f54cd7b09762840d03e4dc2420c5ea9 /include
parent60ff56b68ea0593782d7a2ef0ac4e667437418d2 (diff)
Rename sqfs_data_writer_t back to sqfs_block_processor_t
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include')
-rw-r--r--include/common.h15
-rw-r--r--include/sqfs/block.h18
-rw-r--r--include/sqfs/block_processor.h (renamed from include/sqfs/data_writer.h)96
-rw-r--r--include/sqfs/predef.h2
4 files changed, 67 insertions, 64 deletions
diff --git a/include/common.h b/include/common.h
index 386d8fd..f2431ab 100644
--- a/include/common.h
+++ b/include/common.h
@@ -18,7 +18,7 @@
#include "sqfs/error.h"
#include "sqfs/meta_writer.h"
#include "sqfs/data_reader.h"
-#include "sqfs/data_writer.h"
+#include "sqfs/block_processor.h"
#include "sqfs/dir_writer.h"
#include "sqfs/dir_reader.h"
#include "sqfs/block.h"
@@ -42,10 +42,10 @@ typedef struct {
size_t frag_dup;
sqfs_u64 bytes_written;
sqfs_u64 bytes_read;
-} data_writer_stats_t;
+} block_processor_stats_t;
typedef struct {
- sqfs_data_writer_t *data;
+ sqfs_block_processor_t *data;
sqfs_dir_writer_t *dirwr;
sqfs_meta_writer_t *dm;
sqfs_meta_writer_t *im;
@@ -54,7 +54,7 @@ typedef struct {
sqfs_file_t *outfile;
sqfs_super_t super;
fstree_t fs;
- data_writer_stats_t stats;
+ block_processor_stats_t stats;
sqfs_xattr_writer_t *xwr;
} sqfs_writer_t;
@@ -99,7 +99,7 @@ typedef struct sqfs_hard_link_t {
int sqfs_serialize_fstree(const char *filename, sqfs_writer_t *wr);
/* Print out fancy statistics for squashfs packing tools */
-void sqfs_print_statistics(sqfs_super_t *super, data_writer_stats_t *stats);
+void sqfs_print_statistics(sqfs_super_t *super, block_processor_stats_t *stats);
void compressor_print_available(void);
@@ -122,9 +122,10 @@ int sqfs_data_reader_dump(const char *name, sqfs_data_reader_t *data,
sqfs_file_t *sqfs_get_stdin_file(FILE *fp, const sparse_map_t *map,
sqfs_u64 size);
-void register_stat_hooks(sqfs_data_writer_t *data, data_writer_stats_t *stats);
+void register_stat_hooks(sqfs_block_processor_t *data,
+ block_processor_stats_t *stats);
-int write_data_from_file(const char *filename, sqfs_data_writer_t *data,
+int write_data_from_file(const char *filename, sqfs_block_processor_t *data,
sqfs_inode_generic_t *inode,
sqfs_file_t *file, int flags);
diff --git a/include/sqfs/block.h b/include/sqfs/block.h
index b37cdd5..1098c96 100644
--- a/include/sqfs/block.h
+++ b/include/sqfs/block.h
@@ -68,14 +68,14 @@ typedef enum {
* @brief Only calculate checksum, do NOT compress the data.
*
* If set, the blocks of a file will not be compressed by the
- * @ref sqfs_data_writer_t.
+ * @ref sqfs_block_processor_t.
*/
SQFS_BLK_DONT_COMPRESS = 0x0001,
/**
* @brief Align the block on disk to device block size.
*
- * If set, the @ref sqfs_data_writer_t will add padding before the
+ * If set, the @ref sqfs_block_processor_t will add padding before the
* first block of the affected file and after the last block.
*/
SQFS_BLK_ALIGN = 0x0002,
@@ -83,38 +83,38 @@ typedef enum {
/**
* @brief Don't add the tail end of a file to a fragment block.
*
- * If set, the @ref sqfs_data_writer_t will always generate a final
+ * If set, the @ref sqfs_block_processor_t will always generate a final
* block for a file, even if it is truncated. It will not add the
* tail end to a fragment block.
*/
SQFS_BLK_DONT_FRAGMENT = 0x0004,
/**
- * @brief Set by the @ref sqfs_data_writer_t on the first
+ * @brief Set by the @ref sqfs_block_processor_t on the first
* block of a file.
*/
SQFS_BLK_FIRST_BLOCK = 0x0800,
/**
- * @brief Set by the @ref sqfs_data_writer_t on the last
+ * @brief Set by the @ref sqfs_block_processor_t on the last
* block of a file.
*/
SQFS_BLK_LAST_BLOCK = 0x1000,
/**
- * @brief Set by the @ref sqfs_data_writer_t to indicate that a block
- * is a tail end of a file and the block.
+ * @brief Set by the @ref sqfs_block_processor_t to indicate that a
+ * block is a tail end of a file and the block.
*/
SQFS_BLK_IS_FRAGMENT = 0x2000,
/**
- * @brief Set by the @ref sqfs_data_writer_t on fragment blocks that
+ * @brief Set by the @ref sqfs_block_processor_t on fragment blocks that
* it generates.
*/
SQFS_BLK_FRAGMENT_BLOCK = 0x4000,
/**
- * @brief Set by @ref sqfs_data_writer_t if the block was
+ * @brief Set by @ref sqfs_block_processor_t if the block was
* actually compressed.
*/
SQFS_BLK_IS_COMPRESSED = 0x8000,
diff --git a/include/sqfs/data_writer.h b/include/sqfs/block_processor.h
index 7b6ee0f..c6dd734 100644
--- a/include/sqfs/data_writer.h
+++ b/include/sqfs/block_processor.h
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
- * data_writer.h - This file is part of libsquashfs
+ * block_processor.h - This file is part of libsquashfs
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*
@@ -17,25 +17,26 @@
* 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 SFQS_DATA_WRITER_H
-#define SFQS_DATA_WRITER_H
+#ifndef SFQS_BLOCK_PROCESSOR_H
+#define SFQS_BLOCK_PROCESSOR_H
#include "sqfs/predef.h"
/**
- * @file data_writer.h
+ * @file block_processor.h
*
* @brief Contains declarations for the data block processor.
*/
/**
- * @struct sqfs_data_writer_t
+ * @struct sqfs_block_processor_t
*
* @brief Abstracts generating of file data and fragment blocks.
*
* This data structure provides a simple begin/append/end interface
- * to generate file data blocks (see @ref sqfs_data_writer_begin_file,
- * @ref sqfs_data_writer_append and @ref sqfs_data_writer_end respectively).
+ * to generate file data blocks (see @ref sqfs_block_processor_begin_file,
+ * @ref sqfs_block_processor_append and @ref sqfs_block_processor_end
+ * respectively).
*
* Internally it takes care of partitioning data in the correct block sizes,
* adding tail-ens to fragment blocks, compressing the data, deduplicating data
@@ -47,7 +48,7 @@
*
* @brief A set of hooks for tapping into the data writer.
*
- * This structure can be registered with an @ref sqfs_data_writer_t and
+ * This structure can be registered with an @ref sqfs_block_processor_t and
* contains function pointers that will be called during various stages
* when writing data to disk.
*
@@ -63,9 +64,9 @@ struct sqfs_block_hooks_t {
*
* This is required for future expandabillity while maintaining ABI
* compatibillity. At the current time, the implementation of
- * @ref sqfs_data_writer_set_hooks rejects any hook struct where this
- * isn't the exact size. If new hooks are added in the future, the
- * struct grows and the future implementation can tell by the size
+ * @ref sqfs_block_processor_set_hooks rejects any hook struct where
+ * this isn't the exact size. If new hooks are added in the future,
+ * the struct grows and the future implementation can tell by the size
* whether the application uses the new version or the old one.
*/
size_t size;
@@ -155,7 +156,7 @@ extern "C" {
/**
* @brief Create a data block writer.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
* @param max_block_size The maximum size of a data block. Required for the
* internal scratch buffer used for compressing data.
@@ -174,39 +175,40 @@ extern "C" {
* failure or on failure to create and initialize the worker threads.
*/
SQFS_API
-sqfs_data_writer_t *sqfs_data_writer_create(size_t max_block_size,
- sqfs_compressor_t *cmp,
- unsigned int num_workers,
- size_t max_backlog,
- size_t devblksz,
- sqfs_file_t *file);
+sqfs_block_processor_t *sqfs_block_processor_create(size_t max_block_size,
+ sqfs_compressor_t *cmp,
+ unsigned int num_workers,
+ size_t max_backlog,
+ size_t devblksz,
+ sqfs_file_t *file);
/**
* @brief Destroy a data writer and free all memory used by it.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
* @param proc A pointer to a data writer object.
*/
-SQFS_API void sqfs_data_writer_destroy(sqfs_data_writer_t *proc);
+SQFS_API void sqfs_block_processor_destroy(sqfs_block_processor_t *proc);
/**
* @brief Start writing a file.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
- * After calling this function, call @ref sqfs_data_writer_append repeatedly to
- * add data to the file. Finally call @ref sqfs_data_writer_end_file when you
- * are done. After writing all files, use @ref sqfs_data_writer_finish to wait
- * until all blocks that are still in flight are done and written to disk.
+ * After calling this function, call @ref sqfs_block_processor_append
+ * repeatedly to add data to the file. Finally
+ * call @ref sqfs_block_processor_end_file when you
+ * are done. After writing all files, use @ref sqfs_block_processor_finish to
+ * wait until all blocks that are still in flight are done and written to disk.
*
* The specified inode pointer is kept internally and updated with the
* compressed block sizes and final destinations of the file and possible
* fragment. You need to make sure it has enough backing-store for all blocks
* to come. Furthermore, since there can still be blocks in-flight even after
- * calling @ref sqfs_data_writer_end_file, the data in the inode may still
+ * calling @ref sqfs_block_processor_end_file, the data in the inode may still
* change. The only point at which the data writer is guarnteed to not touch
- * them anymore is after @ref sqfs_data_writer_finish has returned.
+ * them anymore is after @ref sqfs_block_processor_finish has returned.
*
* @param proc A pointer to a data writer object.
* @param inode The regular file inode representing the file. The data writer
@@ -216,16 +218,16 @@ SQFS_API void sqfs_data_writer_destroy(sqfs_data_writer_t *proc);
*
* @return Zero on success, an @ref E_SQFS_ERROR value on failure.
*/
-SQFS_API int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc,
- sqfs_inode_generic_t *inode,
- sqfs_u32 flags);
+SQFS_API int sqfs_block_processor_begin_file(sqfs_block_processor_t *proc,
+ sqfs_inode_generic_t *inode,
+ sqfs_u32 flags);
/**
* @brief Append data to the current file.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
- * Call this after @ref sqfs_data_writer_begin_file to add data to a file.
+ * Call this after @ref sqfs_block_processor_begin_file to add data to a file.
*
* @param proc A pointer to a data writer object.
* @param data A pointer to a buffer to read data from.
@@ -234,32 +236,32 @@ SQFS_API int sqfs_data_writer_begin_file(sqfs_data_writer_t *proc,
*
* @return Zero on success, an @ref E_SQFS_ERROR value on failure.
*/
-SQFS_API int sqfs_data_writer_append(sqfs_data_writer_t *proc,
- const void *data, size_t size);
+SQFS_API int sqfs_block_processor_append(sqfs_block_processor_t *proc,
+ const void *data, size_t size);
/**
* @brief Stop writing the current file and flush everything that is
* buffered internally.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
- * The counter part to @ref sqfs_data_writer_begin_file.
+ * The counter part to @ref sqfs_block_processor_begin_file.
*
* Even after calling this, there might still be data blocks in-flight.
- * Use @ref sqfs_data_writer_finish when you are done writing files to force
+ * Use @ref sqfs_block_processor_finish when you are done writing files to force
* the remaining blocks to be processed and written to disk.
*
* @param proc A pointer to a data writer object.
*
* @return Zero on success, an @ref E_SQFS_ERROR value on failure.
*/
-SQFS_API int sqfs_data_writer_end_file(sqfs_data_writer_t *proc);
+SQFS_API int sqfs_block_processor_end_file(sqfs_block_processor_t *proc);
/**
* @brief Wait for the in-flight data blocks to finish and finally flush the
* current fragment block.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
* @param proc A pointer to a block processor object.
*
@@ -267,12 +269,12 @@ SQFS_API int sqfs_data_writer_end_file(sqfs_data_writer_t *proc);
* return value can either be an error encountered during enqueueing,
* processing or writing to disk.
*/
-SQFS_API int sqfs_data_writer_finish(sqfs_data_writer_t *proc);
+SQFS_API int sqfs_block_processor_finish(sqfs_block_processor_t *proc);
/**
* @brief Write the completed fragment table to disk.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
* Call this after producing the inode and directory table to generate
* the fragment table for the squashfs image.
@@ -284,13 +286,13 @@ SQFS_API int sqfs_data_writer_finish(sqfs_data_writer_t *proc);
* @return Zero on success, an @ref E_SQFS_ERROR value on failure.
*/
SQFS_API
-int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc,
- sqfs_super_t *super);
+int sqfs_block_processor_write_fragment_table(sqfs_block_processor_t *proc,
+ sqfs_super_t *super);
/**
* @brief Register a set of hooks to be invoked when writing blocks to disk.
*
- * @memberof sqfs_data_writer_t
+ * @memberof sqfs_block_processor_t
*
* @param proc A pointer to a data writer object.
* @param user_ptr A user pointer to pass to the callbacks.
@@ -300,11 +302,11 @@ int sqfs_data_writer_write_fragment_table(sqfs_data_writer_t *proc,
* the hooks doesn't match any size knwon to the library.
*/
SQFS_API
-int sqfs_data_writer_set_hooks(sqfs_data_writer_t *proc, void *user_ptr,
- const sqfs_block_hooks_t *hooks);
+int sqfs_block_processor_set_hooks(sqfs_block_processor_t *proc, void *user_ptr,
+ const sqfs_block_hooks_t *hooks);
#ifdef __cplusplus
}
#endif
-#endif /* SFQS_DATA_WRITER_H */
+#endif /* SFQS_BLOCK_PROCESSOR_H */
diff --git a/include/sqfs/predef.h b/include/sqfs/predef.h
index 234b015..924aecc 100644
--- a/include/sqfs/predef.h
+++ b/include/sqfs/predef.h
@@ -68,7 +68,7 @@ typedef int32_t sqfs_s32;
typedef int64_t sqfs_s64;
typedef struct sqfs_block_t sqfs_block_t;
-typedef struct sqfs_data_writer_t sqfs_data_writer_t;
+typedef struct sqfs_block_processor_t sqfs_block_processor_t;
typedef struct sqfs_compressor_config_t sqfs_compressor_config_t;
typedef struct sqfs_compressor_t sqfs_compressor_t;
typedef struct sqfs_dir_writer_t sqfs_dir_writer_t;