Merge changes Ie4313c7a,I0f40b1f2

* changes:
  snapshotctl: Not necessary to link to libdm.
  libdm: Make static std::string inline for DmTargetDefaultKey.
This commit is contained in:
David Anderson 2020-02-29 05:58:08 +00:00 committed by Gerrit Code Review
commit dc4585cbfa
3 changed files with 4 additions and 6 deletions

View file

@ -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;

View file

@ -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_;

View file

@ -214,7 +214,6 @@ cc_binary {
"snapshotctl.cpp",
],
static_libs: [
"libdm",
"libfstab",
"libsnapshot",
],