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

Commit 1b727bce authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Extra logging for metadata errors"

parents 09b9fc56 272ef868
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ bool ImageManager::DeleteBackingImage(const std::string& name) {
    // For dm-linear devices sitting on top of /data, we cannot risk deleting
    // the file. The underlying blocks could be reallocated by the filesystem.
    if (IsImageMapped(name)) {
        LOG(ERROR) << "Backing image " << name << " is currently mapped to a block device";
        LOG(ERROR) << "Cannot delete backing image " << name << " because mapped to a block device";
        return false;
    }

+14 −3
Original line number Diff line number Diff line
@@ -39,7 +39,13 @@ std::string GetMetadataFile(const std::string& metadata_dir) {

bool MetadataExists(const std::string& metadata_dir) {
    auto metadata_file = GetMetadataFile(metadata_dir);
    return access(metadata_file.c_str(), F_OK) == 0;
    if (access(metadata_file.c_str(), F_OK)) {
        if (errno != ENOENT) {
            PLOG(ERROR) << "Access " << metadata_file << " failed:";
        }
        return false;
    }
    return true;
}

std::unique_ptr<LpMetadata> OpenMetadata(const std::string& metadata_dir) {
@@ -61,7 +67,7 @@ std::unique_ptr<MetadataBuilder> OpenOrCreateMetadata(const std::string& metadat
    std::unique_ptr<MetadataBuilder> builder;
    if (access(metadata_file.c_str(), R_OK)) {
        if (errno != ENOENT) {
            PLOG(ERROR) << "access " << metadata_file << " failed:";
            PLOG(ERROR) << "Access " << metadata_file << " failed:";
            return nullptr;
        }

@@ -112,7 +118,12 @@ bool SaveMetadata(MetadataBuilder* builder, const std::string& metadata_dir) {

bool RemoveAllMetadata(const std::string& dir) {
    auto metadata_file = GetMetadataFile(dir);
    return android::base::RemoveFileIfExists(metadata_file);
    std::string err;
    if (!android::base::RemoveFileIfExists(metadata_file, &err)) {
        LOG(ERROR) << "Could not remove metadata file: " << err;
        return false;
    }
    return true;
}

bool FillPartitionExtents(MetadataBuilder* builder, Partition* partition, SplitFiemap* file,