Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f24125c authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Fix fastbootd build for 64-bit.

Change-Id: I04bef46f0125fd6a8fc0cb966bd257ad594aff1e
parent aead003c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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;
    }

+10 −9
Original line number Diff line number Diff line
@@ -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)
+3 −3
Original line number Diff line number Diff line
@@ -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;
        }