• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Révision7f724ad4e9f946a38ac737fc4794b212e5e4f6dc (tree)
l'heure2019-04-03 06:08:25
AuteurDavid Anderson <dvander@goog...>
Commiterandroid-build-merger

Message de Log

Merge "Fix device mapper name clashes on non-A/B devices." am: 97d1fccd5b
am: d7874a2fa9

Change-Id: I5ea972dd4e28dc476a49ac623fd03004c4a21ee1

Change Summary

Modification

--- a/fs_mgr/fs_mgr.cpp
+++ b/fs_mgr/fs_mgr.cpp
@@ -1602,14 +1602,6 @@ bool fs_mgr_load_verity_state(int* mode) {
16021602 return true;
16031603 }
16041604
1605-std::string fs_mgr_get_verity_device_name(const FstabEntry& entry) {
1606- if (entry.mount_point == "/") {
1607- // In AVB, the dm device name is vroot instead of system.
1608- return entry.fs_mgr_flags.avb ? "vroot" : "system";
1609- }
1610- return Basename(entry.mount_point);
1611-}
1612-
16131605 bool fs_mgr_is_verity_enabled(const FstabEntry& entry) {
16141606 if (!entry.fs_mgr_flags.verify && !entry.fs_mgr_flags.avb) {
16151607 return false;
@@ -1617,7 +1609,7 @@ bool fs_mgr_is_verity_enabled(const FstabEntry& entry) {
16171609
16181610 DeviceMapper& dm = DeviceMapper::Instance();
16191611
1620- std::string mount_point = fs_mgr_get_verity_device_name(entry);
1612+ std::string mount_point = GetVerityDeviceName(entry);
16211613 if (dm.GetState(mount_point) == DmDeviceState::INVALID) {
16221614 return false;
16231615 }
@@ -1646,7 +1638,7 @@ bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entr
16461638 }
16471639
16481640 DeviceMapper& dm = DeviceMapper::Instance();
1649- std::string device = fs_mgr_get_verity_device_name(entry);
1641+ std::string device = GetVerityDeviceName(entry);
16501642
16511643 std::vector<DeviceMapper::TargetInfo> table;
16521644 if (dm.GetState(device) == DmDeviceState::INVALID || !dm.GetTableInfo(device, &table)) {
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -768,6 +768,17 @@ FstabEntry BuildGsiSystemFstabEntry() {
768768 return system;
769769 }
770770
771+std::string GetVerityDeviceName(const FstabEntry& entry) {
772+ std::string base_device;
773+ if (entry.mount_point == "/") {
774+ // In AVB, the dm device name is vroot instead of system.
775+ base_device = entry.fs_mgr_flags.avb ? "vroot" : "system";
776+ } else {
777+ base_device = android::base::Basename(entry.mount_point);
778+ }
779+ return base_device + "-verity";
780+}
781+
771782 } // namespace fs_mgr
772783 } // namespace android
773784
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -107,5 +107,10 @@ FstabEntry BuildGsiSystemFstabEntry();
107107
108108 std::set<std::string> GetBootDevices();
109109
110+// Return the name of the dm-verity device for the given fstab entry. This does
111+// not check whether the device is valid or exists; it merely returns the
112+// expected name.
113+std::string GetVerityDeviceName(const FstabEntry& entry);
114+
110115 } // namespace fs_mgr
111116 } // namespace android
--- a/fs_mgr/libfs_avb/avb_util.cpp
+++ b/fs_mgr/libfs_avb/avb_util.cpp
@@ -105,14 +105,15 @@ bool HashtreeDmVeritySetup(FstabEntry* fstab_entry, const FsAvbHashtreeDescripto
105105 table.set_readonly(true);
106106
107107 const std::string mount_point(Basename(fstab_entry->mount_point));
108+ const std::string device_name(GetVerityDeviceName(*fstab_entry));
108109 android::dm::DeviceMapper& dm = android::dm::DeviceMapper::Instance();
109- if (!dm.CreateDevice(mount_point, table)) {
110+ if (!dm.CreateDevice(device_name, table)) {
110111 LERROR << "Couldn't create verity device!";
111112 return false;
112113 }
113114
114115 std::string dev_path;
115- if (!dm.GetDmDevicePathByName(mount_point, &dev_path)) {
116+ if (!dm.GetDmDevicePathByName(device_name, &dev_path)) {
116117 LERROR << "Couldn't get verity device path!";
117118 return false;
118119 }