am 57f22625: am ea8dcdcf: am 21ecc30c: Merge "Fix fastbootd build for 64-bit."

* commit '57f226256659eca3cf06233d74761ca9c37d51b2':
  Fix fastbootd build for 64-bit.
This commit is contained in:
Elliott Hughes 2014-01-15 00:36:28 +00:00 committed by Android Git Automerger
commit b6e70fce53
3 changed files with 16 additions and 14 deletions

View File

@ -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;
}

View File

@ -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)

View File

@ -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;
}