summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-02 21:10:49 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2022-07-08 19:17:35 +0200
commit10ab81a0de97513d82d05945c12bff87b02ede27 (patch)
treea5245ac495011588799da3bca5b7a35f8dc67bd9
parent86a947b9446b9b5d881d1a974cfe1bcde9d08f2f (diff)
Cleanup: move mkdir_p from libcommon to libutil
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--bin/rdsquashfs/Makemodule.am2
-rw-r--r--bin/rdsquashfs/rdsquashfs.h1
-rw-r--r--bin/sqfsdiff/Makemodule.am2
-rw-r--r--bin/sqfsdiff/sqfsdiff.h1
-rw-r--r--include/common.h8
-rw-r--r--include/util/util.h8
-rw-r--r--lib/common/Makemodule.am3
-rw-r--r--lib/util/Makemodule.am1
-rw-r--r--lib/util/mkdir_p.c (renamed from lib/common/mkdir_p.c)4
9 files changed, 16 insertions, 14 deletions
diff --git a/bin/rdsquashfs/Makemodule.am b/bin/rdsquashfs/Makemodule.am
index 974e7bc..1ff9c60 100644
--- a/bin/rdsquashfs/Makemodule.am
+++ b/bin/rdsquashfs/Makemodule.am
@@ -4,7 +4,7 @@ rdsquashfs_SOURCES += bin/rdsquashfs/restore_fstree.c bin/rdsquashfs/describe.c
rdsquashfs_SOURCES += bin/rdsquashfs/fill_files.c bin/rdsquashfs/dump_xattrs.c
rdsquashfs_SOURCES += bin/rdsquashfs/stat.c
rdsquashfs_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-rdsquashfs_LDADD = libcommon.a libio.a libcompat.a libsquashfs.la
+rdsquashfs_LDADD = libcommon.a libio.a libcompat.a libutil.a libsquashfs.la
rdsquashfs_LDADD += libfstree.a $(LZO_LIBS) $(PTHREAD_LIBS)
dist_man1_MANS += bin/rdsquashfs/rdsquashfs.1
diff --git a/bin/rdsquashfs/rdsquashfs.h b/bin/rdsquashfs/rdsquashfs.h
index dd50f28..56bb836 100644
--- a/bin/rdsquashfs/rdsquashfs.h
+++ b/bin/rdsquashfs/rdsquashfs.h
@@ -10,6 +10,7 @@
#include "config.h"
#include "common.h"
#include "fstree.h"
+#include "util/util.h"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
diff --git a/bin/sqfsdiff/Makemodule.am b/bin/sqfsdiff/Makemodule.am
index bd93a74..ff08c7a 100644
--- a/bin/sqfsdiff/Makemodule.am
+++ b/bin/sqfsdiff/Makemodule.am
@@ -4,7 +4,7 @@ sqfsdiff_SOURCES += bin/sqfsdiff/compare_dir.c bin/sqfsdiff/node_compare.c
sqfsdiff_SOURCES += bin/sqfsdiff/compare_files.c bin/sqfsdiff/super.c
sqfsdiff_SOURCES += bin/sqfsdiff/extract.c
sqfsdiff_CFLAGS = $(AM_CFLAGS) $(PTHREAD_CFLAGS)
-sqfsdiff_LDADD = libcommon.a libsquashfs.la libio.a libcompat.a
+sqfsdiff_LDADD = libcommon.a libsquashfs.la libio.a libcompat.a libutil.a
sqfsdiff_LDADD += $(LZO_LIBS) libfstree.a $(PTHREAD_LIBS)
dist_man1_MANS += bin/sqfsdiff/sqfsdiff.1
diff --git a/bin/sqfsdiff/sqfsdiff.h b/bin/sqfsdiff/sqfsdiff.h
index a8f1b32..65e8120 100644
--- a/bin/sqfsdiff/sqfsdiff.h
+++ b/bin/sqfsdiff/sqfsdiff.h
@@ -10,6 +10,7 @@
#include "config.h"
#include "common.h"
#include "fstree.h"
+#include "util/util.h"
#include <stdlib.h>
#include <getopt.h>
diff --git a/include/common.h b/include/common.h
index 91dccaa..cbd73b2 100644
--- a/include/common.h
+++ b/include/common.h
@@ -51,14 +51,6 @@ void sqfs_perror(const char *file, const char *action, int error_code);
int sqfs_tree_find_hard_links(const sqfs_tree_node_t *root,
sqfs_hard_link_t **out);
-/*
- A wrapper around mkdir() that behaves like 'mkdir -p'. It tries to create
- every component of the given path and skips already existing entries.
-
- Returns 0 on success.
-*/
-int mkdir_p(const char *path);
-
/* A common implementation of the '--version' command line flag. */
void print_version(const char *progname);
diff --git a/include/util/util.h b/include/util/util.h
index 4b05340..af7d196 100644
--- a/include/util/util.h
+++ b/include/util/util.h
@@ -35,4 +35,12 @@ SQFS_INTERNAL sqfs_u32 xxh32(const void *input, const size_t len);
*/
SQFS_INTERNAL bool is_memory_zero(const void *blob, size_t size);
+/*
+ A wrapper around mkdir() that behaves like 'mkdir -p'. It tries to create
+ every component of the given path and skips already existing entries.
+
+ Returns 0 on success.
+*/
+SQFS_INTERNAL int mkdir_p(const char *path);
+
#endif /* SQFS_UTIL_H */
diff --git a/lib/common/Makemodule.am b/lib/common/Makemodule.am
index dd0a0d0..326f831 100644
--- a/lib/common/Makemodule.am
+++ b/lib/common/Makemodule.am
@@ -3,8 +3,7 @@ libcommon_a_SOURCES += lib/common/print_version.c lib/common/data_reader_dump.c
libcommon_a_SOURCES += lib/common/compress.c lib/common/comp_opt.c
libcommon_a_SOURCES += lib/common/data_writer.c include/common.h
libcommon_a_SOURCES += lib/common/get_path.c lib/common/data_writer_ostream.c
-libcommon_a_SOURCES += lib/common/perror.c
-libcommon_a_SOURCES += lib/common/mkdir_p.c lib/common/parse_size.c
+libcommon_a_SOURCES += lib/common/perror.c lib/common/parse_size.c
libcommon_a_SOURCES += lib/common/print_size.c include/simple_writer.h
libcommon_a_SOURCES += include/compress_cli.h
libcommon_a_SOURCES += lib/common/writer/init.c lib/common/writer/cleanup.c
diff --git a/lib/util/Makemodule.am b/lib/util/Makemodule.am
index 9578fb2..bc3d618 100644
--- a/lib/util/Makemodule.am
+++ b/lib/util/Makemodule.am
@@ -9,6 +9,7 @@ libutil_a_SOURCES += include/util/threadpool.h
libutil_a_SOURCES += include/util/w32threadwrap.h
libutil_a_SOURCES += lib/util/threadpool_serial.c
libutil_a_SOURCES += lib/util/is_memory_zero.c
+libutil_a_SOURCES += lib/util/mkdir_p.c
libutil_a_CFLAGS = $(AM_CFLAGS)
libutil_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/lib/common/mkdir_p.c b/lib/util/mkdir_p.c
index d250763..993d8ec 100644
--- a/lib/common/mkdir_p.c
+++ b/lib/util/mkdir_p.c
@@ -1,10 +1,10 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
/*
* mkdir_p.c
*
* Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
*/
-#include "common.h"
+#include "util/util.h"
#include <string.h>
#include <stdlib.h>