remove the notion of "root path"; support mixed flash types

Remove the wacky notion of "roots" and "root paths" (those things that
look like "FOO:some/path" instead of just "/foo/some/path").  Let each
device specify its own table of available partitions and how to mount
them (needed for devices that use both MTD/yaffs2 and EMMC/ext4

(Cherrypicked from gingerbread w/slight edits.)

Change-Id: I2479ce76b13e73f1d12035c89386c3a82b3edf51
diff --git a/roots.h b/roots.h
index e85191d..cf59bfd 100644
--- a/roots.h
+++ b/roots.h
@@ -17,33 +17,25 @@
-#include "minzip/Zip.h"
-#include "mtdutils/mtdutils.h"
+#include "common.h"
-/* Any of the "root_path" arguments can be paths with relative
- * components, like "SYSTEM:a/b/c".
- */
+// Load and parse volume data from /etc/recovery.fstab.
+void load_volume_table();
-/* Takes a string like "SYSTEM:lib" and turns it into a string
- * like "/system/lib".  The translated path is put in out_buf,
- * and out_buf is returned if the translation succeeded.
- */
-const char *translate_root_path(const char *root_path,
-        char *out_buf, size_t out_buf_len);
+// Return the Volume* record for this path (or NULL).
+Volume* volume_for_path(const char* path);
-/* Returns negative on error, positive if it's mounted, zero if it isn't.
- */
-int is_root_path_mounted(const char *root_path);
+// Make sure that the volume 'path' is on is mounted.  Returns 0 on
+// success (volume is mounted).
+int ensure_path_mounted(const char* path);
-int ensure_root_path_mounted(const char *root_path);
+// Make sure that the volume 'path' is on is mounted.  Returns 0 on
+// success (volume is unmounted);
+int ensure_path_unmounted(const char* path);
-int ensure_root_path_unmounted(const char *root_path);
-const MtdPartition *get_root_mtd_partition(const char *root_path);
-/* "root" must be the exact name of the root; no relative path is permitted.
- * If the named root is mounted, this will attempt to unmount it first.
- */
-int format_root_device(const char *root);
+// Reformat the given volume (must be the mount point only, eg
+// "/cache"), no paths permitted.  Attempts to unmount the volume if
+// it is mounted.
+int format_volume(const char* volume);
 #endif  // RECOVERY_ROOTS_H_