refactor fuse sideloading code

Split the adb-specific portions (fetching a block from the adb host
and closing the connections) out from the rest of the FUSE filesystem
code, so that we can reuse the fuse stuff for installing off sdcards
as well.

Change-Id: I0ba385fd35999c5f5cad27842bc82024a264dd14
diff --git a/adb_install.cpp b/adb_install.cpp
index fb7860c..be3b9a0 100644
--- a/adb_install.cpp
+++ b/adb_install.cpp
@@ -31,7 +31,8 @@
 #include "common.h"
 #include "adb_install.h"
 extern "C" {
-#include "minadbd/adb.h"
+#include "minadbd/fuse_adb_provider.h"
+#include "fuse_sideload.h"
 }
 
 static RecoveryUI* ui = NULL;
@@ -89,7 +90,7 @@
         _exit(-1);
     }
 
-    // ADB_SIDELOAD_HOST_PATHNAME will start to exist once the host
+    // FUSE_SIDELOAD_HOST_PATHNAME will start to exist once the host
     // connects and starts serving a package.  Poll for its
     // appearance.  (Note that inotify doesn't work with FUSE.)
     int result;
@@ -103,7 +104,7 @@
             break;
         }
 
-        if (stat(ADB_SIDELOAD_HOST_PATHNAME, &st) != 0) {
+        if (stat(FUSE_SIDELOAD_HOST_PATHNAME, &st) != 0) {
             if (errno == ENOENT && i < ADB_INSTALL_TIMEOUT-1) {
                 sleep(1);
                 continue;
@@ -114,14 +115,14 @@
                 break;
             }
         }
-        result = install_package(ADB_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false);
+        result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false);
         break;
     }
 
     if (!waited) {
         // Calling stat() on this magic filename signals the minadbd
         // subprocess to shut down.
-        stat(ADB_SIDELOAD_HOST_EXIT_PATHNAME, &st);
+        stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st);
 
         // TODO(dougz): there should be a way to cancel waiting for a
         // package (by pushing some button combo on the device).  For now