aboutsummaryrefslogtreecommitdiff
path: root/lib/common
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common')
-rw-r--r--lib/common/Makemodule.am3
-rw-r--r--lib/common/src/data_writer_ostream.c91
2 files changed, 1 insertions, 93 deletions
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am
index 63fa602..61d87d4 100644
--- a/lib/common/Makemodule.am
+++ b/lib/common/Makemodule.am
@@ -3,11 +3,10 @@ libcommon_a_SOURCES = include/common.h include/simple_writer.h \
lib/common/src/hardlink.c lib/common/src/print_version.c \
lib/common/src/data_reader_dump.c lib/common/src/compress.c \
lib/common/src/comp_opt.c lib/common/src/data_writer.c \
- lib/common/src/data_writer_ostream.c lib/common/src/perror.c \
lib/common/src/parse_size.c lib/common/src/print_size.c \
lib/common/src/writer/init.c lib/common/src/writer/cleanup.c \
lib/common/src/writer/serialize_fstree.c lib/common/src/writer/finish.c\
- lib/common/src/fstree_cli.c
+ lib/common/src/fstree_cli.c lib/common/src/perror.c
libcommon_a_CFLAGS = $(AM_CFLAGS) $(LZO_CFLAGS)
if WITH_LZO
diff --git a/lib/common/src/data_writer_ostream.c b/lib/common/src/data_writer_ostream.c
deleted file mode 100644
index 59abd7a..0000000
--- a/lib/common/src/data_writer_ostream.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * data_writer_ostream.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "config.h"
-#include "common.h"
-
-#include <stdlib.h>
-
-typedef struct{
- sqfs_ostream_t base;
-
- sqfs_block_processor_t *proc;
- const char *filename;
-} data_writer_ostream_t;
-
-static int stream_append(sqfs_ostream_t *base, const void *data, size_t size)
-{
- data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
- int ret;
-
- ret = sqfs_block_processor_append(strm->proc, data, size);
-
- if (ret != 0) {
- sqfs_perror(strm->filename, NULL, ret);
- return -1;
- }
-
- return 0;
-}
-
-static int stream_flush(sqfs_ostream_t *base)
-{
- data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
- int ret;
-
- ret = sqfs_block_processor_end_file(strm->proc);
-
- if (ret != 0) {
- sqfs_perror(strm->filename, NULL, ret);
- return -1;
- }
-
- return 0;
-}
-
-static const char *stream_get_filename(sqfs_ostream_t *base)
-{
- data_writer_ostream_t *strm = (data_writer_ostream_t *)base;
-
- return strm->filename;
-}
-
-static void stream_destroy(sqfs_object_t *base)
-{
- free(base);
-}
-
-sqfs_ostream_t *data_writer_ostream_create(const char *filename,
- sqfs_block_processor_t *proc,
- sqfs_inode_generic_t **inode,
- int flags)
-{
- data_writer_ostream_t *strm = calloc(1, sizeof(*strm));
- sqfs_ostream_t *base = (sqfs_ostream_t *)strm;
- int ret;
-
- if (strm == NULL) {
- perror(filename);
- return NULL;
- }
-
- sqfs_object_init(strm, stream_destroy, NULL);
-
- ret = sqfs_block_processor_begin_file(proc, inode, NULL, flags);
-
- if (ret != 0) {
- sqfs_perror(filename, NULL, ret);
- free(strm);
- return NULL;
- }
-
- strm->proc = proc;
- strm->filename = filename;
- base->append = stream_append;
- base->flush = stream_flush;
- base->get_filename = stream_get_filename;
- return base;
-}