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
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 3a327f1..81747a4 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -22,6 +22,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <fs_mgr.h>
 #include <string.h>
 
 #define LOG_TAG "VoldCmdListener"
@@ -113,13 +114,12 @@
     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 @@
 
 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 @@
         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;