summaryrefslogtreecommitdiff
path: root/lib/sqfs/data_writer/pthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqfs/data_writer/pthread.c')
-rw-r--r--lib/sqfs/data_writer/pthread.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/lib/sqfs/data_writer/pthread.c b/lib/sqfs/data_writer/pthread.c
index 3170c11..9c9b0a2 100644
--- a/lib/sqfs/data_writer/pthread.c
+++ b/lib/sqfs/data_writer/pthread.c
@@ -156,18 +156,6 @@ static void append_to_work_queue(sqfs_data_writer_t *proc,
pthread_cond_broadcast(&proc->queue_cond);
}
-static int test_and_set_status(sqfs_data_writer_t *proc, int status)
-{
- pthread_mutex_lock(&proc->mtx);
- if (proc->status == 0) {
- proc->status = status;
- } else {
- status = proc->status;
- }
- pthread_cond_broadcast(&proc->queue_cond);
- return status;
-}
-
static sqfs_block_t *try_dequeue(sqfs_data_writer_t *proc)
{
sqfs_block_t *queue, *it, *prev;
@@ -260,16 +248,23 @@ static int process_done_queue(sqfs_data_writer_t *proc, sqfs_block_t *queue)
return status;
}
-int sqfs_data_writer_enqueue(sqfs_data_writer_t *proc, sqfs_block_t *block)
+int test_and_set_status(sqfs_data_writer_t *proc, int status)
+{
+ pthread_mutex_lock(&proc->mtx);
+ if (proc->status == 0) {
+ proc->status = status;
+ } else {
+ status = proc->status;
+ }
+ pthread_cond_broadcast(&proc->queue_cond);
+ return status;
+}
+
+int data_writer_enqueue(sqfs_data_writer_t *proc, sqfs_block_t *block)
{
sqfs_block_t *queue;
int status;
- if (block->flags & ~SQFS_BLK_USER_SETTABLE_FLAGS) {
- free(block);
- return test_and_set_status(proc, SQFS_ERROR_UNSUPPORTED);
- }
-
pthread_mutex_lock(&proc->mtx);
while (proc->backlog > proc->max_backlog && proc->status == 0)
pthread_cond_wait(&proc->done_cond, &proc->mtx);