Loading fs_mgr/fs_mgr.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) using DeviceMapper = android::dm::DeviceMapper; using android::dm::DeviceMapper; using android::dm::DmDeviceState; // record fs stat enum FsStatFlags { Loading Loading @@ -1400,8 +1401,12 @@ bool fs_mgr_update_verity_state(std::function<fs_mgr_verity_state_callback> call mount_point = basename(fstab->recs[i].mount_point); } const char* status = nullptr; if (dm.GetState(mount_point) == DmDeviceState::INVALID) { PERROR << "Could not find verity device for mount point: " << mount_point; continue; } const char* status = nullptr; std::vector<DeviceMapper::TargetInfo> table; if (!dm.GetTableStatus(mount_point, &table) || table.empty() || table[0].data.empty()) { if (fstab->recs[i].fs_mgr_flags & MF_VERIFYATBOOT) { Loading fs_mgr/libdm/dm.cpp +10 −3 Original line number Diff line number Diff line Loading @@ -98,10 +98,17 @@ const std::unique_ptr<DmTable> DeviceMapper::table(const std::string& /* name */ return nullptr; } DmDeviceState DeviceMapper::state(const std::string& /* name */) const { // TODO(b/110035986): Return the state, as read from the kernel instead DmDeviceState DeviceMapper::GetState(const std::string& name) const { struct dm_ioctl io; InitIo(&io, name); if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) { return DmDeviceState::INVALID; } if ((io.flags & DM_ACTIVE_PRESENT_FLAG) && !(io.flags & DM_SUSPEND_FLAG)) { return DmDeviceState::ACTIVE; } return DmDeviceState::SUSPENDED; } bool DeviceMapper::CreateDevice(const std::string& name, const DmTable& table) { if (!CreateDevice(name)) { Loading fs_mgr/libdm/include/libdm/dm.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ class DeviceMapper final { // Returns the current state of the underlying device mapper device // with given name. // One of INVALID, SUSPENDED or ACTIVE. DmDeviceState state(const std::string& name) const; DmDeviceState GetState(const std::string& name) const; // Creates a device, loads the given table, and activates it. If the device // is not able to be activated, it is destroyed, and false is returned. Loading Loading
fs_mgr/fs_mgr.cpp +7 −2 Original line number Diff line number Diff line Loading @@ -79,7 +79,8 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) using DeviceMapper = android::dm::DeviceMapper; using android::dm::DeviceMapper; using android::dm::DmDeviceState; // record fs stat enum FsStatFlags { Loading Loading @@ -1400,8 +1401,12 @@ bool fs_mgr_update_verity_state(std::function<fs_mgr_verity_state_callback> call mount_point = basename(fstab->recs[i].mount_point); } const char* status = nullptr; if (dm.GetState(mount_point) == DmDeviceState::INVALID) { PERROR << "Could not find verity device for mount point: " << mount_point; continue; } const char* status = nullptr; std::vector<DeviceMapper::TargetInfo> table; if (!dm.GetTableStatus(mount_point, &table) || table.empty() || table[0].data.empty()) { if (fstab->recs[i].fs_mgr_flags & MF_VERIFYATBOOT) { Loading
fs_mgr/libdm/dm.cpp +10 −3 Original line number Diff line number Diff line Loading @@ -98,10 +98,17 @@ const std::unique_ptr<DmTable> DeviceMapper::table(const std::string& /* name */ return nullptr; } DmDeviceState DeviceMapper::state(const std::string& /* name */) const { // TODO(b/110035986): Return the state, as read from the kernel instead DmDeviceState DeviceMapper::GetState(const std::string& name) const { struct dm_ioctl io; InitIo(&io, name); if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) { return DmDeviceState::INVALID; } if ((io.flags & DM_ACTIVE_PRESENT_FLAG) && !(io.flags & DM_SUSPEND_FLAG)) { return DmDeviceState::ACTIVE; } return DmDeviceState::SUSPENDED; } bool DeviceMapper::CreateDevice(const std::string& name, const DmTable& table) { if (!CreateDevice(name)) { Loading
fs_mgr/libdm/include/libdm/dm.h +1 −1 Original line number Diff line number Diff line Loading @@ -79,7 +79,7 @@ class DeviceMapper final { // Returns the current state of the underlying device mapper device // with given name. // One of INVALID, SUSPENDED or ACTIVE. DmDeviceState state(const std::string& name) const; DmDeviceState GetState(const std::string& name) const; // Creates a device, loads the given table, and activates it. If the device // is not able to be activated, it is destroyed, and false is returned. Loading