From 94b547d27f953fefa0ed080611eb916f58702e87 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 25 Nov 2019 13:28:28 +0100 Subject: Cleanup: remove what is left of libutil Signed-off-by: David Oberhollenzer --- COPYING.md | 3 +-- Makefile.am | 1 - README.md | 15 +++++---------- difftool/sqfsdiff.h | 1 - include/common.h | 4 +++- include/compat.h | 6 ++++-- include/tar.h | 2 +- include/util/util.h | 21 --------------------- lib/compat/chdir.c | 2 -- lib/fstree/fstree.c | 1 - lib/fstree/fstree_from_file.c | 1 - lib/fstree/gen_inode_table.c | 1 - lib/sqfs/Makemodule.am | 2 +- lib/tar/internal.h | 1 - lib/tar/skip.c | 1 - lib/util/Makemodule.am | 11 ----------- mkfs/Makemodule.am | 2 +- mkfs/mkfs.h | 1 - tar/Makemodule.am | 4 ++-- tests/Makemodule.am | 34 +++++++++++++++++----------------- tests/tar_fuzz.c | 1 - tests/tar_gnu.c | 1 - tests/tar_pax.c | 1 - tests/tar_sparse_gnu.c | 1 - tests/tar_sparse_gnu1.c | 1 - tests/tar_sparse_gnu2.c | 1 - tests/tar_ustar.c | 1 - tests/tar_xattr_bsd.c | 1 - tests/tar_xattr_schily.c | 1 - unpack/Makemodule.am | 2 +- unpack/rdsquashfs.h | 1 - 31 files changed, 36 insertions(+), 90 deletions(-) delete mode 100644 include/util/util.h delete mode 100644 lib/util/Makemodule.am diff --git a/COPYING.md b/COPYING.md index 1185ad5..8d18b6d 100644 --- a/COPYING.md +++ b/COPYING.md @@ -2,8 +2,7 @@ The `libsquashfs` library is released under the terms and conditions of the **GNU Lesser General Public License version 3 or later**. This applies to -all source code in the directories `lib/sqfs`, `lib/util`, `include/sqfs` -and `include/util`. +all source code in the directories `lib/sqfs` and `include/sqfs`. The rest of squashfs-tools-ng is released under the terms and conditions of the **GNU General Public License version 3 or later**. diff --git a/Makefile.am b/Makefile.am index 4a865ed..6ab36f3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,6 @@ EXTRA_DIST = autogen.sh README.md CHANGELOG.md COPYING.md mkwinbins.sh licenses TESTS = include lib/sqfs/Makemodule.am -include lib/util/Makemodule.am if BUILD_TOOLS include doc/Makemodule.am diff --git a/README.md b/README.md index f4c3d1b..2adf98b 100644 --- a/README.md +++ b/README.md @@ -114,18 +114,14 @@ headers of `libsquashfs.so` which are installed along with the library. All other headers are private to this package. The following components exist: - - `libutil.la` built from files in `lib/util` contains miscellaneous helper - functions used by `libsquashfs.la` internally, but also of use to other - libraries or programs. - `libfstree.a` built from files in `lib/fstree` contains functions for - manipulating a file system tree. It only depends on `libutil.la` + manipulating a file system tree. - `libtar.a` built from files in `lib/tar` contains data structures and - functions for parsing and creating tar files. It only depends - on `libutil.la`. + functions for parsing and creating tar files. - `libsquashfs.so` built from files in `lib/sqfs` contains all kinds of data structures for reading and writing SquashFS archives. Abstractions for data compression and so on. It contains the actual brains of this - package. It uses `libutil.la` internally. + package. - `libcommon.a` built from files in `lib/common` contains a bunch of commonly used code shared across the utilities. - `libcompat.a` built from files in `lib/compat` contains minimal @@ -138,9 +134,8 @@ structures. The `tests` sub-directory contains unit tests for the libraries. To allow 3rd party applications to use `libsquashfs.so` without restricting -their choice of license, the code in the `lib/sqfs` and `lib/util` -sub-directories is licensed under the LGPLv3, in contrast to the rest of this -package. +their choice of license, the code in the `lib/sqfs` sub-directories is +licensed under the LGPLv3, in contrast to the rest of this package. ## A Note on LZO Support diff --git a/difftool/sqfsdiff.h b/difftool/sqfsdiff.h index dc94687..94fce93 100644 --- a/difftool/sqfsdiff.h +++ b/difftool/sqfsdiff.h @@ -10,7 +10,6 @@ #include "config.h" #include "common.h" #include "fstree.h" -#include "util/util.h" #include #include diff --git a/include/common.h b/include/common.h index 66f6f76..cdcce39 100644 --- a/include/common.h +++ b/include/common.h @@ -26,7 +26,6 @@ #include "sqfs/dir.h" #include "sqfs/io.h" -#include "util/util.h" #include "compat.h" #include "fstree.h" #include "tar.h" @@ -73,6 +72,9 @@ typedef struct { bool quiet; } sqfs_writer_cfg_t; +#define container_of(ptr, type, member) \ + ((type *)((char *)ptr - offsetof(type, member))) + /* High level helper function to serialize an entire file system tree to a squashfs inode table and directory table. diff --git a/include/compat.h b/include/compat.h index 82b1c7e..9051d88 100644 --- a/include/compat.h +++ b/include/compat.h @@ -1,12 +1,14 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* SPDX-License-Identifier: GPL-3.0-or-later */ /* - * util.h + * compat.h * * Copyright (C) 2019 David Oberhollenzer */ #ifndef COMPAT_H #define COMPAT_H +#include "sqfs/predef.h" + #if defined(__GNUC__) || defined(__clang__) # if defined(__GNUC__) && __GNUC__ < 5 # if SIZEOF_SIZE_T <= SIZEOF_INT diff --git a/include/tar.h b/include/tar.h index dacea42..c496095 100644 --- a/include/tar.h +++ b/include/tar.h @@ -8,7 +8,7 @@ #define TAR_H #include "config.h" -#include "util/util.h" +#include "compat.h" #include #include diff --git a/include/util/util.h b/include/util/util.h deleted file mode 100644 index ed1102b..0000000 --- a/include/util/util.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * util.h - * - * Copyright (C) 2019 David Oberhollenzer - */ -#ifndef UTIL_H -#define UTIL_H - -#include "config.h" -#include "sqfs/predef.h" - -#include -#include - -#include "compat.h" - -#define container_of(ptr, type, member) \ - ((type *)((char *)ptr - offsetof(type, member))) - -#endif /* UTIL_H */ diff --git a/lib/compat/chdir.c b/lib/compat/chdir.c index 04dcf17..3a6ecb1 100644 --- a/lib/compat/chdir.c +++ b/lib/compat/chdir.c @@ -7,8 +7,6 @@ #include "config.h" #include "compat.h" -#include "util/util.h" - #ifdef _WIN32 #include diff --git a/lib/fstree/fstree.c b/lib/fstree/fstree.c index a2d9eee..ad48508 100644 --- a/lib/fstree/fstree.c +++ b/lib/fstree/fstree.c @@ -7,7 +7,6 @@ #include "config.h" #include "fstree.h" -#include "util/util.h" #include #include diff --git a/lib/fstree/fstree_from_file.c b/lib/fstree/fstree_from_file.c index 825a2e2..9cdf9a1 100644 --- a/lib/fstree/fstree_from_file.c +++ b/lib/fstree/fstree_from_file.c @@ -7,7 +7,6 @@ #include "config.h" #include "fstree.h" -#include "util/util.h" #include #include diff --git a/lib/fstree/gen_inode_table.c b/lib/fstree/gen_inode_table.c index a5a28c9..006029f 100644 --- a/lib/fstree/gen_inode_table.c +++ b/lib/fstree/gen_inode_table.c @@ -7,7 +7,6 @@ #include "config.h" #include "fstree.h" -#include "util/util.h" #include #include diff --git a/lib/sqfs/Makemodule.am b/lib/sqfs/Makemodule.am index 59cdbcb..dffca44 100644 --- a/lib/sqfs/Makemodule.am +++ b/lib/sqfs/Makemodule.am @@ -31,7 +31,7 @@ libsquashfs_la_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS) libsquashfs_la_CFLAGS += $(XZ_CFLAGS) $(LZ4_CFLAGS) libsquashfs_la_CFLAGS += $(ZSTD_CFLAGS) $(PTHREAD_CFLAGS) libsquashfs_la_LIBADD = $(XZ_LIBS) $(ZLIB_LIBS) $(LZ4_LIBS) -libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS) libutil.la +libsquashfs_la_LIBADD += $(ZSTD_LIBS) $(PTHREAD_LIBS) if WINDOWS libsquashfs_la_SOURCES += lib/sqfs/win32/io_file.c diff --git a/lib/tar/internal.h b/lib/tar/internal.h index e67e7fa..055637a 100644 --- a/lib/tar/internal.h +++ b/lib/tar/internal.h @@ -9,7 +9,6 @@ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/lib/tar/skip.c b/lib/tar/skip.c index 94e4a96..36cd470 100644 --- a/lib/tar/skip.c +++ b/lib/tar/skip.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am deleted file mode 100644 index 0ee762b..0000000 --- a/lib/util/Makemodule.am +++ /dev/null @@ -1,11 +0,0 @@ -libutil_la_SOURCES = include/util/util.h -libutil_la_CFLAGS = $(AM_CFLAGS) -libutil_la_CPPFLAGS = $(AM_CPPFLAGS) -libutil_la_LDFLAGS = $(AM_LDFLAGS) - -if WINDOWS -libutil_la_CFLAGS += -Wc,-static-libgcc -libutil_la_LDFLAGS += -no-undefined -avoid-version -endif - -noinst_LTLIBRARIES += libutil.la diff --git a/mkfs/Makemodule.am b/mkfs/Makemodule.am index 0a2b7da..ce42c5e 100644 --- a/mkfs/Makemodule.am +++ b/mkfs/Makemodule.am @@ -1,7 +1,7 @@ gensquashfs_SOURCES = mkfs/mkfs.c mkfs/mkfs.h mkfs/options.c gensquashfs_SOURCES += mkfs/dirscan.c mkfs/selinux.c gensquashfs_LDADD = libcommon.a libsquashfs.la libfstree.a -gensquashfs_LDADD += libcompat.a libutil.la $(LIBSELINUX_LIBS) $(LZO_LIBS) +gensquashfs_LDADD += libcompat.a $(LIBSELINUX_LIBS) $(LZO_LIBS) gensquashfs_CPPFLAGS = $(AM_CPPFLAGS) gensquashfs_CFLAGS = $(AM_CFLAGS) $(LIBSELINUX_CFLAGS) diff --git a/mkfs/mkfs.h b/mkfs/mkfs.h index 4833267..57bc39f 100644 --- a/mkfs/mkfs.h +++ b/mkfs/mkfs.h @@ -11,7 +11,6 @@ #include "common.h" #include "fstree.h" -#include "util/util.h" #ifdef HAVE_SYS_XATTR_H #include diff --git a/tar/Makemodule.am b/tar/Makemodule.am index 63b309c..26ac95c 100644 --- a/tar/Makemodule.am +++ b/tar/Makemodule.am @@ -1,9 +1,9 @@ sqfs2tar_SOURCES = tar/sqfs2tar.c -sqfs2tar_LDADD = libcommon.a libsquashfs.la libtar.a libcompat.a libutil.la +sqfs2tar_LDADD = libcommon.a libsquashfs.la libtar.a libcompat.a sqfs2tar_LDADD += libfstree.a $(LZO_LIBS) tar2sqfs_SOURCES = tar/tar2sqfs.c tar2sqfs_LDADD = libcommon.a libsquashfs.la libtar.a -tar2sqfs_LDADD += libfstree.a libcompat.a libutil.la libfstree.a $(LZO_LIBS) +tar2sqfs_LDADD += libfstree.a libcompat.a libfstree.a $(LZO_LIBS) bin_PROGRAMS += sqfs2tar tar2sqfs diff --git a/tests/Makemodule.am b/tests/Makemodule.am index 62cf813..51363e3 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -4,7 +4,7 @@ test_canonicalize_name_LDADD = libfstree.a test_str_table_SOURCES = tests/str_table.c lib/sqfs/str_table.c test_str_table_SOURCES += lib/sqfs/alloc.c lib/sqfs/util.h test_str_table_SOURCES += lib/sqfs/str_table.h -test_str_table_LDADD = libutil.la libcompat.a +test_str_table_LDADD = libcompat.a test_str_table_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests test_str_table_CPPFLAGS += -I$(top_srcdir)/lib/sqfs @@ -28,64 +28,64 @@ test_mknode_dir_SOURCES = tests/mknode_dir.c test_mknode_dir_LDADD = libfstree.a libcompat.a test_gen_inode_table_SOURCES = tests/gen_inode_table.c -test_gen_inode_table_LDADD = libfstree.a libutil.la libcompat.a +test_gen_inode_table_LDADD = libfstree.a libcompat.a test_add_by_path_SOURCES = tests/add_by_path.c -test_add_by_path_LDADD = libfstree.a libutil.la libcompat.a +test_add_by_path_LDADD = libfstree.a libcompat.a test_get_path_SOURCES = tests/get_path.c -test_get_path_LDADD = libfstree.a libutil.la libcompat.a +test_get_path_LDADD = libfstree.a libcompat.a test_fstree_sort_SOURCES = tests/fstree_sort.c -test_fstree_sort_LDADD = libfstree.a libutil.la libcompat.a +test_fstree_sort_LDADD = libfstree.a libcompat.a test_fstree_from_file_SOURCES = tests/fstree_from_file.c test_fstree_from_file_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/fstree1.txt -test_fstree_from_file_LDADD = libfstree.a libutil.la libcompat.a +test_fstree_from_file_LDADD = libfstree.a libcompat.a test_fstree_init_SOURCES = tests/fstree_init.c -test_fstree_init_LDADD = libfstree.a libutil.la libcompat.a +test_fstree_init_LDADD = libfstree.a libcompat.a test_tar_gnu_SOURCES = tests/tar_gnu.c -test_tar_gnu_LDADD = libtar.a libcompat.a libutil.la +test_tar_gnu_LDADD = libtar.a libcompat.a test_tar_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_pax_SOURCES = tests/tar_pax.c -test_tar_pax_LDADD = libtar.a libcompat.a libutil.la +test_tar_pax_LDADD = libtar.a libcompat.a test_tar_pax_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_ustar_SOURCES = tests/tar_ustar.c -test_tar_ustar_LDADD = libtar.a libcompat.a libutil.la +test_tar_ustar_LDADD = libtar.a libcompat.a test_tar_ustar_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu_SOURCES = tests/tar_sparse_gnu.c -test_tar_sparse_gnu_LDADD = libtar.a libcompat.a libutil.la +test_tar_sparse_gnu_LDADD = libtar.a libcompat.a test_tar_sparse_gnu_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu1_SOURCES = tests/tar_sparse_gnu1.c -test_tar_sparse_gnu1_LDADD = libtar.a libcompat.a libutil.la +test_tar_sparse_gnu1_LDADD = libtar.a libcompat.a test_tar_sparse_gnu1_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu1_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_sparse_gnu2_SOURCES = tests/tar_sparse_gnu1.c -test_tar_sparse_gnu2_LDADD = libtar.a libcompat.a libutil.la +test_tar_sparse_gnu2_LDADD = libtar.a libcompat.a test_tar_sparse_gnu2_CPPFLAGS = $(AM_CPPFLAGS) test_tar_sparse_gnu2_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_bsd_SOURCES = tests/tar_xattr_bsd.c -test_tar_xattr_bsd_LDADD = libtar.a libcompat.a libutil.la +test_tar_xattr_bsd_LDADD = libtar.a libcompat.a test_tar_xattr_bsd_CPPFLAGS = $(AM_CPPFLAGS) -DTESTPATH=$(top_srcdir)/tests/tar test_tar_xattr_schily_SOURCES = tests/tar_xattr_schily.c -test_tar_xattr_schily_LDADD = libtar.a libcompat.a libutil.la +test_tar_xattr_schily_LDADD = libtar.a libcompat.a test_tar_xattr_schily_CPPFLAGS = $(AM_CPPFLAGS) test_tar_xattr_schily_CPPFLAGS += -DTESTPATH=$(top_srcdir)/tests/tar fstree_fuzz_SOURCES = tests/fstree_fuzz.c -fstree_fuzz_LDADD = libfstree.a libcompat.a libutil.la +fstree_fuzz_LDADD = libfstree.a libcompat.a tar_fuzz_SOURCES = tests/tar_fuzz.c -tar_fuzz_LDADD = libtar.a libcompat.a libutil.la +tar_fuzz_LDADD = libtar.a libcompat.a check_PROGRAMS += test_mknode_simple test_mknode_slink test_mknode_reg check_PROGRAMS += test_mknode_dir test_gen_inode_table test_add_by_path diff --git a/tests/tar_fuzz.c b/tests/tar_fuzz.c index 1284bde..f342e38 100644 --- a/tests/tar_fuzz.c +++ b/tests/tar_fuzz.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_gnu.c b/tests/tar_gnu.c index 3df2855..de3af5b 100644 --- a/tests/tar_gnu.c +++ b/tests/tar_gnu.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_pax.c b/tests/tar_pax.c index 50a6bf9..8134591 100644 --- a/tests/tar_pax.c +++ b/tests/tar_pax.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_sparse_gnu.c b/tests/tar_sparse_gnu.c index 8776a09..9b28b17 100644 --- a/tests/tar_sparse_gnu.c +++ b/tests/tar_sparse_gnu.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_sparse_gnu1.c b/tests/tar_sparse_gnu1.c index 4a2c2b9..db812a0 100644 --- a/tests/tar_sparse_gnu1.c +++ b/tests/tar_sparse_gnu1.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_sparse_gnu2.c b/tests/tar_sparse_gnu2.c index 57508f8..4c8b860 100644 --- a/tests/tar_sparse_gnu2.c +++ b/tests/tar_sparse_gnu2.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_ustar.c b/tests/tar_ustar.c index d2b89f8..e015989 100644 --- a/tests/tar_ustar.c +++ b/tests/tar_ustar.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_xattr_bsd.c b/tests/tar_xattr_bsd.c index 39a73cc..dcaba1e 100644 --- a/tests/tar_xattr_bsd.c +++ b/tests/tar_xattr_bsd.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/tests/tar_xattr_schily.c b/tests/tar_xattr_schily.c index ba5bb2d..6cc31f5 100644 --- a/tests/tar_xattr_schily.c +++ b/tests/tar_xattr_schily.c @@ -6,7 +6,6 @@ */ #include "config.h" -#include "util/util.h" #include "tar.h" #include diff --git a/unpack/Makemodule.am b/unpack/Makemodule.am index f2832a3..3d3a2d6 100644 --- a/unpack/Makemodule.am +++ b/unpack/Makemodule.am @@ -2,7 +2,7 @@ rdsquashfs_SOURCES = unpack/rdsquashfs.c unpack/rdsquashfs.h rdsquashfs_SOURCES += unpack/list_files.c unpack/options.c rdsquashfs_SOURCES += unpack/restore_fstree.c unpack/describe.c rdsquashfs_SOURCES += unpack/fill_files.c unpack/dump_xattrs.c -rdsquashfs_LDADD = libcommon.a libcompat.a libsquashfs.la libutil.la +rdsquashfs_LDADD = libcommon.a libcompat.a libsquashfs.la rdsquashfs_LDADD += libfstree.a $(LZO_LIBS) bin_PROGRAMS += rdsquashfs diff --git a/unpack/rdsquashfs.h b/unpack/rdsquashfs.h index 7a9f242..dc9d68c 100644 --- a/unpack/rdsquashfs.h +++ b/unpack/rdsquashfs.h @@ -10,7 +10,6 @@ #include "config.h" #include "common.h" #include "fstree.h" -#include "util/util.h" #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN -- cgit v1.2.3