BuildDataUserCePath always use dir instead of symbolic link
Select whichever is real dir instead of symbolic link from either /data/data or /data/user/0. This is to minimize path walking overhead in kernel. This works together with Change 369787 Test: Manual test Change-Id: I338518673fc22ccbfed6ddd6be196931fce18525 Signed-off-by: cjbao <cathy.bao@intel.com>
This commit is contained in:
parent
4f6c1ee19f
commit
eb50114a83
1 changed files with 7 additions and 7 deletions
14
Utils.cpp
14
Utils.cpp
|
@ -608,15 +608,15 @@ std::string BuildDataMediaCePath(const char* volumeUuid, userid_t userId) {
|
||||||
std::string BuildDataUserCePath(const char* volumeUuid, userid_t userId) {
|
std::string BuildDataUserCePath(const char* volumeUuid, userid_t userId) {
|
||||||
// TODO: unify with installd path generation logic
|
// TODO: unify with installd path generation logic
|
||||||
std::string data(BuildDataPath(volumeUuid));
|
std::string data(BuildDataPath(volumeUuid));
|
||||||
if (volumeUuid == nullptr) {
|
if (volumeUuid == nullptr && userId == 0) {
|
||||||
if (userId == 0) {
|
std::string legacy = StringPrintf("%s/data", data.c_str());
|
||||||
return StringPrintf("%s/data", data.c_str());
|
struct stat sb;
|
||||||
} else {
|
if (lstat(legacy.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) {
|
||||||
return StringPrintf("%s/user/%u", data.c_str(), userId);
|
/* /data/data is dir, return /data/data for legacy system */
|
||||||
|
return legacy;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return StringPrintf("%s/user/%u", data.c_str(), userId);
|
|
||||||
}
|
}
|
||||||
|
return StringPrintf("%s/user/%u", data.c_str(), userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BuildDataUserDePath(const char* volumeUuid, userid_t userId) {
|
std::string BuildDataUserDePath(const char* volumeUuid, userid_t userId) {
|
||||||
|
|
Loading…
Reference in a new issue