From b5d224ce2272e94088619e010782d874726802ff Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 6 Mar 2023 19:36:34 +0100 Subject: [PATCH] fs/{StandardDirectory,CheckFile}: move to fs/glue/ Distangle library dependencies. --- meson.build | 1 + src/CommandLine.cxx | 2 +- src/Listen.cxx | 2 +- src/Mapper.cxx | 2 +- src/config/Path.cxx | 2 +- src/config/meson.build | 3 ++- src/db/Configured.cxx | 2 +- src/db/meson.build | 1 + src/fs/{ => glue}/CheckFile.cxx | 8 ++++---- src/fs/{ => glue}/CheckFile.hxx | 5 +---- src/fs/{ => glue}/StandardDirectory.cxx | 5 +++-- src/fs/{ => glue}/StandardDirectory.hxx | 7 ++----- src/fs/glue/meson.build | 16 ++++++++++++++++ src/fs/meson.build | 3 --- src/storage/Configured.cxx | 5 +++-- src/storage/meson.build | 1 + 16 files changed, 39 insertions(+), 26 deletions(-) rename src/fs/{ => glue}/CheckFile.cxx (89%) rename src/fs/{ => glue}/CheckFile.hxx (78%) rename src/fs/{ => glue}/StandardDirectory.cxx (99%) rename src/fs/{ => glue}/StandardDirectory.hxx (92%) create mode 100644 src/fs/glue/meson.build diff --git a/meson.build b/meson.build index 5aefd0725..147f596b0 100644 --- a/meson.build +++ b/meson.build @@ -425,6 +425,7 @@ subdir('src/lib/crypto') subdir('src/zeroconf') subdir('src/fs') +subdir('src/fs/glue') subdir('src/config') subdir('src/tag') subdir('src/neighbor') diff --git a/src/CommandLine.cxx b/src/CommandLine.cxx index 198857783..bc410f53a 100644 --- a/src/CommandLine.cxx +++ b/src/CommandLine.cxx @@ -20,7 +20,7 @@ #include "fs/NarrowPath.hxx" #include "fs/Traits.hxx" #include "fs/FileSystem.hxx" -#include "fs/StandardDirectory.hxx" +#include "fs/glue/StandardDirectory.hxx" #include "event/Features.h" #include "io/uring/Features.h" #include "cmdline/OptionDef.hxx" diff --git a/src/Listen.cxx b/src/Listen.cxx index b9479579b..1bb8e8a7b 100644 --- a/src/Listen.cxx +++ b/src/Listen.cxx @@ -17,7 +17,7 @@ #include "net/SocketUtil.hxx" #include "system/Error.hxx" #include "fs/AllocatedPath.hxx" -#include "fs/StandardDirectory.hxx" +#include "fs/glue/StandardDirectory.hxx" #include "fs/XDG.hxx" #include "util/Domain.hxx" diff --git a/src/Mapper.cxx b/src/Mapper.cxx index 9ee017b1f..37cf20fd9 100644 --- a/src/Mapper.cxx +++ b/src/Mapper.cxx @@ -8,7 +8,7 @@ #include "config.h" #include "Mapper.hxx" #include "fs/AllocatedPath.hxx" -#include "fs/CheckFile.hxx" +#include "fs/glue/CheckFile.hxx" #include "util/StringCompare.hxx" #ifdef ENABLE_DATABASE diff --git a/src/config/Path.cxx b/src/config/Path.cxx index 073c269f4..a10439ba9 100644 --- a/src/config/Path.cxx +++ b/src/config/Path.cxx @@ -5,7 +5,7 @@ #include "Data.hxx" #include "fs/AllocatedPath.hxx" #include "fs/Traits.hxx" -#include "fs/StandardDirectory.hxx" +#include "fs/glue/StandardDirectory.hxx" #include "lib/fmt/RuntimeError.hxx" #include "util/StringSplit.hxx" diff --git a/src/config/meson.build b/src/config/meson.build index 92d8bd080..696f3af14 100644 --- a/src/config/meson.build +++ b/src/config/meson.build @@ -15,12 +15,13 @@ config = static_library( dependencies: [ log_dep, fmt_dep, + fs_dep, + fs_glue_dep, ], ) config_dep = declare_dependency( link_with: config, dependencies: [ - fs_dep, ], ) diff --git a/src/db/Configured.cxx b/src/db/Configured.cxx index 3954a26b1..7c6864eb8 100644 --- a/src/db/Configured.cxx +++ b/src/db/Configured.cxx @@ -9,7 +9,7 @@ #include "config/Block.hxx" #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" -#include "fs/StandardDirectory.hxx" +#include "fs/glue/StandardDirectory.hxx" #include "lib/fmt/RuntimeError.hxx" DatabasePtr diff --git a/src/db/meson.build b/src/db/meson.build index 0cf4af270..0eb63b632 100644 --- a/src/db/meson.build +++ b/src/db/meson.build @@ -55,6 +55,7 @@ db_glue = static_library( dependencies: [ fmt_dep, log_dep, + fs_glue_dep, ], ) diff --git a/src/fs/CheckFile.cxx b/src/fs/glue/CheckFile.cxx similarity index 89% rename from src/fs/CheckFile.cxx rename to src/fs/glue/CheckFile.cxx index cf93a0596..d70d2d4f8 100644 --- a/src/fs/CheckFile.cxx +++ b/src/fs/glue/CheckFile.cxx @@ -5,10 +5,10 @@ #include "Log.hxx" #include "lib/fmt/PathFormatter.hxx" #include "config/Domain.hxx" -#include "FileInfo.hxx" -#include "Path.hxx" -#include "AllocatedPath.hxx" -#include "DirectoryReader.hxx" +#include "fs/FileInfo.hxx" +#include "fs/Path.hxx" +#include "fs/AllocatedPath.hxx" +#include "fs/DirectoryReader.hxx" #include "system/Error.hxx" void diff --git a/src/fs/CheckFile.hxx b/src/fs/glue/CheckFile.hxx similarity index 78% rename from src/fs/CheckFile.hxx rename to src/fs/glue/CheckFile.hxx index 3a1545c8b..865f56ac8 100644 --- a/src/fs/CheckFile.hxx +++ b/src/fs/glue/CheckFile.hxx @@ -1,8 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_FS_CHECK_FILE_HXX -#define MPD_FS_CHECK_FILE_HXX +#pragma once class Path; @@ -12,5 +11,3 @@ class Path; */ void CheckDirectoryReadable(Path path_fs); - -#endif diff --git a/src/fs/StandardDirectory.cxx b/src/fs/glue/StandardDirectory.cxx similarity index 99% rename from src/fs/StandardDirectory.cxx rename to src/fs/glue/StandardDirectory.cxx index d227a58e9..be295df75 100644 --- a/src/fs/StandardDirectory.cxx +++ b/src/fs/glue/StandardDirectory.cxx @@ -6,8 +6,9 @@ #endif #include "StandardDirectory.hxx" -#include "FileSystem.hxx" -#include "XDG.hxx" +#include "fs/AllocatedPath.hxx" +#include "fs/FileSystem.hxx" +#include "fs/XDG.hxx" #include "config.h" #include "util/StringSplit.hxx" diff --git a/src/fs/StandardDirectory.hxx b/src/fs/glue/StandardDirectory.hxx similarity index 92% rename from src/fs/StandardDirectory.hxx rename to src/fs/glue/StandardDirectory.hxx index 1cfe8b684..df154efd5 100644 --- a/src/fs/StandardDirectory.hxx +++ b/src/fs/glue/StandardDirectory.hxx @@ -1,10 +1,9 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_FS_STANDARD_DIRECTORY_HXX -#define MPD_FS_STANDARD_DIRECTORY_HXX +#pragma once -#include "AllocatedPath.hxx" +class AllocatedPath; /** * Obtains configuration directory for the current user. @@ -83,5 +82,3 @@ AllocatedPath GetHomeDir(const char *user_name) noexcept; #endif - -#endif diff --git a/src/fs/glue/meson.build b/src/fs/glue/meson.build new file mode 100644 index 000000000..b880fec05 --- /dev/null +++ b/src/fs/glue/meson.build @@ -0,0 +1,16 @@ +fs_glue = static_library( + 'fs_glue', + 'StandardDirectory.cxx', + 'CheckFile.cxx', + include_directories: inc, + dependencies: [ + fs_dep, + fmt_dep, + log_dep, + util_dep, + ], +) + +fs_glue_dep = declare_dependency( + link_with: fs_glue, +) diff --git a/src/fs/meson.build b/src/fs/meson.build index 5be31cf6a..0fa610796 100644 --- a/src/fs/meson.build +++ b/src/fs/meson.build @@ -10,8 +10,6 @@ fs_sources = [ 'NarrowPath.cxx', 'FileSystem.cxx', 'List.cxx', - 'StandardDirectory.cxx', - 'CheckFile.cxx', 'LookupFile.cxx', 'DirectoryReader.cxx', 'io/TextFile.cxx', @@ -29,7 +27,6 @@ fs = static_library( include_directories: inc, dependencies: [ zlib_dep, - log_dep, ], ) diff --git a/src/storage/Configured.cxx b/src/storage/Configured.cxx index 28e9e77ea..3e6593c6e 100644 --- a/src/storage/Configured.cxx +++ b/src/storage/Configured.cxx @@ -6,8 +6,9 @@ #include "StorageInterface.hxx" #include "plugins/LocalStorage.hxx" #include "config/Data.hxx" -#include "fs/StandardDirectory.hxx" -#include "fs/CheckFile.hxx" +#include "fs/AllocatedPath.hxx" +#include "fs/glue/StandardDirectory.hxx" +#include "fs/glue/CheckFile.hxx" #include "lib/fmt/RuntimeError.hxx" #include "util/UriExtract.hxx" diff --git a/src/storage/meson.build b/src/storage/meson.build index 4ca1715bd..2e523cb44 100644 --- a/src/storage/meson.build +++ b/src/storage/meson.build @@ -20,6 +20,7 @@ storage_glue = static_library( include_directories: inc, dependencies: [ log_dep, + fs_glue_dep, ], )