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

Commit 805bc5d7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "liblp: Add more logging for logical partition operations."

parents 132615b8 b9f734c9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -133,7 +133,11 @@ bool CreateLogicalPartition(const std::string& block_device, uint32_t metadata_s

bool DestroyLogicalPartition(const std::string& name) {
    DeviceMapper& dm = DeviceMapper::Instance();
    return dm.DeleteDevice(name);
    if (!dm.DeleteDevice(name)) {
        return false;
    }
    LINFO << "Unmapped logical partition " << name;
    return true;
}

}  // namespace fs_mgr
+9 −4
Original line number Diff line number Diff line
@@ -498,13 +498,18 @@ void MetadataBuilder::set_block_device_info(const BlockDeviceInfo& device_info)
bool MetadataBuilder::ResizePartition(Partition* partition, uint64_t requested_size) {
    // Align the space needed up to the nearest sector.
    uint64_t aligned_size = AlignTo(requested_size, device_info_.logical_block_size);
    uint64_t old_size = partition->size();

    if (aligned_size > partition->size()) {
        return GrowPartition(partition, aligned_size);
    if (aligned_size > old_size) {
        if (!GrowPartition(partition, aligned_size)) {
            return false;
        }
    if (aligned_size < partition->size()) {
    } else if (aligned_size < partition->size()) {
        ShrinkPartition(partition, aligned_size);
    }

    LINFO << "Partition " << partition->name() << " will resize from " << old_size << " bytes to "
          << aligned_size << " bytes";
    return true;
}

+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include "liblp/metadata_format.h"

#define LP_TAG "[liblp]"
#define LWARN LOG(WARNING) << LP_TAG
#define LINFO LOG(INFO) << LP_TAG
#define LERROR LOG(ERROR) << LP_TAG
#define PERROR PLOG(ERROR) << LP_TAG

+11 −2
Original line number Diff line number Diff line
@@ -304,7 +304,11 @@ bool FlashPartitionTable(const std::string& block_device, const LpMetadata& meta
        PERROR << __PRETTY_FUNCTION__ << "open failed: " << block_device;
        return false;
    }
    return FlashPartitionTable(fd, metadata, slot_number);
    if (!FlashPartitionTable(fd, metadata, slot_number)) {
        return false;
    }
    LWARN << "Flashed new logical partition geometry to " << block_device;
    return true;
}

bool UpdatePartitionTable(const std::string& block_device, const LpMetadata& metadata,
@@ -314,7 +318,12 @@ bool UpdatePartitionTable(const std::string& block_device, const LpMetadata& met
        PERROR << __PRETTY_FUNCTION__ << "open failed: " << block_device;
        return false;
    }
    return UpdatePartitionTable(fd, metadata, slot_number);
    if (!UpdatePartitionTable(fd, metadata, slot_number)) {
        return false;
    }
    LINFO << "Updated logical partition table at slot " << slot_number << " on device "
          << block_device;
    return true;
}

bool UpdatePartitionTable(int fd, const LpMetadata& metadata, uint32_t slot_number) {