diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 9f52fdf72..92c6ee8c0 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -788,47 +788,21 @@ int fs_mgr_add_entry(struct fstab *fstab, } /* - * Returns the 1st matching fstab_rec that follows the start_rec. - * start_rec is the result of a previous search or NULL. + * Returns the fstab_rec* whose mount_point is path. + * Returns nullptr if not found. */ -struct fstab_rec* fs_mgr_get_entry_for_mount_point_after(struct fstab_rec* start_rec, - struct fstab* fstab, - const std::string& path) { - int i; +struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path) { if (!fstab) { return nullptr; } - - if (start_rec) { - for (i = 0; i < fstab->num_entries; i++) { - if (&fstab->recs[i] == start_rec) { - i++; - break; - } - } - } else { - i = 0; - } - - for (; i < fstab->num_entries; i++) { + for (int i = 0; i < fstab->num_entries; i++) { if (fstab->recs[i].mount_point && path == fstab->recs[i].mount_point) { return &fstab->recs[i]; } } - return nullptr; } -/* - * Returns the 1st matching mount point. - * There might be more. To look for others, use fs_mgr_get_entry_for_mount_point_after() - * and give the fstab_rec from the previous search. - */ -struct fstab_rec *fs_mgr_get_entry_for_mount_point(struct fstab *fstab, const char *path) -{ - return fs_mgr_get_entry_for_mount_point_after(NULL, fstab, path); -} - int fs_mgr_is_voldmanaged(const struct fstab_rec *fstab) { return fstab->fs_mgr_flags & MF_VOLDMANAGED; diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h index 15c8cafe6..0a8496baa 100644 --- a/fs_mgr/include_fstab/fstab/fstab.h +++ b/fs_mgr/include_fstab/fstab/fstab.h @@ -71,7 +71,6 @@ void fs_mgr_free_fstab(struct fstab* fstab); int fs_mgr_add_entry(struct fstab* fstab, const char* mount_point, const char* fs_type, const char* blk_device); -struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path); int fs_mgr_is_voldmanaged(const struct fstab_rec* fstab); int fs_mgr_is_nonremovable(const struct fstab_rec* fstab); int fs_mgr_is_verified(const struct fstab_rec* fstab); @@ -96,6 +95,7 @@ __END_DECLS // TODO: move this into separate header files under include/fs_mgr/*.h #ifdef __cplusplus std::string fs_mgr_get_slot_suffix(); +struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path); #endif #endif /* __CORE_FS_TAB_H */