Allow querying for fstab for a mount point with fstype
Test: th Bug: 293313353 Change-Id: I8e12c465d0a3e886fcfa0cebf546b145b785c220
This commit is contained in:
parent
6f7fb5a0b5
commit
6cdee65b8b
2 changed files with 11 additions and 0 deletions
|
@ -849,6 +849,14 @@ std::vector<FstabEntry*> GetEntriesForMountPoint(Fstab* fstab, const std::string
|
|||
[&path](const FstabEntry& entry) { return entry.mount_point == path; });
|
||||
}
|
||||
|
||||
FstabEntry* GetEntryForMountPoint(Fstab* fstab, const std::string_view path,
|
||||
const std::string_view fstype) {
|
||||
auto&& vec = GetEntriesByPred(fstab, [&path, fstype](const FstabEntry& entry) {
|
||||
return entry.mount_point == path && entry.fs_type == fstype;
|
||||
});
|
||||
return vec.empty() ? nullptr : vec.front();
|
||||
}
|
||||
|
||||
std::vector<const FstabEntry*> GetEntriesForMountPoint(const Fstab* fstab,
|
||||
const std::string& path) {
|
||||
return GetEntriesByPred(fstab,
|
||||
|
|
|
@ -108,6 +108,9 @@ std::vector<FstabEntry*> GetEntriesForMountPoint(Fstab* fstab, const std::string
|
|||
FstabEntry* GetEntryForMountPoint(Fstab* fstab, const std::string& path);
|
||||
const FstabEntry* GetEntryForMountPoint(const Fstab* fstab, const std::string& path);
|
||||
|
||||
FstabEntry* GetEntryForMountPoint(Fstab* fstab, const std::string_view path,
|
||||
const std::string_view fstype);
|
||||
|
||||
// This method builds DSU fstab entries and transfer the fstab.
|
||||
//
|
||||
// fstab points to the unmodified fstab.
|
||||
|
|
Loading…
Reference in a new issue