summaryrefslogtreecommitdiff
path: root/sdcard
diff options
context:
space:
mode:
authorDaniel Rosenberg <drosen@google.com>2016-11-30 00:22:25 +0000
committerDaniel Rosenberg <drosen@google.com>2016-11-30 00:22:25 +0000
commit1acb5086dc34190926e7cba31d819cf1f48c5211 (patch)
treefb79f471cd22b66db8e051748de4e3d9543884ba /sdcard
parent912c27f63cb069ca0c21f9b9f6f7f89f547575f8 (diff)
downloadcore-1acb5086dc34190926e7cba31d819cf1f48c5211.tar.gz
Revert "Switch sdcardfs over to bind mounts."
This reverts commit 912c27f63cb069ca0c21f9b9f6f7f89f547575f8. Change-Id: Id5c5b03518fb24ddf832e8a3a88679c2727ae4de
Diffstat (limited to 'sdcard')
-rw-r--r--sdcard/sdcard.cpp30
1 files changed, 5 insertions, 25 deletions
diff --git a/sdcard/sdcard.cpp b/sdcard/sdcard.cpp
index e1909117d..70bbf2641 100644
--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -329,27 +329,6 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de
return true;
}
-static bool sdcardfs_setup_bind_remount(const std::string& source_path, const std::string& dest_path,
- gid_t gid, mode_t mask) {
- std::string opts = android::base::StringPrintf("mask=%d,gid=%d", mask, gid);
-
- if (mount(source_path.c_str(), dest_path.c_str(), nullptr,
- MS_BIND , nullptr) != 0) {
- PLOG(ERROR) << "failed to bind mount sdcardfs filesystem";
- return false;
- }
-
- if (mount(source_path.c_str(), dest_path.c_str(), "none",
- MS_REMOUNT, opts.c_str()) != 0) {
- PLOG(ERROR) << "failed to mount sdcardfs filesystem";
- if (umount2(dest_path.c_str(), MNT_DETACH))
- LOG(WARNING) << "Failed to unmount bind";
- return false;
- }
-
- return true;
-}
-
static void run_sdcardfs(const std::string& source_path, const std::string& label, uid_t uid,
gid_t gid, userid_t userid, bool multi_user, bool full_write) {
std::string dest_path_default = "/mnt/runtime/default/" + label;
@@ -362,8 +341,9 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
// permissions are completely masked off.
if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
AID_SDCARD_RW, 0006)
- || !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY, 0027)
- || !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write,
+ || !sdcardfs_setup(source_path, dest_path_read, uid, gid, multi_user, userid,
+ AID_EVERYBODY, 0027)
+ || !sdcardfs_setup(source_path, dest_path_write, uid, gid, multi_user, userid,
AID_EVERYBODY, full_write ? 0007 : 0027)) {
LOG(FATAL) << "failed to sdcardfs_setup";
}
@@ -373,9 +353,9 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
// deep inside attr_from_stat().
if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
AID_SDCARD_RW, 0006)
- || !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read,
+ || !sdcardfs_setup(source_path, dest_path_read, uid, gid, multi_user, userid,
AID_EVERYBODY, full_write ? 0027 : 0022)
- || !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write,
+ || !sdcardfs_setup(source_path, dest_path_write, uid, gid, multi_user, userid,
AID_EVERYBODY, full_write ? 0007 : 0022)) {
LOG(FATAL) << "failed to sdcardfs_setup";
}