db845c: qcom: rmtfs: Use -o option to override partition by-name am: 39f249cbdb am: de25da8c57

Change-Id: I62dc4cade15e58f8e71182d7884fa097c0a3e2fb
diff --git a/qcom/rmtfs/rmtfs.c b/qcom/rmtfs/rmtfs.c
index 795c021..26c0488 100644
--- a/qcom/rmtfs/rmtfs.c
+++ b/qcom/rmtfs/rmtfs.c
@@ -499,7 +499,11 @@
 
 	while ((option = getopt(argc, argv, "o:Prsv")) != -1) {
 		switch (option) {
-		/* -o sets the directory where EFS images are stored. */
+		/*
+		 * -o sets the directory where EFS images are stored,
+		 * or sets the directory from where raw EFS partitions
+		 * can be picked by-name when used with -P option.
+		 */
 		case 'o':
 			storage_root = optarg;
 			break;
diff --git a/qcom/rmtfs/storage.c b/qcom/rmtfs/storage.c
index d31f757..4c78ab3 100644
--- a/qcom/rmtfs/storage.c
+++ b/qcom/rmtfs/storage.c
@@ -11,11 +11,7 @@
 #define MAX_CALLERS 10
 #define STORAGE_MAX_SIZE (16 * 1024 * 1024)
 
-#ifndef ANDROID
 #define BY_PARTLABEL_PATH "/dev/disk/by-partlabel"
-#else
-#define BY_PARTLABEL_PATH "/dev/block/by-name"
-#endif
 
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
 
@@ -60,7 +56,8 @@
 		storage_dir = storage_root;
 
 	if (use_partitions) {
-		storage_dir = BY_PARTLABEL_PATH;
+		if (!storage_root)
+			storage_dir = BY_PARTLABEL_PATH;
 		storage_use_partitions = true;
 	}