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

Commit 1a17e18f authored by David Anderson's avatar David Anderson
Browse files

libdm: Make static std::string inline for DmTargetDefaultKey.

Bug: 149942628
Test: snapshotctl w/ ASAN build
Change-Id: I0f40b1f29e46bc9afaf19d8c21d62280e2c01074
parent 8ef1e1b5
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -243,12 +243,10 @@ std::string DmTargetCrypt::GetParameterString() const {
    return android::base::Join(argv, " ");
}

const std::string DmTargetDefaultKey::name_ = "default-key";

bool DmTargetDefaultKey::IsLegacy(bool* result) {
    DeviceMapper& dm = DeviceMapper::Instance();
    DmTargetTypeInfo info;
    if (!dm.GetTargetByName(name_, &info)) return false;
    if (!dm.GetTargetByName(kName, &info)) return false;
    // dm-default-key was modified to be like dm-crypt with version 2
    *result = !info.IsAtLeast(2, 0, 0);
    return true;
+3 −2
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ class DmTargetDefaultKey final : public DmTarget {
          blockdev_(blockdev),
          start_sector_(start_sector) {}

    std::string name() const override { return name_; }
    std::string name() const override { return kName; }
    bool Valid() const override;
    std::string GetParameterString() const override;
    static bool IsLegacy(bool* result);
@@ -296,7 +296,8 @@ class DmTargetDefaultKey final : public DmTarget {
    void SetWrappedKeyV0() { is_hw_wrapped_ = true; }

  private:
    static const std::string name_;
    inline static const std::string kName = "default-key";

    std::string cipher_;
    std::string key_;
    std::string blockdev_;