summaryrefslogtreecommitdiffstats
path: root/mtdutils
diff options
context:
space:
mode:
Diffstat (limited to 'mtdutils')
-rw-r--r--mtdutils/flash_image.c10
-rw-r--r--mtdutils/mounts.h8
-rw-r--r--mtdutils/mtdutils.h8
3 files changed, 21 insertions, 5 deletions
diff --git a/mtdutils/flash_image.c b/mtdutils/flash_image.c
index c77687602..a39d60001 100644
--- a/mtdutils/flash_image.c
+++ b/mtdutils/flash_image.c
@@ -42,7 +42,7 @@ void die(const char *msg, ...) {
}
fprintf(stderr, "%s\n", buf);
- LOGE("%s\n", buf);
+ ALOGE("%s\n", buf);
exit(1);
}
@@ -74,23 +74,23 @@ int main(int argc, char **argv) {
MtdReadContext *in = mtd_read_partition(partition);
if (in == NULL) {
- LOGW("error opening %s: %s\n", argv[1], strerror(errno));
+ ALOGW("error opening %s: %s\n", argv[1], strerror(errno));
// just assume it needs re-writing
} else {
char check[HEADER_SIZE];
int checklen = mtd_read_data(in, check, sizeof(check));
if (checklen <= 0) {
- LOGW("error reading %s: %s\n", argv[1], strerror(errno));
+ ALOGW("error reading %s: %s\n", argv[1], strerror(errno));
// just assume it needs re-writing
} else if (checklen == headerlen && !memcmp(header, check, headerlen)) {
- LOGI("header is the same, not flashing %s\n", argv[1]);
+ ALOGI("header is the same, not flashing %s\n", argv[1]);
return 0;
}
mtd_read_close(in);
}
// Skip the header (we'll come back to it), write everything else
- LOGI("flashing %s from %s\n", argv[1], argv[2]);
+ ALOGI("flashing %s from %s\n", argv[1], argv[2]);
MtdWriteContext *out = mtd_write_partition(partition);
if (out == NULL) die("error writing %s", argv[1]);
diff --git a/mtdutils/mounts.h b/mtdutils/mounts.h
index 30b2927c2..d721355b8 100644
--- a/mtdutils/mounts.h
+++ b/mtdutils/mounts.h
@@ -17,6 +17,10 @@
#ifndef MTDUTILS_MOUNTS_H_
#define MTDUTILS_MOUNTS_H_
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct MountedVolume MountedVolume;
int scan_mounted_volumes(void);
@@ -30,4 +34,8 @@ int unmount_mounted_volume(const MountedVolume *volume);
int remount_read_only(const MountedVolume* volume);
+#ifdef __cplusplus
+}
+#endif
+
#endif // MTDUTILS_MOUNTS_H_
diff --git a/mtdutils/mtdutils.h b/mtdutils/mtdutils.h
index 45d3ebc91..2708c4318 100644
--- a/mtdutils/mtdutils.h
+++ b/mtdutils/mtdutils.h
@@ -19,6 +19,10 @@
#include <sys/types.h> // for size_t, etc.
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct MtdPartition MtdPartition;
int mtd_scan_partitions(void);
@@ -53,4 +57,8 @@ off_t mtd_erase_blocks(MtdWriteContext *, int blocks); /* 0 ok, -1 for all */
off_t mtd_find_write_start(MtdWriteContext *ctx, off_t pos);
int mtd_write_close(MtdWriteContext *);
+#ifdef __cplusplus
+}
+#endif
+
#endif // MTDUTILS_H_