summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2010-01-18 06:19:40 -0800
committerSan Mehat <san@google.com>2010-01-18 06:19:40 -0800
commit5817821cf10b5f7d13eb693ffbc3f80f13bc681b (patch)
tree1e20c246e8682bcbeaa3612f6576dbff515d17f6
parent88705166ab82057090a070c6d4200c3d9db76f11 (diff)
downloadsystem_vold-5817821cf10b5f7d13eb693ffbc3f80f13bc681b.zip
system_vold-5817821cf10b5f7d13eb693ffbc3f80f13bc681b.tar.gz
system_vold-5817821cf10b5f7d13eb693ffbc3f80f13bc681b.tar.bz2
vold: Add command to unmount secure containers
Signed-off-by: San Mehat <san@google.com>
-rw-r--r--CommandListener.cpp21
-rw-r--r--CommandListener.h7
2 files changed, 28 insertions, 0 deletions
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 0207245..f15d44a 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -45,6 +45,7 @@ CommandListener::CommandListener() :
registerCmd(new FinalizeAsecCmd());
registerCmd(new DestroyAsecCmd());
registerCmd(new MountAsecCmd());
+ registerCmd(new UnmountAsecCmd());
registerCmd(new ListAsecCmd());
registerCmd(new AsecPathCmd());
}
@@ -254,6 +255,26 @@ int CommandListener::MountAsecCmd::runCommand(SocketClient *cli,
return 0;
}
+CommandListener::UnmountAsecCmd::UnmountAsecCmd() :
+ VoldCommand("unmount_asec") {
+}
+
+int CommandListener::UnmountAsecCmd::runCommand(SocketClient *cli,
+ int argc, char **argv) {
+ if (argc != 2) {
+ cli->sendMsg(ResponseCode::CommandSyntaxError,
+ "Usage: unmount_asec <namespace-id>", false);
+ return 0;
+ }
+
+ if (VolumeManager::Instance()->unmountAsec(argv[1])) {
+ cli->sendMsg(ResponseCode::OperationFailed, "Unmount failed", true);
+ } else {
+ cli->sendMsg(ResponseCode::CommandOkay, "Unmount succeeded", false);
+ }
+ return 0;
+}
+
CommandListener::ListAsecCmd::ListAsecCmd() :
VoldCommand("list_asec") {
diff --git a/CommandListener.h b/CommandListener.h
index cc078da..64ff31f 100644
--- a/CommandListener.h
+++ b/CommandListener.h
@@ -111,6 +111,13 @@ private:
int runCommand(SocketClient *c, int argc, char ** argv);
};
+ class UnmountAsecCmd : public VoldCommand {
+ public:
+ UnmountAsecCmd();
+ virtual ~UnmountAsecCmd() {}
+ int runCommand(SocketClient *c, int argc, char ** argv);
+ };
+
class ListAsecCmd : public VoldCommand {
public:
ListAsecCmd();