• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


コミットメタ情報

リビジョンfb595ea798d0db035e851b8ae389dd774623d926 (tree)
日時2019-07-03 12:58:30
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

Revert "Add support for esdfs mounting"

This reverts commit c336f86284ee817a2e846452ad80e5d014d11414.

変更サマリ

差分

--- a/sdcard/sdcard.cpp
+++ b/sdcard/sdcard.cpp
@@ -43,44 +43,6 @@
4343
4444 #include <private/android_filesystem_config.h>
4545
46-#define PROP_SDCARDFS_DEVICE "ro.sys.sdcardfs"
47-#define PROP_SDCARDFS_USER "persist.sys.sdcardfs"
48-
49-static bool supports_esdfs(void) {
50- std::string filesystems;
51- if (!android::base::ReadFileToString("/proc/filesystems", &filesystems)) {
52- PLOG(ERROR) << "Could not read /proc/filesystems";
53- return false;
54- }
55- for (const auto& fs : android::base::Split(filesystems, "\n")) {
56- if (fs.find("esdfs") != std::string::npos) return true;
57- }
58- return false;
59-}
60-
61-static bool should_use_sdcardfs(void) {
62- char property[PROPERTY_VALUE_MAX];
63-
64- // Allow user to have a strong opinion about state
65- property_get(PROP_SDCARDFS_USER, property, "");
66- if (!strcmp(property, "force_on")) {
67- LOG(WARNING) << "User explicitly enabled sdcardfs";
68- return true;
69- } else if (!strcmp(property, "force_off")) {
70- LOG(WARNING) << "User explicitly disabled sdcardfs";
71- return !supports_esdfs();
72- }
73-
74- // Fall back to device opinion about state
75- if (property_get_bool(PROP_SDCARDFS_DEVICE, true)) {
76- LOG(WARNING) << "Device explicitly enabled sdcardfs";
77- return true;
78- } else {
79- LOG(WARNING) << "Device explicitly disabled sdcardfs";
80- return !supports_esdfs();
81- }
82-}
83-
8446 // NOTE: This is a vestigial program that simply exists to mount the in-kernel
8547 // sdcardfs filesystem. The older FUSE-based design that used to live here has
8648 // been completely removed to avoid confusion.
@@ -99,7 +61,7 @@ static void drop_privs(uid_t uid, gid_t gid) {
9961
10062 static bool sdcardfs_setup(const std::string& source_path, const std::string& dest_path,
10163 uid_t fsuid, gid_t fsgid, bool multi_user, userid_t userid, gid_t gid,
102- mode_t mask, bool derive_gid, bool default_normal, bool use_esdfs) {
64+ mode_t mask, bool derive_gid, bool default_normal) {
10365 // Try several attempts, each time with one less option, to gracefully
10466 // handle older kernels that aren't updated yet.
10567 for (int i = 0; i < 4; i++) {
@@ -110,7 +72,7 @@ static bool sdcardfs_setup(const std::string& source_path, const std::string& de
11072
11173 auto opts = android::base::StringPrintf("fsuid=%d,fsgid=%d,%smask=%d,userid=%d,gid=%d",
11274 fsuid, fsgid, new_opts.c_str(), mask, userid, gid);
113- if (mount(source_path.c_str(), dest_path.c_str(), use_esdfs ? "esdfs" : "sdcardfs",
75+ if (mount(source_path.c_str(), dest_path.c_str(), "sdcardfs",
11476 MS_NOSUID | MS_NODEV | MS_NOEXEC | MS_NOATIME, opts.c_str()) == -1) {
11577 PLOG(WARNING) << "Failed to mount sdcardfs with options " << opts;
11678 } else {
@@ -142,21 +104,9 @@ static bool sdcardfs_setup_bind_remount(const std::string& source_path, const st
142104 return true;
143105 }
144106
145-static bool sdcardfs_setup_secondary(const std::string& default_path, const std::string& source_path,
146- const std::string& dest_path, uid_t fsuid, gid_t fsgid,
147- bool multi_user, userid_t userid, gid_t gid, mode_t mask,
148- bool derive_gid, bool default_normal, bool use_esdfs) {
149- if (use_esdfs) {
150- return sdcardfs_setup(source_path, dest_path, fsuid, fsgid, multi_user, userid, gid, mask,
151- derive_gid, default_normal, use_esdfs);
152- } else {
153- return sdcardfs_setup_bind_remount(default_path, dest_path, gid, mask);
154- }
155-}
156-
157107 static void run_sdcardfs(const std::string& source_path, const std::string& label, uid_t uid,
158108 gid_t gid, userid_t userid, bool multi_user, bool full_write,
159- bool derive_gid, bool default_normal, bool use_esdfs) {
109+ bool derive_gid, bool default_normal) {
160110 std::string dest_path_default = "/mnt/runtime/default/" + label;
161111 std::string dest_path_read = "/mnt/runtime/read/" + label;
162112 std::string dest_path_write = "/mnt/runtime/write/" + label;
@@ -166,13 +116,10 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
166116 // Multi-user storage is fully isolated per user, so "other"
167117 // permissions are completely masked off.
168118 if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
169- AID_SDCARD_RW, 0006, derive_gid, default_normal, use_esdfs) ||
170- !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_read, uid, gid,
171- multi_user, userid, AID_EVERYBODY, 0027, derive_gid,
172- default_normal, use_esdfs) ||
173- !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_write, uid, gid,
174- multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0027,
175- derive_gid, default_normal, use_esdfs)) {
119+ AID_SDCARD_RW, 0006, derive_gid, default_normal) ||
120+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY, 0027) ||
121+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write, AID_EVERYBODY,
122+ full_write ? 0007 : 0027)) {
176123 LOG(FATAL) << "failed to sdcardfs_setup";
177124 }
178125 } else {
@@ -180,13 +127,11 @@ static void run_sdcardfs(const std::string& source_path, const std::string& labe
180127 // the Android directories are masked off to a single user
181128 // deep inside attr_from_stat().
182129 if (!sdcardfs_setup(source_path, dest_path_default, uid, gid, multi_user, userid,
183- AID_SDCARD_RW, 0006, derive_gid, default_normal, use_esdfs) ||
184- !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_read, uid, gid,
185- multi_user, userid, AID_EVERYBODY, full_write ? 0027 : 0022,
186- derive_gid, default_normal, use_esdfs) ||
187- !sdcardfs_setup_secondary(dest_path_default, source_path, dest_path_write, uid, gid,
188- multi_user, userid, AID_EVERYBODY, full_write ? 0007 : 0022,
189- derive_gid, default_normal, use_esdfs)) {
130+ AID_SDCARD_RW, 0006, derive_gid, default_normal) ||
131+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_read, AID_EVERYBODY,
132+ full_write ? 0027 : 0022) ||
133+ !sdcardfs_setup_bind_remount(dest_path_default, dest_path_write, AID_EVERYBODY,
134+ full_write ? 0007 : 0022)) {
190135 LOG(FATAL) << "failed to sdcardfs_setup";
191136 }
192137 }
@@ -297,6 +242,6 @@ int main(int argc, char **argv) {
297242 }
298243
299244 run_sdcardfs(source_path, label, uid, gid, userid, multi_user, full_write, derive_gid,
300- default_normal, !should_use_sdcardfs());
245+ default_normal);
301246 return 1;
302247 }