aboutsummaryrefslogtreecommitdiffstats
path: root/src/command/StorageCommands.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-02-12 21:45:04 +0100
committerMax Kellermann <max@duempel.org>2014-02-12 23:48:08 +0100
commitdf9667a4970e13f71571f12dfa2fa4ee5acde319 (patch)
treec3a9bcefa3522424ed0b8de28f143a03bd8cdeee /src/command/StorageCommands.cxx
parente3e2ad4ae54e91f69f24c5e66cb67e5a9ba5a8d9 (diff)
downloadmpd-df9667a4970e13f71571f12dfa2fa4ee5acde319.tar.gz
mpd-df9667a4970e13f71571f12dfa2fa4ee5acde319.tar.xz
mpd-df9667a4970e13f71571f12dfa2fa4ee5acde319.zip
StorageCommands: add command "unmount"
Diffstat (limited to '')
-rw-r--r--src/command/StorageCommands.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/command/StorageCommands.cxx b/src/command/StorageCommands.cxx
index a538c77fb..92d235f4c 100644
--- a/src/command/StorageCommands.cxx
+++ b/src/command/StorageCommands.cxx
@@ -113,3 +113,30 @@ handle_mount(Client &client, gcc_unused int argc, char *argv[])
idle_add(IDLE_MOUNT);
return CommandResult::OK;
}
+
+CommandResult
+handle_unmount(Client &client, gcc_unused int argc, char *argv[])
+{
+ Storage *_composite = client.partition.instance.storage;
+ if (_composite == nullptr) {
+ command_error(client, ACK_ERROR_NO_EXIST, "No database");
+ return CommandResult::ERROR;
+ }
+
+ CompositeStorage &composite = *(CompositeStorage *)_composite;
+
+ const char *const local_uri = argv[1];
+
+ if (*local_uri == 0) {
+ command_error(client, ACK_ERROR_ARG, "Bad mount point");
+ return CommandResult::ERROR;
+ }
+
+ if (!composite.Unmount(local_uri)) {
+ command_error(client, ACK_ERROR_ARG, "Not a mount point");
+ return CommandResult::ERROR;
+ }
+
+ idle_add(IDLE_MOUNT);
+ return CommandResult::OK;
+}