Change FILE_OFFSET_BITS to 64 bits to support a large file 32/209432/2
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 5 Jul 2019 08:03:07 +0000 (17:03 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Mon, 8 Jul 2019 02:02:20 +0000 (11:02 +0900)
Change-Id: I034da2578c1355a93758fc960431410c7d2edf80

agent/CMakeLists.txt
agent/download-agent-file.c
packaging/download-provider.spec
provider/CMakeLists.txt

index fef1fac..4b0db83 100755 (executable)
@@ -75,6 +75,11 @@ IF (SUPPORT_DOWNLOAD_BOOSTER)
        ADD_DEFINITIONS("-D_DOWNLOAD_BOOSTER_SUPPORT")
 ENDIF (SUPPORT_DOWNLOAD_BOOSTER)
 
+IF(SUPPORT_LARGE_FILE)
+       MESSAGE("Large file:On")
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -D_FILE_OFFSET_BITS=64")
+ENDIF(SUPPORT_LARGE_FILE)
+
 FOREACH(flag ${subpkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
index 50212ff..b02a58b 100755 (executable)
@@ -215,7 +215,7 @@ da_ret_t __file_write_buf_flush_buf(file_info_t *file_info)
         * The solution for reducing fflush is needed */
        //fflush((FILE *) fd);
        if (write_success_len != buffer_size) {
-               DA_LOGE("write  fails ");
+               DA_LOGE("write  fails [%d]", errno);
                if (errno == ENOSPC)
                        ret = DA_ERR_DISK_FULL;
                else
@@ -270,7 +270,7 @@ da_ret_t __file_write_buf_directly_write(file_info_t *file_info,
         * The solution for reducing fflush is needed */
        //fflush((FILE *) fd);
        if (write_success_len != (size_t)body_len) {
-               DA_LOGE("write  fails ");
+               DA_LOGE("write  fails [%d]", errno);
                if (errno == ENOSPC)
                        ret = DA_ERR_DISK_FULL;
                else
@@ -959,9 +959,9 @@ da_ret_t get_available_memory(const char *dir_path, da_size_t len)
        DA_SECURE_LOGI(" total = %lf ", total_size);
        DA_SECURE_LOGI(" available = %lf ", available_size);
 
-       DA_LOGV("Available Memory(f_bavail) : %lu", filesys_info.f_bavail);
+       DA_LOGV("Available Memory(f_bavail) : %llu", filesys_info.f_bavail);
        DA_LOGV("Available Memory(f_bsize) : %d", filesys_info.f_bsize);
-       DA_LOGD("Available Memory(kbytes) : %lu", (filesys_info.f_bavail/1024)*filesys_info.f_bsize);
+       DA_LOGD("Available Memory(kbytes) : %llu", (filesys_info.f_bavail/1024)*filesys_info.f_bsize);
        DA_LOGV("Content: %llu", len);
        if (available_size < (len
                                + SAVE_FILE_BUFFERING_SIZE_50KB)) /* 50KB buffering */
index 4620923..b6f7381 100755 (executable)
@@ -119,6 +119,7 @@ export LDFLAGS+=" -lgcov"
        -DBUILD_SHARED_LIBS:BOOL=ON \
        -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
        -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
+       -DSUPPORT_LARGE_FILE:BOOL=ON \
        .
 
 make %{?jobs:-j%jobs}
index 155e6ee..8a9e7a5 100755 (executable)
@@ -67,6 +67,11 @@ ELSE (SUPPORT_COMPANION_MODE)
 MESSAGE("Companion:Off")
 ENDIF(SUPPORT_COMPANION_MODE)
 
+IF(SUPPORT_LARGE_FILE)
+       MESSAGE("Large file:On")
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -D_FILE_OFFSET_BITS=64")
+ENDIF(SUPPORT_LARGE_FILE)
+
 ## INCLUDES
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/agent/include)