fix up some implicit declarations

Change-Id: Ia98bb5bea04a9cb87bf1993687e7f91f46022509
diff --git a/extendedcommands.c b/extendedcommands.c
index 3dbba60..bafa552 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -38,6 +38,8 @@
 #include "mounts.h"
 #include "flashutils/flashutils.h"
 #include "edify/expr.h"
+#include <libgen.h>
+
 
 int signature_check_enabled = 1;
 int script_assert_enabled = 1;
@@ -639,6 +641,8 @@
     return 0 == stat(EXTENDEDCOMMAND_SCRIPT, &file_info);
 }
 
+void process_volumes();
+
 int edify_main(int argc, char** argv) {
     load_volume_table();
     process_volumes();
diff --git a/extendedcommands.h b/extendedcommands.h
index 9297f83..a016b84 100644
--- a/extendedcommands.h
+++ b/extendedcommands.h
@@ -44,4 +44,6 @@
 
 void create_fstab();
 
-int has_datadata();
\ No newline at end of file
+int has_datadata();
+
+void handle_failure(int ret);
diff --git a/flashutils/flash_image.c b/flashutils/flash_image.c
index e9fa570..c9f3683 100644
--- a/flashutils/flash_image.c
+++ b/flashutils/flash_image.c
@@ -22,6 +22,7 @@
 #include <unistd.h>
 
 #include "cutils/log.h"
+#include "flashutils.h"
 
 #if 0
 #define LOG_TAG "flash_image"
diff --git a/flashutils/flashutils.c b/flashutils/flashutils.c
index 7dc750c..2f8da41 100644
--- a/flashutils/flashutils.c
+++ b/flashutils/flashutils.c
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/wait.h>
+#include <stdio.h>
 
 #include "flashutils/flashutils.h"
 
diff --git a/nandroid.c b/nandroid.c
index b9312e8..54d90b0 100644
--- a/nandroid.c
+++ b/nandroid.c
@@ -37,6 +37,25 @@
 
 #include "extendedcommands.h"
 #include "nandroid.h"
+#include "flashutils/flashutils.h"
+#include <libgen.h>
+
+
+void nandroid_generate_timestamp_path(const char* backup_path)
+{
+    time_t t = time(NULL);
+    struct tm *tmp = localtime(&t);
+    if (tmp == NULL)
+    {
+        struct timeval tp;
+        gettimeofday(&tp, NULL);
+        sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec);
+    }
+    else
+    {
+        strftime(backup_path, PATH_MAX, "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp);
+    }
+}
 
 int print_and_error(const char* message) {
     ui_print("%s", message);
@@ -45,7 +64,7 @@
 
 int yaffs_files_total = 0;
 int yaffs_files_count = 0;
-void yaffs_callback(char* filename)
+void yaffs_callback(const char* filename)
 {
     char* justfile = basename(filename);
     if (strlen(justfile) < 30)
@@ -56,7 +75,7 @@
     ui_reset_text_col();
 }
 
-void compute_directory_stats(char* directory)
+void compute_directory_stats(const char* directory)
 {
     char tmp[PATH_MAX];
     sprintf(tmp, "find %s | wc -l > /tmp/dircount", directory);
@@ -380,22 +399,6 @@
     return 0;
 }
 
-void nandroid_generate_timestamp_path(char* backup_path)
-{
-    time_t t = time(NULL);
-    struct tm *tmp = localtime(&t);
-    if (tmp == NULL)
-    {
-        struct timeval tp;
-        gettimeofday(&tp, NULL);
-        sprintf(backup_path, "/sdcard/clockworkmod/backup/%d", tp.tv_sec);
-    }
-    else
-    {
-        strftime(backup_path, PATH_MAX, "/sdcard/clockworkmod/backup/%F.%H.%M.%S", tmp);
-    }
-}
-
 int nandroid_usage()
 {
     printf("Usage: nandroid backup\n");
diff --git a/nandroid.h b/nandroid.h
index 926bf30..836f192 100644
--- a/nandroid.h
+++ b/nandroid.h
@@ -4,6 +4,5 @@
 int nandroid_main(int argc, char** argv);
 int nandroid_backup(const char* backup_path);
 int nandroid_restore(const char* backup_path, int restore_boot, int restore_system, int restore_data, int restore_cache, int restore_sdext, int restore_wimax);
-void nandroid_generate_timestamp_path(char* backup_path);
 
 #endif
\ No newline at end of file
diff --git a/roots.c b/roots.c
index c1c37a3..4ecc4dd 100644
--- a/roots.c
+++ b/roots.c
@@ -28,6 +28,9 @@
 #include "common.h"
 #include "make_ext4fs.h"
 
+#include "flashutils/flashutils.h"
+#include "extendedcommands.h"
+
 int num_volumes;
 Volume* device_volumes;
 
@@ -301,10 +304,6 @@
         return 0;
     }
 
-    if (strcmp(v->fs_type, "emmc") == 0) {
-        return erase_raw_partition("emmc", v->device);
-    }
-
     if (strcmp(v->fs_type, "ext4") == 0) {
         reset_ext4fs_info();
         int result = make_ext4fs(v->device, NULL, NULL, 0, 0, 0);