Add new vold call to get the path to an asec fs.

Change-Id: Ife15628ed6e2493c9e85a2ade6d59a194fdddde5
diff --git a/CommandListener.cpp b/CommandListener.cpp
index 637741f..1672fcc 100644
--- a/CommandListener.cpp
+++ b/CommandListener.cpp
@@ -352,6 +352,18 @@
             cli->sendMsg(ResponseCode::AsecPathResult, path, false);
             return 0;
         }
+    } else if (!strcmp(argv[1], "fspath")) {
+        dumpArgs(argc, argv, -1);
+        if (argc != 3) {
+            cli->sendMsg(ResponseCode::CommandSyntaxError, "Usage: asec fspath <container-id>", false);
+            return 0;
+        }
+        char path[255];
+
+        if (!(rc = vm->getAsecFilesystemPath(argv[2], path, sizeof(path)))) {
+            cli->sendMsg(ResponseCode::AsecPathResult, path, false);
+            return 0;
+        }
     } else {
         dumpArgs(argc, argv, -1);
         cli->sendMsg(ResponseCode::CommandSyntaxError, "Unknown asec cmd", false);
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 88ac07c..c1406a9 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -203,6 +203,20 @@
     return 0;
 }
 
+int VolumeManager::getAsecFilesystemPath(const char *id, char *buffer, int maxlen) {
+    char asecFileName[255];
+    snprintf(asecFileName, sizeof(asecFileName), "%s/%s.asec", Volume::SEC_ASECDIR, id);
+
+    memset(buffer, 0, maxlen);
+    if (access(asecFileName, F_OK)) {
+        errno = ENOENT;
+        return -1;
+    }
+
+    snprintf(buffer, maxlen, "%s", asecFileName);
+    return 0;
+}
+
 int VolumeManager::createAsec(const char *id, unsigned int numSectors,
                               const char *fstype, const char *key, int ownerUid) {
     struct asec_superblock sb;
diff --git a/VolumeManager.h b/VolumeManager.h
index 2072ca7..f526990 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -93,6 +93,7 @@
     int unmountAsec(const char *id, bool force);
     int renameAsec(const char *id1, const char *id2);
     int getAsecMountPath(const char *id, char *buffer, int maxlen);
+    int getAsecFilesystemPath(const char *id, char *buffer, int maxlen);
 
     /* Loopback images */
     int listMountedObbs(SocketClient* cli);