summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-06-26 22:51:27 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commit359d71e90050a8b83f7bc7d2ecd4ff29c477cc22 (patch)
treedf2b7a585b78e6776446d4ca9be62a22db27f0a7 /lib
parent2087cc237cd0fe1ed29ebf891648bacb46f4833b (diff)
Cleanup: rename libfstream to libio, split headers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/fstream/Makemodule.am45
-rw-r--r--lib/fstree/fstree_from_file.c2
-rw-r--r--lib/io/Makemodule.am45
-rw-r--r--lib/io/compress/bzip2.c (renamed from lib/fstream/compress/bzip2.c)0
-rw-r--r--lib/io/compress/gzip.c (renamed from lib/fstream/compress/gzip.c)0
-rw-r--r--lib/io/compress/ostream_compressor.c (renamed from lib/fstream/compress/ostream_compressor.c)8
-rw-r--r--lib/io/compress/xz.c (renamed from lib/fstream/compress/xz.c)0
-rw-r--r--lib/io/compress/zstd.c (renamed from lib/fstream/compress/zstd.c)0
-rw-r--r--lib/io/get_line.c (renamed from lib/fstream/get_line.c)0
-rw-r--r--lib/io/internal.h (renamed from lib/fstream/internal.h)6
-rw-r--r--lib/io/istream.c (renamed from lib/fstream/istream.c)0
-rw-r--r--lib/io/ostream.c (renamed from lib/fstream/ostream.c)0
-rw-r--r--lib/io/printf.c (renamed from lib/fstream/printf.c)0
-rw-r--r--lib/io/uncompress/autodetect.c (renamed from lib/fstream/uncompress/autodetect.c)8
-rw-r--r--lib/io/uncompress/bzip2.c (renamed from lib/fstream/uncompress/bzip2.c)0
-rw-r--r--lib/io/uncompress/gzip.c (renamed from lib/fstream/uncompress/gzip.c)0
-rw-r--r--lib/io/uncompress/istream_compressor.c (renamed from lib/fstream/uncompress/istream_compressor.c)8
-rw-r--r--lib/io/uncompress/xz.c (renamed from lib/fstream/uncompress/xz.c)0
-rw-r--r--lib/io/uncompress/zstd.c (renamed from lib/fstream/uncompress/zstd.c)0
-rw-r--r--lib/io/unix/istream.c (renamed from lib/fstream/unix/istream.c)0
-rw-r--r--lib/io/unix/ostream.c (renamed from lib/fstream/unix/ostream.c)0
-rw-r--r--lib/io/win32/istream.c (renamed from lib/fstream/win32/istream.c)0
-rw-r--r--lib/io/win32/ostream.c (renamed from lib/fstream/win32/ostream.c)0
-rw-r--r--lib/io/xfrm.c (renamed from lib/fstream/compressor.c)30
24 files changed, 78 insertions, 74 deletions
diff --git a/lib/fstream/Makemodule.am b/lib/fstream/Makemodule.am
deleted file mode 100644
index ad5f426..0000000
--- a/lib/fstream/Makemodule.am
+++ /dev/null
@@ -1,45 +0,0 @@
-libfstream_a_SOURCES = include/fstream.h
-libfstream_a_SOURCES += lib/fstream/internal.h
-libfstream_a_SOURCES += lib/fstream/ostream.c lib/fstream/printf.c
-libfstream_a_SOURCES += lib/fstream/istream.c lib/fstream/get_line.c
-libfstream_a_SOURCES += lib/fstream/compressor.c
-libfstream_a_SOURCES += lib/fstream/compress/ostream_compressor.c
-libfstream_a_SOURCES += lib/fstream/uncompress/istream_compressor.c
-libfstream_a_SOURCES += lib/fstream/uncompress/autodetect.c
-libfstream_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS)
-libfstream_a_CFLAGS += $(ZSTD_CFLAGS) $(BZIP2_CFLAGS)
-libfstream_a_CPPFLAGS = $(AM_CPPFLAGS)
-
-if WINDOWS
-libfstream_a_SOURCES += lib/fstream/win32/ostream.c
-libfstream_a_SOURCES += lib/fstream/win32/istream.c
-libfstream_a_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
-else
-libfstream_a_SOURCES += lib/fstream/unix/ostream.c
-libfstream_a_SOURCES += lib/fstream/unix/istream.c
-endif
-
-if WITH_XZ
-libfstream_a_SOURCES += lib/fstream/compress/xz.c lib/fstream/uncompress/xz.c
-libfstream_a_CPPFLAGS += -DWITH_XZ
-endif
-
-if WITH_GZIP
-libfstream_a_SOURCES += lib/fstream/compress/gzip.c
-libfstream_a_SOURCES += lib/fstream/uncompress/gzip.c
-libfstream_a_CPPFLAGS += -DWITH_GZIP
-endif
-
-if WITH_ZSTD
-libfstream_a_SOURCES += lib/fstream/compress/zstd.c
-libfstream_a_SOURCES += lib/fstream/uncompress/zstd.c
-libfstream_a_CPPFLAGS += -DWITH_ZSTD
-endif
-
-if WITH_BZIP2
-libfstream_a_SOURCES += lib/fstream/compress/bzip2.c
-libfstream_a_SOURCES += lib/fstream/uncompress/bzip2.c
-libfstream_a_CPPFLAGS += -DWITH_BZIP2
-endif
-
-noinst_LIBRARIES += libfstream.a
diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c
index e77f19a..dd289bc 100644
--- a/lib/fstree/fstree_from_file.c
+++ b/lib/fstree/fstree_from_file.c
@@ -6,8 +6,8 @@
*/
#include "config.h"
+#include "io/file.h"
#include "fstree.h"
-#include "fstream.h"
#include "compat.h"
#include <stdlib.h>
diff --git a/lib/io/Makemodule.am b/lib/io/Makemodule.am
new file mode 100644
index 0000000..63ce958
--- /dev/null
+++ b/lib/io/Makemodule.am
@@ -0,0 +1,45 @@
+libio_a_SOURCES = lib/io/internal.h
+libio_a_SOURCES += include/io/istream.h lib/io/ostream.c lib/io/printf.c
+libio_a_SOURCES += include/io/ostream.h lib/io/istream.c lib/io/get_line.c
+libio_a_SOURCES += include/io/xfrm.h lib/io/xfrm.c
+libio_a_SOURCES += include/io/file.h include/io/std.h
+libio_a_SOURCES += lib/io/compress/ostream_compressor.c
+libio_a_SOURCES += lib/io/uncompress/istream_compressor.c
+libio_a_SOURCES += lib/io/uncompress/autodetect.c
+libio_a_CFLAGS = $(AM_CFLAGS) $(ZLIB_CFLAGS) $(XZ_CFLAGS)
+libio_a_CFLAGS += $(ZSTD_CFLAGS) $(BZIP2_CFLAGS)
+libio_a_CPPFLAGS = $(AM_CPPFLAGS)
+
+if WINDOWS
+libio_a_SOURCES += lib/io/win32/ostream.c
+libio_a_SOURCES += lib/io/win32/istream.c
+libio_a_CFLAGS += -DWINVER=0x0600 -D_WIN32_WINNT=0x0600
+else
+libio_a_SOURCES += lib/io/unix/ostream.c
+libio_a_SOURCES += lib/io/unix/istream.c
+endif
+
+if WITH_XZ
+libio_a_SOURCES += lib/io/compress/xz.c lib/io/uncompress/xz.c
+libio_a_CPPFLAGS += -DWITH_XZ
+endif
+
+if WITH_GZIP
+libio_a_SOURCES += lib/io/compress/gzip.c
+libio_a_SOURCES += lib/io/uncompress/gzip.c
+libio_a_CPPFLAGS += -DWITH_GZIP
+endif
+
+if WITH_ZSTD
+libio_a_SOURCES += lib/io/compress/zstd.c
+libio_a_SOURCES += lib/io/uncompress/zstd.c
+libio_a_CPPFLAGS += -DWITH_ZSTD
+endif
+
+if WITH_BZIP2
+libio_a_SOURCES += lib/io/compress/bzip2.c
+libio_a_SOURCES += lib/io/uncompress/bzip2.c
+libio_a_CPPFLAGS += -DWITH_BZIP2
+endif
+
+noinst_LIBRARIES += libio.a
diff --git a/lib/fstream/compress/bzip2.c b/lib/io/compress/bzip2.c
index 7f0c09a..7f0c09a 100644
--- a/lib/fstream/compress/bzip2.c
+++ b/lib/io/compress/bzip2.c
diff --git a/lib/fstream/compress/gzip.c b/lib/io/compress/gzip.c
index b73a258..b73a258 100644
--- a/lib/fstream/compress/gzip.c
+++ b/lib/io/compress/gzip.c
diff --git a/lib/fstream/compress/ostream_compressor.c b/lib/io/compress/ostream_compressor.c
index 30ff7eb..314ce6b 100644
--- a/lib/fstream/compress/ostream_compressor.c
+++ b/lib/io/compress/ostream_compressor.c
@@ -67,22 +67,22 @@ ostream_t *ostream_compressor_create(ostream_t *strm, int comp_id)
ostream_t *base;
switch (comp_id) {
- case FSTREAM_COMPRESSOR_GZIP:
+ case IO_COMPRESSOR_GZIP:
#ifdef WITH_GZIP
comp = ostream_gzip_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_XZ:
+ case IO_COMPRESSOR_XZ:
#ifdef WITH_XZ
comp = ostream_xz_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_ZSTD:
+ case IO_COMPRESSOR_ZSTD:
#if defined(WITH_ZSTD) && defined(HAVE_ZSTD_STREAM)
comp = ostream_zstd_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_BZIP2:
+ case IO_COMPRESSOR_BZIP2:
#ifdef WITH_BZIP2
comp = ostream_bzip2_create(strm->get_filename(strm));
#endif
diff --git a/lib/fstream/compress/xz.c b/lib/io/compress/xz.c
index 65bda0b..65bda0b 100644
--- a/lib/fstream/compress/xz.c
+++ b/lib/io/compress/xz.c
diff --git a/lib/fstream/compress/zstd.c b/lib/io/compress/zstd.c
index c0b002e..c0b002e 100644
--- a/lib/fstream/compress/zstd.c
+++ b/lib/io/compress/zstd.c
diff --git a/lib/fstream/get_line.c b/lib/io/get_line.c
index f7e0b59..f7e0b59 100644
--- a/lib/fstream/get_line.c
+++ b/lib/io/get_line.c
diff --git a/lib/fstream/internal.h b/lib/io/internal.h
index 4f02f8c..4ac38f5 100644
--- a/lib/fstream/internal.h
+++ b/lib/io/internal.h
@@ -9,7 +9,11 @@
#include "config.h"
#include "compat.h"
-#include "fstream.h"
+#include "io/istream.h"
+#include "io/ostream.h"
+#include "io/file.h"
+#include "io/xfrm.h"
+#include "io/std.h"
#include <string.h>
#include <stdlib.h>
diff --git a/lib/fstream/istream.c b/lib/io/istream.c
index 6318a23..6318a23 100644
--- a/lib/fstream/istream.c
+++ b/lib/io/istream.c
diff --git a/lib/fstream/ostream.c b/lib/io/ostream.c
index afe76e8..afe76e8 100644
--- a/lib/fstream/ostream.c
+++ b/lib/io/ostream.c
diff --git a/lib/fstream/printf.c b/lib/io/printf.c
index 3850487..3850487 100644
--- a/lib/fstream/printf.c
+++ b/lib/io/printf.c
diff --git a/lib/fstream/uncompress/autodetect.c b/lib/io/uncompress/autodetect.c
index 61628f8..dde33c8 100644
--- a/lib/fstream/uncompress/autodetect.c
+++ b/lib/io/uncompress/autodetect.c
@@ -11,10 +11,10 @@ static const struct {
const sqfs_u8 *value;
size_t len;
} magic[] = {
- { FSTREAM_COMPRESSOR_GZIP, (const sqfs_u8 *)"\x1F\x8B\x08", 3 },
- { FSTREAM_COMPRESSOR_XZ, (const sqfs_u8 *)("\xFD" "7zXZ"), 6 },
- { FSTREAM_COMPRESSOR_ZSTD, (const sqfs_u8 *)"\x28\xB5\x2F\xFD", 4 },
- { FSTREAM_COMPRESSOR_BZIP2, (const sqfs_u8 *)"BZh", 3 },
+ { IO_COMPRESSOR_GZIP, (const sqfs_u8 *)"\x1F\x8B\x08", 3 },
+ { IO_COMPRESSOR_XZ, (const sqfs_u8 *)("\xFD" "7zXZ"), 6 },
+ { IO_COMPRESSOR_ZSTD, (const sqfs_u8 *)"\x28\xB5\x2F\xFD", 4 },
+ { IO_COMPRESSOR_BZIP2, (const sqfs_u8 *)"BZh", 3 },
};
int istream_detect_compressor(istream_t *strm,
diff --git a/lib/fstream/uncompress/bzip2.c b/lib/io/uncompress/bzip2.c
index 3b44383..3b44383 100644
--- a/lib/fstream/uncompress/bzip2.c
+++ b/lib/io/uncompress/bzip2.c
diff --git a/lib/fstream/uncompress/gzip.c b/lib/io/uncompress/gzip.c
index 1d6274c..1d6274c 100644
--- a/lib/fstream/uncompress/gzip.c
+++ b/lib/io/uncompress/gzip.c
diff --git a/lib/fstream/uncompress/istream_compressor.c b/lib/io/uncompress/istream_compressor.c
index 75edd1b..ab9ad8b 100644
--- a/lib/fstream/uncompress/istream_compressor.c
+++ b/lib/io/uncompress/istream_compressor.c
@@ -29,22 +29,22 @@ istream_t *istream_compressor_create(istream_t *strm, int comp_id)
istream_t *base;
switch (comp_id) {
- case FSTREAM_COMPRESSOR_GZIP:
+ case IO_COMPRESSOR_GZIP:
#ifdef WITH_GZIP
comp = istream_gzip_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_XZ:
+ case IO_COMPRESSOR_XZ:
#ifdef WITH_XZ
comp = istream_xz_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_ZSTD:
+ case IO_COMPRESSOR_ZSTD:
#if defined(WITH_ZSTD) && defined(HAVE_ZSTD_STREAM)
comp = istream_zstd_create(strm->get_filename(strm));
#endif
break;
- case FSTREAM_COMPRESSOR_BZIP2:
+ case IO_COMPRESSOR_BZIP2:
#ifdef WITH_BZIP2
comp = istream_bzip2_create(strm->get_filename(strm));
#endif
diff --git a/lib/fstream/uncompress/xz.c b/lib/io/uncompress/xz.c
index 0fd9ce6..0fd9ce6 100644
--- a/lib/fstream/uncompress/xz.c
+++ b/lib/io/uncompress/xz.c
diff --git a/lib/fstream/uncompress/zstd.c b/lib/io/uncompress/zstd.c
index fd22cbf..fd22cbf 100644
--- a/lib/fstream/uncompress/zstd.c
+++ b/lib/io/uncompress/zstd.c
diff --git a/lib/fstream/unix/istream.c b/lib/io/unix/istream.c
index 5898141..5898141 100644
--- a/lib/fstream/unix/istream.c
+++ b/lib/io/unix/istream.c
diff --git a/lib/fstream/unix/ostream.c b/lib/io/unix/ostream.c
index 17f1998..17f1998 100644
--- a/lib/fstream/unix/ostream.c
+++ b/lib/io/unix/ostream.c
diff --git a/lib/fstream/win32/istream.c b/lib/io/win32/istream.c
index b591584..b591584 100644
--- a/lib/fstream/win32/istream.c
+++ b/lib/io/win32/istream.c
diff --git a/lib/fstream/win32/ostream.c b/lib/io/win32/ostream.c
index 2bd78c8..2bd78c8 100644
--- a/lib/fstream/win32/ostream.c
+++ b/lib/io/win32/ostream.c
diff --git a/lib/fstream/compressor.c b/lib/io/xfrm.c
index 48f9567..22fd953 100644
--- a/lib/fstream/compressor.c
+++ b/lib/io/xfrm.c
@@ -6,57 +6,57 @@
*/
#include "internal.h"
-int fstream_compressor_id_from_name(const char *name)
+int io_compressor_id_from_name(const char *name)
{
if (strcmp(name, "gzip") == 0)
- return FSTREAM_COMPRESSOR_GZIP;
+ return IO_COMPRESSOR_GZIP;
if (strcmp(name, "xz") == 0)
- return FSTREAM_COMPRESSOR_XZ;
+ return IO_COMPRESSOR_XZ;
if (strcmp(name, "zstd") == 0)
- return FSTREAM_COMPRESSOR_ZSTD;
+ return IO_COMPRESSOR_ZSTD;
if (strcmp(name, "bzip2") == 0)
- return FSTREAM_COMPRESSOR_BZIP2;
+ return IO_COMPRESSOR_BZIP2;
return -1;
}
-const char *fstream_compressor_name_from_id(int id)
+const char *io_compressor_name_from_id(int id)
{
- if (id == FSTREAM_COMPRESSOR_GZIP)
+ if (id == IO_COMPRESSOR_GZIP)
return "gzip";
- if (id == FSTREAM_COMPRESSOR_XZ)
+ if (id == IO_COMPRESSOR_XZ)
return "xz";
- if (id == FSTREAM_COMPRESSOR_ZSTD)
+ if (id == IO_COMPRESSOR_ZSTD)
return "zstd";
- if (id == FSTREAM_COMPRESSOR_BZIP2)
+ if (id == IO_COMPRESSOR_BZIP2)
return "bzip2";
return NULL;
}
-bool fstream_compressor_exists(int id)
+bool io_compressor_exists(int id)
{
switch (id) {
#ifdef WITH_GZIP
- case FSTREAM_COMPRESSOR_GZIP:
+ case IO_COMPRESSOR_GZIP:
return true;
#endif
#ifdef WITH_XZ
- case FSTREAM_COMPRESSOR_XZ:
+ case IO_COMPRESSOR_XZ:
return true;
#endif
#if defined(WITH_ZSTD) && defined(HAVE_ZSTD_STREAM)
- case FSTREAM_COMPRESSOR_ZSTD:
+ case IO_COMPRESSOR_ZSTD:
return true;
#endif
#ifdef WITH_BZIP2
- case FSTREAM_COMPRESSOR_BZIP2:
+ case IO_COMPRESSOR_BZIP2:
return true;
#endif
default: