aboutsummaryrefslogtreecommitdiffstats
path: root/src/storage/plugins/SmbclientStorage.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-05 19:23:02 +0100
committerMax Kellermann <max@duempel.org>2014-02-07 23:46:15 +0100
commita0088ccce1749dbef6503fbf489f7096d824c11d (patch)
treec2a8e4ed79ee62bfb70cfbfcd1aefa035219e609 /src/storage/plugins/SmbclientStorage.cxx
parentbe081929f4523376db2df52903230d3b20dc54e9 (diff)
downloadmpd-a0088ccce1749dbef6503fbf489f7096d824c11d.tar.gz
mpd-a0088ccce1749dbef6503fbf489f7096d824c11d.tar.xz
mpd-a0088ccce1749dbef6503fbf489f7096d824c11d.zip
storage: add struct StoragePlugin and a plugin registry
Diffstat (limited to 'src/storage/plugins/SmbclientStorage.cxx')
-rw-r--r--src/storage/plugins/SmbclientStorage.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/storage/plugins/SmbclientStorage.cxx b/src/storage/plugins/SmbclientStorage.cxx
index 6d61ab75e..a73c8d65c 100644
--- a/src/storage/plugins/SmbclientStorage.cxx
+++ b/src/storage/plugins/SmbclientStorage.cxx
@@ -19,6 +19,7 @@
#include "config.h"
#include "SmbclientStorage.hxx"
+#include "storage/StoragePlugin.hxx"
#include "storage/StorageInterface.hxx"
#include "storage/FileInfo.hxx"
#include "lib/smbclient/Init.hxx"
@@ -178,9 +179,12 @@ SmbclientDirectoryReader::GetInfo(gcc_unused bool follow, FileInfo &info,
return ::GetInfo(path.c_str(), info, error);
}
-Storage *
-CreateSmbclientStorage(const char *base, Error &error)
+static Storage *
+CreateSmbclientStorageURI(const char *base, Error &error)
{
+ if (memcmp(base, "smb://", 6) != 0)
+ return nullptr;
+
if (!SmbclientInit(error))
return nullptr;
@@ -200,3 +204,8 @@ CreateSmbclientStorage(const char *base, Error &error)
return new SmbclientStorage(base, ctx2);
}
+
+const StoragePlugin smbclient_storage_plugin = {
+ "smbclient",
+ CreateSmbclientStorageURI,
+};