diff options
author | Max Kellermann <max@duempel.org> | 2014-10-07 19:45:40 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-10-09 07:45:25 +0200 |
commit | 3d2558bde6cebd6b628935f2852572cc7bb6eeab (patch) | |
tree | a2dcb1624f8d24cde3918c9ee955aae911c45417 /src | |
parent | 1aac0b10c9499db77cbe39e43a0abc8cccc72079 (diff) | |
download | mpd-3d2558bde6cebd6b628935f2852572cc7bb6eeab.tar.gz mpd-3d2558bde6cebd6b628935f2852572cc7bb6eeab.tar.xz mpd-3d2558bde6cebd6b628935f2852572cc7bb6eeab.zip |
StoragePlugin: pass EventLoop to constructor
Diffstat (limited to '')
-rw-r--r-- | src/Main.cxx | 2 | ||||
-rw-r--r-- | src/command/StorageCommands.cxx | 6 | ||||
-rw-r--r-- | src/storage/Configured.cxx | 9 | ||||
-rw-r--r-- | src/storage/Configured.hxx | 3 | ||||
-rw-r--r-- | src/storage/Registry.cxx | 4 | ||||
-rw-r--r-- | src/storage/Registry.hxx | 3 | ||||
-rw-r--r-- | src/storage/StoragePlugin.hxx | 4 | ||||
-rw-r--r-- | src/storage/plugins/NfsStorage.cxx | 3 | ||||
-rw-r--r-- | src/storage/plugins/SmbclientStorage.cxx | 3 |
9 files changed, 23 insertions, 14 deletions
diff --git a/src/Main.cxx b/src/Main.cxx index e41489688..417e055d6 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -166,7 +166,7 @@ glue_mapper_init(Error &error) static bool InitStorage(Error &error) { - Storage *storage = CreateConfiguredStorage(error); + Storage *storage = CreateConfiguredStorage(io_thread_get(), error); if (storage == nullptr) return !error.IsDefined(); diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx index aeec73e1c..ee51c573e 100644 --- a/src/command/StorageCommands.cxx +++ b/src/command/StorageCommands.cxx @@ -35,6 +35,7 @@ #include "db/plugins/simple/SimpleDatabasePlugin.hxx" #include "db/update/Service.hxx" #include "TimePrint.hxx" +#include "IOThread.hxx" #include "Idle.hxx" #include <inttypes.h> /* for PRIu64 */ @@ -121,7 +122,7 @@ CommandResult handle_listfiles_storage(Client &client, const char *uri) { Error error; - Storage *storage = CreateStorageURI(uri, error); + Storage *storage = CreateStorageURI(io_thread_get(), uri, error); if (storage == nullptr) { if (error.IsDefined()) return print_error(client, error); @@ -217,7 +218,8 @@ handle_mount(Client &client, gcc_unused unsigned argc, char *argv[]) } Error error; - Storage *storage = CreateStorageURI(remote_uri, error); + Storage *storage = CreateStorageURI(io_thread_get(), remote_uri, + error); if (storage == nullptr) { if (error.IsDefined()) return print_error(client, error); diff --git a/src/storage/Configured.cxx b/src/storage/Configured.cxx index 800a18ba0..41541673b 100644 --- a/src/storage/Configured.cxx +++ b/src/storage/Configured.cxx @@ -31,9 +31,10 @@ #include <assert.h> static Storage * -CreateConfiguredStorageUri(const char *uri, Error &error) +CreateConfiguredStorageUri(EventLoop &event_loop, const char *uri, + Error &error) { - Storage *storage = CreateStorageURI(uri, error); + Storage *storage = CreateStorageURI(event_loop, uri, error); if (storage == nullptr && !error.IsDefined()) error.Format(config_domain, "Unrecognized storage URI: %s", uri); @@ -63,13 +64,13 @@ CreateConfiguredStorageLocal(Error &error) } Storage * -CreateConfiguredStorage(Error &error) +CreateConfiguredStorage(EventLoop &event_loop, Error &error) { assert(!error.IsDefined()); auto uri = config_get_string(CONF_MUSIC_DIR, nullptr); if (uri != nullptr && uri_has_scheme(uri)) - return CreateConfiguredStorageUri(uri, error); + return CreateConfiguredStorageUri(event_loop, uri, error); return CreateConfiguredStorageLocal(error); } diff --git a/src/storage/Configured.hxx b/src/storage/Configured.hxx index d78857a26..828a192c3 100644 --- a/src/storage/Configured.hxx +++ b/src/storage/Configured.hxx @@ -25,6 +25,7 @@ class Error; class Storage; +class EventLoop; /** * Read storage configuration settings and create a #Storage instance @@ -32,7 +33,7 @@ class Storage; * (no #Error set in that case). */ Storage * -CreateConfiguredStorage(Error &error); +CreateConfiguredStorage(EventLoop &event_loop, Error &error); /** * Returns true if there is configuration for a #Storage instance. diff --git a/src/storage/Registry.cxx b/src/storage/Registry.cxx index b3fdd1642..d8e273fd5 100644 --- a/src/storage/Registry.cxx +++ b/src/storage/Registry.cxx @@ -52,7 +52,7 @@ GetStoragePluginByName(const char *name) } Storage * -CreateStorageURI(const char *uri, Error &error) +CreateStorageURI(EventLoop &event_loop, const char *uri, Error &error) { assert(!error.IsDefined()); @@ -62,7 +62,7 @@ CreateStorageURI(const char *uri, Error &error) if (plugin.create_uri == nullptr) continue; - Storage *storage = plugin.create_uri(uri, error); + Storage *storage = plugin.create_uri(event_loop, uri, error); if (storage != nullptr || error.IsDefined()) return storage; } diff --git a/src/storage/Registry.hxx b/src/storage/Registry.hxx index 9696b3de1..cb3a78f11 100644 --- a/src/storage/Registry.hxx +++ b/src/storage/Registry.hxx @@ -26,6 +26,7 @@ struct StoragePlugin; class Storage; class Error; +class EventLoop; /** * nullptr terminated list of all storage plugins which were enabled at @@ -39,6 +40,6 @@ GetStoragePluginByName(const char *name); gcc_nonnull_all gcc_malloc Storage * -CreateStorageURI(const char *uri, Error &error); +CreateStorageURI(EventLoop &event_loop, const char *uri, Error &error); #endif diff --git a/src/storage/StoragePlugin.hxx b/src/storage/StoragePlugin.hxx index d91caf24b..15f431105 100644 --- a/src/storage/StoragePlugin.hxx +++ b/src/storage/StoragePlugin.hxx @@ -24,11 +24,13 @@ class Error; class Storage; +class EventLoop; struct StoragePlugin { const char *name; - Storage *(*create_uri)(const char *uri, Error &error); + Storage *(*create_uri)(EventLoop &event_loop, const char *uri, + Error &error); }; #endif diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index 273d0aacc..e28e41a67 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -203,7 +203,8 @@ NfsStorage::OpenDirectory(const char *uri_utf8, Error &error) } static Storage * -CreateNfsStorageURI(const char *base, Error &error) +CreateNfsStorageURI(gcc_unused EventLoop &event_loop, const char *base, + Error &error) { if (memcmp(base, "nfs://", 6) != 0) return nullptr; diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx index 6eda05073..70a6e16bb 100644 --- a/src/storage/plugins/SmbclientStorage.cxx +++ b/src/storage/plugins/SmbclientStorage.cxx @@ -180,7 +180,8 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow, FileInfo &info, } static Storage * -CreateSmbclientStorageURI(const char *base, Error &error) +CreateSmbclientStorageURI(gcc_unused EventLoop &event_loop, const char *base, + Error &error) { if (memcmp(base, "smb://", 6) != 0) return nullptr; |