From 145dfce5f04a3a74a49cc016f15b0aa6d9996662 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 7 Oct 2019 14:56:09 +0200 Subject: Cleanup: move directory handling code to libcommon Signed-off-by: David Oberhollenzer --- include/common.h | 18 ++++++++++++++++++ include/util.h | 21 --------------------- 2 files changed, 18 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/common.h b/include/common.h index 19c95a3..0e9da0c 100644 --- a/include/common.h +++ b/include/common.h @@ -138,4 +138,22 @@ void sqfs_writer_cleanup(sqfs_writer_t *sqfs); void sqfs_perror(const char *file, const char *action, int error_code); + +/* + 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); + +/* Returns 0 on success. On failure, prints error message to stderr. */ +int pushd(const char *path); + +/* Same as pushd, but the string doesn't have to be null-terminated. */ +int pushdn(const char *path, size_t len); + +/* Returns 0 on success. On failure, prints error message to stderr. */ +int popd(void); + #endif /* COMMON_H */ diff --git a/include/util.h b/include/util.h index 9ed2189..a9cfffd 100644 --- a/include/util.h +++ b/include/util.h @@ -58,27 +58,6 @@ int write_data(const char *errstr, int fd, const void *data, size_t size); SQFS_INTERNAL void print_version(void); -/* - 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); - -/* Returns 0 on success. On failure, prints error message to stderr. */ -SQFS_INTERNAL -int pushd(const char *path); - -/* Same as pushd, but the string doesn't have to be null-terminated. */ -SQFS_INTERNAL -int pushdn(const char *path, size_t len); - -/* Returns 0 on success. On failure, prints error message to stderr. */ -SQFS_INTERNAL -int popd(void); - /* Helper for allocating data structures with flexible array members. -- cgit v1.2.3