summaryrefslogtreecommitdiff
path: root/lib/sqfs/data_writer/internal.h
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 /lib/sqfs/data_writer/internal.h
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 'lib/sqfs/data_writer/internal.h')
-rw-r--r--lib/sqfs/data_writer/internal.h140
1 files changed, 0 insertions, 140 deletions
diff --git a/lib/sqfs/data_writer/internal.h b/lib/sqfs/data_writer/internal.h
deleted file mode 100644
index 8f59fb7..0000000
--- a/lib/sqfs/data_writer/internal.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* SPDX-License-Identifier: LGPL-3.0-or-later */
-/*
- * internal.h
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#ifndef INTERNAL_H
-#define INTERNAL_H
-
-#include "config.h"
-
-#include "sqfs/data_writer.h"
-#include "sqfs/frag_table.h"
-#include "sqfs/compressor.h"
-#include "sqfs/inode.h"
-#include "sqfs/table.h"
-#include "sqfs/error.h"
-#include "sqfs/block.h"
-#include "sqfs/io.h"
-#include "../util.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <zlib.h>
-
-#ifdef WITH_PTHREAD
-#include <pthread.h>
-#include <signal.h>
-#elif defined(_WIN32) || defined(__WINDOWS__)
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#endif
-
-
-#define MK_BLK_HASH(chksum, size) \
- (((sqfs_u64)(size) << 32) | (sqfs_u64)(chksum))
-
-#define INIT_BLOCK_COUNT (128)
-
-
-typedef struct {
- sqfs_u64 offset;
- sqfs_u64 hash;
-} blk_info_t;
-
-
-typedef struct compress_worker_t compress_worker_t;
-
-struct sqfs_data_writer_t {
- /* synchronization primitives */
-#ifdef WITH_PTHREAD
- pthread_mutex_t mtx;
- pthread_cond_t queue_cond;
- pthread_cond_t done_cond;
-#elif defined(_WIN32) || defined(__WINDOWS__)
- CRITICAL_SECTION mtx;
- CONDITION_VARIABLE queue_cond;
- CONDITION_VARIABLE done_cond;
-#endif
-
- /* needs rw access by worker and main thread */
- sqfs_block_t *queue;
- sqfs_block_t *queue_last;
-
- sqfs_block_t *done;
- size_t backlog;
- int status;
-
- /* used by main thread only */
- sqfs_u32 enqueue_id;
- sqfs_u32 dequeue_id;
-
- unsigned int num_workers;
- size_t max_backlog;
-
- size_t devblksz;
- sqfs_file_t *file;
-
- sqfs_frag_table_t *frag_tbl;
-
- sqfs_u64 start;
-
- size_t file_start;
- size_t num_blocks;
- size_t max_blocks;
- blk_info_t *blocks;
- sqfs_compressor_t *cmp;
-
- sqfs_block_t *frag_block;
-
- const sqfs_block_hooks_t *hooks;
- void *user_ptr;
- bool notify_threads;
-
- /* file API */
- sqfs_inode_generic_t *inode;
- sqfs_block_t *blk_current;
- sqfs_u32 blk_flags;
- size_t blk_index;
-
- /* used only by workers */
- size_t max_block_size;
-
-#if defined(WITH_PTHREAD) || defined(_WIN32) || defined(__WINDOWS__)
- compress_worker_t *workers[];
-#else
- sqfs_u8 scratch[];
-#endif
-};
-
-SQFS_INTERNAL int process_completed_block(sqfs_data_writer_t *proc,
- sqfs_block_t *block);
-
-SQFS_INTERNAL
-int process_completed_fragment(sqfs_data_writer_t *proc, sqfs_block_t *frag,
- sqfs_block_t **blk_out);
-
-SQFS_INTERNAL void free_blk_list(sqfs_block_t *list);
-
-SQFS_INTERNAL
-int data_writer_init(sqfs_data_writer_t *proc, 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_INTERNAL void data_writer_cleanup(sqfs_data_writer_t *proc);
-
-SQFS_INTERNAL
-int data_writer_do_block(sqfs_block_t *block, sqfs_compressor_t *cmp,
- sqfs_u8 *scratch, size_t scratch_size);
-
-SQFS_INTERNAL
-int test_and_set_status(sqfs_data_writer_t *proc, int status);
-
-SQFS_INTERNAL
-int append_to_work_queue(sqfs_data_writer_t *proc, sqfs_block_t *block,
- bool notify_threads);
-
-SQFS_INTERNAL int wait_completed(sqfs_data_writer_t *proc);
-
-#endif /* INTERNAL_H */