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

* commit '21ecc30cd0bb0eb5035d48e4eb0e78d6a509dd8d':
  Fix fastbootd build for 64-bit.
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 @@
 
     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 @@
 
     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 @@
             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 @@
     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 @@
         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 @@
     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 @@
         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;
         }