summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-01-14 16:17:08 -0800
committerElliott Hughes <enh@google.com>2014-01-14 16:17:08 -0800
commit4f24125ccc7748bb971b686f4c1b18c6f4a5e4ac (patch)
tree9a6ac4c75ca8a6a83956027e52befd57bd413ad0
parentaead003c8bc677218329c535b063a5bb66695414 (diff)
downloadsystem_core-4f24125ccc7748bb971b686f4c1b18c6f4a5e4ac.zip
system_core-4f24125ccc7748bb971b686f4c1b18c6f4a5e4ac.tar.gz
system_core-4f24125ccc7748bb971b686f4c1b18c6f4a5e4ac.tar.bz2
Fix fastbootd build for 64-bit.
Change-Id: I04bef46f0125fd6a8fc0cb966bd257ad594aff1e
-rw-r--r--fastbootd/commands/partitions.c5
-rw-r--r--fastbootd/other/gptedit.c19
-rw-r--r--fastbootd/utils.c6
3 files changed, 16 insertions, 14 deletions
diff --git a/fastbootd/commands/partitions.c b/fastbootd/commands/partitions.c
index de80ea3..74232e6 100644
--- a/fastbootd/commands/partitions.c
+++ b/fastbootd/commands/partitions.c
@@ -42,6 +42,7 @@
#include <sys/ioctl.h>
#include <stdlib.h>
#include <cutils/config_utils.h>
+#include <inttypes.h>
#include "partitions.h"
#include "debug.h"
@@ -80,7 +81,7 @@ int gpt_mmap(struct GPT_mapping *mapping, uint64_t location, int size, int fd)
uint64_t sz = get_file_size64(fd);
if (sz < size + location) {
- D(ERR, "the location of mapping area is outside of the device size %lld", sz);
+ D(ERR, "the location of mapping area is outside of the device size %" PRId64, sz);
return 1;
}
location = ALIGN_DOWN(location, PAGE_SIZE);
@@ -89,7 +90,7 @@ int gpt_mmap(struct GPT_mapping *mapping, uint64_t location, int size, int fd)
if (mapping->map_ptr == MAP_FAILED) {
mapping->ptr = MAP_FAILED;
- D(ERR, "map failed %d", (int) mapping->map_ptr);
+ D(ERR, "map failed: %s", strerror(errno));
return 1;
}
diff --git a/fastbootd/other/gptedit.c b/fastbootd/other/gptedit.c
index 16d34a5..d423529 100644
--- a/fastbootd/other/gptedit.c
+++ b/fastbootd/other/gptedit.c
@@ -29,9 +29,10 @@
* SUCH DAMAGE.
*/
+#include <getopt.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
-#include <getopt.h>
#include <unistd.h>
#include <cutils/klog.h>
@@ -185,7 +186,7 @@ void printGPT(struct GPT_entry_table *table) {
name[m] = entry->name[m] & 127;
}
name[m] = 0;
- printf("#%03d %13lld %13lld %s\n",
+ printf("#%03d %13"PRId64" %13"PRId64" %s\n",
n + 1, entry->first_lba, entry->last_lba, name);
}
}
@@ -197,11 +198,11 @@ void configPrintGPT(struct GPT_entry_table *table) {
char temp_guid[17];
temp_guid[16] = 0;
- printf("header_lba %lld\n", table->header->current_lba);
- printf("backup_lba %lld\n", table->header->backup_lba);
- printf("first_lba %lld\n", table->header->first_usable_lba);
- printf("last_lba %lld\n", table->header->last_usable_lba);
- printf("entries_lba %lld\n", table->header->entries_lba);
+ printf("header_lba %"PRId64"\n", table->header->current_lba);
+ printf("backup_lba %"PRId64"\n", table->header->backup_lba);
+ printf("first_lba %"PRId64"\n", table->header->first_usable_lba);
+ printf("last_lba %"PRId64"\n", table->header->last_usable_lba);
+ printf("entries_lba %"PRId64"\n", table->header->entries_lba);
snprintf(temp_guid, 17, "%s", table->header->disk_guid);
printf("guid \"%s\"", temp_guid);
@@ -220,8 +221,8 @@ void configPrintGPT(struct GPT_entry_table *table) {
printf(" %s {\n", name);
snprintf(temp_guid, 17, "%s", entry->partition_guid);
printf(" guid \"%s\"\n", temp_guid);
- printf(" first_lba %lld\n", entry->first_lba);
- printf(" partition_size %lld\n", size);
+ printf(" first_lba %"PRId64"\n", entry->first_lba);
+ printf(" partition_size %"PRId64"\n", size);
if (entry->flags & GPT_FLAG_SYSTEM)
printf(" system\n");
if (entry->flags & GPT_FLAG_BOOTABLE)
diff --git a/fastbootd/utils.c b/fastbootd/utils.c
index fe3f0f8..bef2463 100644
--- a/fastbootd/utils.c
+++ b/fastbootd/utils.c
@@ -169,7 +169,7 @@ ssize_t bulk_write(int bulk_in, const char *buf, size_t length)
do {
ret = TEMP_FAILURE_RETRY(write(bulk_in, buf + count, length - count));
if (ret < 0) {
- D(WARN, "[ bulk_write failed fd=%d length=%d errno=%d %s ]",
+ D(WARN, "[ bulk_write failed fd=%d length=%zu errno=%d %s ]",
bulk_in, length, errno, strerror(errno));
return -1;
} else {
@@ -190,13 +190,13 @@ ssize_t bulk_read(int bulk_out, char *buf, size_t length)
size_t to_read = (length - n > READ_BUF_SIZE) ? READ_BUF_SIZE : length - n;
ret = TEMP_FAILURE_RETRY(read(bulk_out, buf + n, to_read));
if (ret < 0) {
- D(WARN, "[ bulk_read failed fd=%d length=%d errno=%d %s ]",
+ D(WARN, "[ bulk_read failed fd=%d length=%zu errno=%d %s ]",
bulk_out, length, errno, strerror(errno));
return ret;
}
n += ret;
if (ret < (ssize_t)to_read) {
- D(VERBOSE, "bulk_read short read, ret=%zd to_read=%u n=%u length=%u",
+ D(VERBOSE, "bulk_read short read, ret=%zd to_read=%zu n=%zu length=%zu",
ret, to_read, n, length);
break;
}