From 955d3afe95df7e2ac7de0445777539aabe9aa3a5 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Thu, 1 Sep 2016 13:43:51 -0700 Subject: DO NOT MERGE: fec: remove unneeded target executable Bug: 32789520 Change-Id: Ic925814191b8ac952b584a994cf455f871a8ee0c (cherrypicked from commit 4c716c92a691e6b39e8e65a397f9b6e91f9e07ee) --- verity/fec/Android.mk | 21 +------------------- verity/fec/image.cpp | 53 --------------------------------------------------- 2 files changed, 1 insertion(+), 73 deletions(-) diff --git a/verity/fec/Android.mk b/verity/fec/Android.mk index c13f5775..5fff9c37 100644 --- a/verity/fec/Android.mk +++ b/verity/fec/Android.mk @@ -19,23 +19,4 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_SHARED_LIBRARIES := libbase LOCAL_CFLAGS += -Wall -Werror -O3 LOCAL_C_INCLUDES += external/fec -include $(BUILD_HOST_EXECUTABLE) - -include $(CLEAR_VARS) -LOCAL_CLANG := true -LOCAL_SANITIZE := integer -LOCAL_MODULE := fec -LOCAL_FORCE_STATIC_EXECUTABLE := true -LOCAL_SRC_FILES := main.cpp image.cpp -LOCAL_MODULE_TAGS := optional -LOCAL_STATIC_LIBRARIES := \ - libcrypto_static \ - libfec \ - libfec_rs \ - libbase \ - libext4_utils_static \ - libsquashfs_utils \ - libcutils -LOCAL_CFLAGS += -Wall -Werror -O3 -DIMAGE_NO_SPARSE=1 -LOCAL_C_INCLUDES += external/fec -include $(BUILD_EXECUTABLE) +include $(BUILD_HOST_EXECUTABLE) \ No newline at end of file diff --git a/verity/fec/image.cpp b/verity/fec/image.cpp index 780d9810..7c1eab76 100644 --- a/verity/fec/image.cpp +++ b/verity/fec/image.cpp @@ -33,9 +33,7 @@ extern "C" { #include #include #include -#ifndef IMAGE_NO_SPARSE #include -#endif #include "image.h" #if defined(__linux__) @@ -66,31 +64,6 @@ void image_free(image *ctx) image_init(ctx); } -#ifdef IMAGE_NO_SPARSE -static uint64_t get_size(int fd) -{ - struct stat st; - - if (fstat(fd, &st) == -1) { - FATAL("failed to fstat: %s\n", strerror(errno)); - } - - uint64_t size = 0; - - if (S_ISBLK(st.st_mode)) { - if (ioctl(fd, BLKGETSIZE64, &size) == -1) { - FATAL("failed to ioctl(BLKGETSIZE64): %s\n", strerror(errno)); - } - } else if (S_ISREG(st.st_mode)) { - size = st.st_size; - } else { - FATAL("unknown file mode: %d\n", (int)st.st_mode); - } - - return size; -} -#endif - static void calculate_rounds(uint64_t size, image *ctx) { if (!size) { @@ -105,7 +78,6 @@ static void calculate_rounds(uint64_t size, image *ctx) ctx->rounds = fec_div_round_up(ctx->blocks, ctx->rs_n); } -#ifndef IMAGE_NO_SPARSE static int process_chunk(void *priv, const void *data, int len) { image *ctx = (image *)priv; @@ -118,25 +90,14 @@ static int process_chunk(void *priv, const void *data, int len) ctx->pos += len; return 0; } -#endif static void file_image_load(const std::vector& fds, image *ctx) { uint64_t size = 0; -#ifndef IMAGE_NO_SPARSE std::vector files; -#endif for (auto fd : fds) { uint64_t len = 0; - -#ifdef IMAGE_NO_SPARSE - if (ctx->sparse) { - FATAL("sparse files not supported\n"); - } - - len = get_size(fd); -#else struct sparse_file *file; if (ctx->sparse) { @@ -151,7 +112,6 @@ static void file_image_load(const std::vector& fds, image *ctx) len = sparse_file_len(file, false, false); files.push_back(file); -#endif /* IMAGE_NO_SPARSE */ size += len; } @@ -172,18 +132,6 @@ static void file_image_load(const std::vector& fds, image *ctx) ctx->output = ctx->input; ctx->pos = 0; -#ifdef IMAGE_NO_SPARSE - for (auto fd : fds) { - uint64_t len = get_size(fd); - - if (!android::base::ReadFully(fd, &ctx->input[ctx->pos], len)) { - FATAL("failed to read: %s\n", strerror(errno)); - } - - ctx->pos += len; - close(fd); - } -#else for (auto file : files) { sparse_file_callback(file, false, false, process_chunk, ctx); sparse_file_destroy(file); @@ -192,7 +140,6 @@ static void file_image_load(const std::vector& fds, image *ctx) for (auto fd : fds) { close(fd); } -#endif } bool image_load(const std::vector& filenames, image *ctx) -- cgit v1.2.3