Always symlink self/primary to /storage/emulated

This allows readlink(2) of /sdcard paths to work correctly
and return /storage/emulated/<userid> instead of
/mnt/user/<userid>/emulated/<userid>

Test: readlink /sdcard -> /storage/emulated/0
Bug: 135341433
Change-Id: I2cfa9cede02a93024e41d90f17c926a69ec6e052
This commit is contained in:
Zim 2020-01-17 01:21:24 +00:00 committed by Zimuzo Ezeozue
parent d0c7c52edc
commit 53d16d39dd

View file

@ -1056,7 +1056,7 @@ status_t MountUserFuse(userid_t user_id, const std::string& absolute_lower_path,
return -1;
}
linkpath += "/primary";
Symlink(fuse_path + "/" + std::to_string(user_id), linkpath);
Symlink("/storage/emulated/" + std::to_string(user_id), linkpath);
std::string pass_through_linkpath(StringPrintf("/mnt/pass_through/%d/self", user_id));
result = PrepareDir(pass_through_linkpath, 0755, AID_ROOT, AID_ROOT);
@ -1065,7 +1065,7 @@ status_t MountUserFuse(userid_t user_id, const std::string& absolute_lower_path,
return -1;
}
pass_through_linkpath += "/primary";
Symlink(pass_through_path + "/" + std::to_string(user_id), pass_through_linkpath);
Symlink("/storage/emulated/" + std::to_string(user_id), pass_through_linkpath);
}
// Open fuse fd.