From 7929aa73d0c1fa75e8e0fcd4272361ad0ea9b0e6 Mon Sep 17 00:00:00 2001 From: Mohamad Ayyash Date: Mon, 10 Mar 2014 15:55:33 -0700 Subject: [PATCH] vold: Add a new mountall command. This enables running "vdc mountall" in filesystem recovery tests where a partition is first unmounted then corrupted, and then finally verified that it's properly recovered and remounted successfully (i.e. running e2fsck..etc.). Change-Id: I9385180afaef70f9cc6b2920d2a3c6ff13203b4e --- CommandListener.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/CommandListener.cpp b/CommandListener.cpp index 3a327f1..81747a4 100644 --- a/CommandListener.cpp +++ b/CommandListener.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #define LOG_TAG "VoldCmdListener" @@ -113,13 +114,12 @@ int CommandListener::DumpCmd::runCommand(SocketClient *cli, return 0; } - CommandListener::VolumeCmd::VolumeCmd() : VoldCommand("volume") { } int CommandListener::VolumeCmd::runCommand(SocketClient *cli, - int argc, char **argv) { + int argc, char **argv) { dumpArgs(argc, argv, -1); if (argc < 2) { @@ -229,6 +229,9 @@ CommandListener::StorageCmd::StorageCmd() : int CommandListener::StorageCmd::runCommand(SocketClient *cli, int argc, char **argv) { + /* Guarantied to be initialized by vold's main() before the CommandListener is active */ + extern struct fstab *fstab; + dumpArgs(argc, argv, -1); if (argc < 2) { @@ -236,6 +239,15 @@ int CommandListener::StorageCmd::runCommand(SocketClient *cli, return 0; } + if (!strcmp(argv[1], "mountall")) { + if (argc != 2) { + cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: mountall", false); + return 0; + } + fs_mgr_mount_all(fstab); + cli->sendMsg(ResponseCode::CommandOkay, "Mountall ran successfully", false); + return 0; + } if (!strcmp(argv[1], "users")) { DIR *dir; struct dirent *de;