fs_mgr_fstab: removing fs_mgr_get_entry_for_mount_point_after()
No fs_mgr client is using fs_mgr_get_entry_for_mount_point_after(), which supports matching a mount point iteratively by specifying a starting entry in the fstab. So removes it. Also switch the public API from C/C++ to C++-only: fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path); ==> fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path); Bug: 67024518 Test: boot sailfish, manually test fs_mgr_get_entry_for_mount_point(). Change-Id: I38e18fa6bd9485b6cd31b55474406a511df3f506
This commit is contained in:
parent
61578ab50b
commit
c55f188207
|
@ -779,47 +779,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;
|
||||
|
|
|
@ -70,7 +70,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);
|
||||
|
@ -95,6 +94,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 */
|
||||
|
|
Loading…
Reference in New Issue