Merge "Add libdm and dmctl support for dm-user targets"
This commit is contained in:
commit
3042f0ff9f
3 changed files with 17 additions and 0 deletions
|
@ -280,5 +280,12 @@ std::string DmTargetDefaultKey::GetParameterString() const {
|
|||
return android::base::Join(argv, " ");
|
||||
}
|
||||
|
||||
std::string DmTargetUser::GetParameterString() const {
|
||||
std::vector<std::string> argv;
|
||||
argv.push_back(std::to_string(start()));
|
||||
argv.push_back(std::to_string(size()));
|
||||
return android::base::Join(argv, " ");
|
||||
}
|
||||
|
||||
} // namespace dm
|
||||
} // namespace android
|
||||
|
|
|
@ -309,6 +309,14 @@ class DmTargetDefaultKey final : public DmTarget {
|
|||
bool is_hw_wrapped_ = false;
|
||||
};
|
||||
|
||||
class DmTargetUser final : public DmTarget {
|
||||
public:
|
||||
DmTargetUser(uint64_t start, uint64_t length) : DmTarget(start, length) {}
|
||||
|
||||
std::string name() const override { return "user"; }
|
||||
std::string GetParameterString() const override;
|
||||
};
|
||||
|
||||
} // namespace dm
|
||||
} // namespace android
|
||||
|
||||
|
|
|
@ -174,6 +174,8 @@ class TargetParser final {
|
|||
}
|
||||
return std::make_unique<DmTargetSnapshot>(start_sector, num_sectors, base_device,
|
||||
cow_device, mode, chunk_size);
|
||||
} else if (target_type == "user") {
|
||||
return std::make_unique<DmTargetUser>(start_sector, num_sectors);
|
||||
} else {
|
||||
std::cerr << "Unrecognized target type: " << target_type << std::endl;
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in a new issue