diff options
-rw-r--r-- | fs_mgr/libdm/dm.cpp | 2 | ||||
-rw-r--r-- | fs_mgr/libdm/include/libdm/dm.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/fs_mgr/libdm/dm.cpp b/fs_mgr/libdm/dm.cpp index 9a518c696..e43c00b44 100644 --- a/fs_mgr/libdm/dm.cpp +++ b/fs_mgr/libdm/dm.cpp @@ -560,7 +560,7 @@ std::string DeviceMapper::GetTargetType(const struct dm_target_spec& spec) { return std::string{spec.target_type, sizeof(spec.target_type)}; } -static std::optional<std::string> ExtractBlockDeviceName(const std::string& path) { +std::optional<std::string> ExtractBlockDeviceName(const std::string& path) { static constexpr std::string_view kDevBlockPrefix("/dev/block/"); if (android::base::StartsWith(path, kDevBlockPrefix)) { return path.substr(kDevBlockPrefix.length()); diff --git a/fs_mgr/libdm/include/libdm/dm.h b/fs_mgr/libdm/include/libdm/dm.h index 70b14fa46..bdbbf9112 100644 --- a/fs_mgr/libdm/include/libdm/dm.h +++ b/fs_mgr/libdm/include/libdm/dm.h @@ -49,6 +49,10 @@ enum class DmDeviceState { INVALID, SUSPENDED, ACTIVE }; static constexpr uint64_t kSectorSize = 512; +// Returns `path` without /dev/block prefix if and only if `path` starts with +// that prefix. +std::optional<std::string> ExtractBlockDeviceName(const std::string& path); + class DeviceMapper final { public: class DmBlockDevice final { |