diff options
Diffstat (limited to 'applypatch/applypatch.cpp')
-rw-r--r-- | applypatch/applypatch.cpp | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp index eb0a2a7b5..12e139930 100644 --- a/applypatch/applypatch.cpp +++ b/applypatch/applypatch.cpp @@ -23,7 +23,6 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> -#include <sys/statfs.h> #include <sys/types.h> #include <unistd.h> @@ -421,23 +420,6 @@ static size_t FileSink(const unsigned char* data, size_t len, int fd) { return done; } -size_t FreeSpaceForFile(const std::string& filename) { - struct statfs sf; - if (statfs(filename.c_str(), &sf) != 0) { - PLOG(ERROR) << "Failed to statfs " << filename; - return -1; - } - return sf.f_bsize * sf.f_bavail; -} - -int CacheSizeCheck(size_t bytes) { - if (MakeFreeSpaceOnCache(bytes) < 0) { - LOG(ERROR) << "Failed to make " << bytes << " bytes available on /cache"; - return 1; - } - return 0; -} - int applypatch(const char* source_filename, const char* target_filename, const char* target_sha1_str, size_t /* target_size */, const std::vector<std::string>& patch_sha1s, @@ -572,8 +554,8 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr CHECK(android::base::StartsWith(target_filename, "EMMC:")); - // We still write the original source to cache, in case the partition write is interrupted. - if (MakeFreeSpaceOnCache(source_file.data.size()) < 0) { + // We write the original source to cache, in case the partition write is interrupted. + if (!CheckAndFreeSpaceOnCache(source_file.data.size())) { LOG(ERROR) << "Not enough free space on /cache"; return 1; } |