From 56f9ada93d83dcd66322635138e334e25bb5e1bd Mon Sep 17 00:00:00 2001 From: Sandeep Patil Date: Tue, 14 Feb 2017 14:00:14 -0800 Subject: [PATCH] fs_mgr: add fs_mgr_do_mount_one() API This is to be used in early mount case where we will have a fully prepared fstab_rec. fs_mgr_do_mount() does a lot more checks and spends time preparing verity / avb devices before it does the actual mount. b/33254008 Test: Boot sailfish Change-Id: I4481b5af8d900c8b7e3355b7513c325d8f2ecff2 Signed-off-by: Sandeep Patil --- fs_mgr/fs_mgr.cpp | 18 ++++++++++++++++++ fs_mgr/include/fs_mgr.h | 1 + 2 files changed, 19 insertions(+) diff --git a/fs_mgr/fs_mgr.cpp b/fs_mgr/fs_mgr.cpp index 176807801..cc607d3f9 100644 --- a/fs_mgr/fs_mgr.cpp +++ b/fs_mgr/fs_mgr.cpp @@ -880,6 +880,24 @@ int fs_mgr_mount_all(struct fstab *fstab, int mount_mode) } } +/* wrapper to __mount() and expects a fully prepared fstab_rec, + * unlike fs_mgr_do_mount which does more things with avb / verity + * etc. + */ +int fs_mgr_do_mount_one(struct fstab_rec *rec) +{ + if (!rec) { + return FS_MGR_DOMNT_FAILED; + } + + int ret = __mount(rec->blk_device, rec->mount_point, rec); + if (ret) { + ret = (errno == EBUSY) ? FS_MGR_DOMNT_BUSY : FS_MGR_DOMNT_FAILED; + } + + 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 diff --git a/fs_mgr/include/fs_mgr.h b/fs_mgr/include/fs_mgr.h index a9deed948..d6d94896e 100644 --- a/fs_mgr/include/fs_mgr.h +++ b/fs_mgr/include/fs_mgr.h @@ -103,6 +103,7 @@ int fs_mgr_mount_all(struct fstab *fstab, int mount_mode); int fs_mgr_do_mount(struct fstab *fstab, const char *n_name, char *n_blk_device, char *tmp_mount_point); +int fs_mgr_do_mount_one(struct fstab_rec *rec); int fs_mgr_do_tmpfs_mount(char *n_name); int fs_mgr_unmount_all(struct fstab *fstab); int fs_mgr_get_crypt_info(struct fstab *fstab, char *key_loc,