Merge "Remove dead code from fs_mgr"

This commit is contained in:
Treehugger Robot 2023-06-23 20:07:09 +00:00 committed by Gerrit Code Review
commit 8790a71bc4
2 changed files with 6 additions and 47 deletions

View file

@ -1849,18 +1849,14 @@ int fs_mgr_do_mount_one(const FstabEntry& entry, const std::string& alt_mount_po
return ret;
}
// If tmp_mount_point is non-null, mount the filesystem there. This is for the
// tmp mount we do to check the user password
// If multiple fstab entries are to be mounted on "n_name", it will try to mount each one
// in turn, and stop on 1st success, or no more match.
static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
const std::string& n_blk_device, const char* tmp_mount_point,
int needs_checkpoint, bool metadata_encrypted,
bool needs_encrypt) {
int fs_mgr_do_mount(Fstab* fstab, const std::string& n_name, const std::string& n_blk_device,
int needs_checkpoint, bool needs_encrypt) {
int mount_errors = 0;
int first_mount_errno = 0;
std::string mount_point;
CheckpointManager checkpoint_manager(needs_checkpoint, metadata_encrypted, needs_encrypt);
CheckpointManager checkpoint_manager(needs_checkpoint, true, needs_encrypt);
AvbUniquePtr avb_handle(nullptr);
if (!fstab) {
@ -1902,11 +1898,7 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
}
// Now mount it where requested */
if (tmp_mount_point) {
mount_point = tmp_mount_point;
} else {
mount_point = fstab_entry.mount_point;
}
mount_point = fstab_entry.mount_point;
int fs_stat = prepare_fs_for_mount(n_blk_device, fstab_entry, mount_point);
@ -1963,35 +1955,6 @@ static int fs_mgr_do_mount_helper(Fstab* fstab, const std::string& n_name,
return FS_MGR_DOMNT_FAILED;
}
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point) {
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, -1, false, false);
}
int fs_mgr_do_mount(Fstab* fstab, const char* n_name, char* n_blk_device, char* tmp_mount_point,
bool needs_checkpoint, bool metadata_encrypted, bool needs_encrypt) {
return fs_mgr_do_mount_helper(fstab, n_name, n_blk_device, tmp_mount_point, needs_checkpoint,
metadata_encrypted, needs_encrypt);
}
/*
* mount a tmpfs filesystem at the given point.
* return 0 on success, non-zero on failure.
*/
int fs_mgr_do_tmpfs_mount(const char *n_name)
{
int ret;
ret = mount("tmpfs", n_name, "tmpfs", MS_NOATIME | MS_NOSUID | MS_NODEV | MS_NOEXEC,
CRYPTO_TMPFS_OPTIONS);
if (ret < 0) {
LERROR << "Cannot mount tmpfs filesystem at " << n_name;
return -1;
}
/* Success */
return 0;
}
static bool ConfigureIoScheduler(const std::string& device_path) {
if (!StartsWith(device_path, "/dev/")) {
LERROR << __func__ << ": invalid argument " << device_path;

View file

@ -85,14 +85,10 @@ MountAllResult fs_mgr_mount_all(android::fs_mgr::Fstab* fstab, int mount_mode);
#define FS_MGR_DOMNT_FAILED (-1)
#define FS_MGR_DOMNT_BUSY (-2)
#define FS_MGR_DOMNT_SUCCESS 0
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
char* tmp_mount_point);
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const char* n_name, char* n_blk_device,
char* tmp_mount_point, bool need_cp, bool metadata_encrypted,
bool need_encrypted);
int fs_mgr_do_mount(android::fs_mgr::Fstab* fstab, const std::string& n_name,
const std::string& n_blk_device, int needs_checkpoint, bool needs_encrypt);
int fs_mgr_do_mount_one(const android::fs_mgr::FstabEntry& entry,
const std::string& mount_point = "");
int fs_mgr_do_tmpfs_mount(const char *n_name);
bool fs_mgr_load_verity_state(int* mode);
// Returns true if verity is enabled on this particular FstabEntry.
bool fs_mgr_is_verity_enabled(const android::fs_mgr::FstabEntry& entry);