summaryrefslogtreecommitdiff
path: root/fs_mgr/libdm/dm.cpp
diff options
context:
space:
mode:
authorJustin DeMartino <jjdemartino@google.com>2020-10-14 19:39:53 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2020-10-14 19:39:53 +0000
commit0d11af03e43f110b0bb160f7e20436d0043e3038 (patch)
tree48f8bcca856276ec73a86dd3fb26143d3ca64578 /fs_mgr/libdm/dm.cpp
parent075666ebd0dee8d0c4a2efa54f7c324a3f67ee2a (diff)
parenta6c01e4e98d2b343dcecfc99611e2e6250c730db (diff)
Merge changes from topic "SP1A.200921.001" into s-keystone-qcom-dev
* changes: fs_mgr: adb-remount-test.sh: filter out more administrivia mounts. Merge SP1A.200921.001 Change-Id: I90b97c4e9fb10b1f45e74def404823eed5b1aaa8
Diffstat (limited to 'fs_mgr/libdm/dm.cpp')
-rw-r--r--fs_mgr/libdm/dm.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs_mgr/libdm/dm.cpp b/fs_mgr/libdm/dm.cpp
index 791268849..bb7d8b311 100644
--- a/fs_mgr/libdm/dm.cpp
+++ b/fs_mgr/libdm/dm.cpp
@@ -427,6 +427,20 @@ bool DeviceMapper::GetDmDevicePathByName(const std::string& name, std::string* p
return true;
}
+// Accepts a device mapper device name (like system_a, vendor_b etc) and
+// returns its UUID.
+bool DeviceMapper::GetDmDeviceUuidByName(const std::string& name, std::string* uuid) {
+ struct dm_ioctl io;
+ InitIo(&io, name);
+ if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) {
+ PLOG(WARNING) << "DM_DEV_STATUS failed for " << name;
+ return false;
+ }
+
+ *uuid = std::string(io.uuid);
+ return true;
+}
+
bool DeviceMapper::GetDeviceNumber(const std::string& name, dev_t* dev) {
struct dm_ioctl io;
InitIo(&io, name);