Merge "Use the new incfs API to open files" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
52a010e956
@@ -438,7 +438,7 @@ private:
|
||||
}
|
||||
|
||||
const auto fileId = IncFs_FileIdFromMetadata(file.metadata);
|
||||
const auto incfsFd(mIfs->openWrite(fileId));
|
||||
const base::unique_fd incfsFd(mIfs->openForSpecialOps(fileId).release());
|
||||
if (incfsFd < 0) {
|
||||
ALOGE("Failed to open an IncFS file for metadata: %.*s, final file name is: %s. "
|
||||
"Error %d",
|
||||
@@ -716,7 +716,7 @@ private:
|
||||
|
||||
auto& writeFd = writeFds[fileIdx];
|
||||
if (writeFd < 0) {
|
||||
writeFd.reset(this->mIfs->openWrite(fileId));
|
||||
writeFd.reset(this->mIfs->openForSpecialOps(fileId).release());
|
||||
if (writeFd < 0) {
|
||||
ALOGE("Failed to open file %d for writing (%d). Aborting.", header.fileIdx,
|
||||
-writeFd);
|
||||
|
||||
@@ -1182,8 +1182,8 @@ bool IncrementalService::configureNativeBinaries(StorageId storage, std::string_
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
android::base::unique_fd writeFd(mIncFs->openWrite(ifs->control, libFileId));
|
||||
if (writeFd < 0) {
|
||||
const auto writeFd = mIncFs->openForSpecialOps(ifs->control, libFileId);
|
||||
if (!writeFd.ok()) {
|
||||
LOG(ERROR) << "Failed to open write fd for: " << targetLibPath << " errno: " << writeFd;
|
||||
success = false;
|
||||
break;
|
||||
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
virtual ErrorCode link(const Control& control, std::string_view from,
|
||||
std::string_view to) const = 0;
|
||||
virtual ErrorCode unlink(const Control& control, std::string_view path) const = 0;
|
||||
virtual base::unique_fd openWrite(const Control& control, FileId id) const = 0;
|
||||
virtual base::unique_fd openForSpecialOps(const Control& control, FileId id) const = 0;
|
||||
virtual ErrorCode writeBlocks(Span<const DataBlock> blocks) const = 0;
|
||||
};
|
||||
|
||||
@@ -177,8 +177,8 @@ public:
|
||||
ErrorCode unlink(const Control& control, std::string_view path) const override {
|
||||
return incfs::unlink(control, path);
|
||||
}
|
||||
base::unique_fd openWrite(const Control& control, FileId id) const override {
|
||||
return base::unique_fd{incfs::openWrite(control, id)};
|
||||
base::unique_fd openForSpecialOps(const Control& control, FileId id) const override {
|
||||
return base::unique_fd{incfs::openForSpecialOps(control, id).release()};
|
||||
}
|
||||
ErrorCode writeBlocks(Span<const DataBlock> blocks) const override {
|
||||
return incfs::writeBlocks(blocks);
|
||||
|
||||
@@ -175,7 +175,7 @@ public:
|
||||
MOCK_CONST_METHOD3(link,
|
||||
ErrorCode(const Control& control, std::string_view from, std::string_view to));
|
||||
MOCK_CONST_METHOD2(unlink, ErrorCode(const Control& control, std::string_view path));
|
||||
MOCK_CONST_METHOD2(openWrite, base::unique_fd(const Control& control, FileId id));
|
||||
MOCK_CONST_METHOD2(openForSpecialOps, base::unique_fd(const Control& control, FileId id));
|
||||
MOCK_CONST_METHOD1(writeBlocks, ErrorCode(Span<const DataBlock> blocks));
|
||||
|
||||
void makeFileFails() { ON_CALL(*this, makeFile(_, _, _, _, _)).WillByDefault(Return(-1)); }
|
||||
|
||||
Reference in New Issue
Block a user