!2093 tmppath切换至cache目录下

Merge pull request !2093 from zhuhongtao666/master
This commit is contained in:
openharmony_ci 2024-09-29 02:21:43 +00:00 committed by Gitee
commit 27afc99be0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 6 deletions

View File

@ -237,9 +237,10 @@ static string GetLocalPath(int32_t userId, const string &relativePath)
return HMDFS_PATH_PREFIX + to_string(userId) + LOCAL_PATH_SUFFIX + relativePath;
}
static string GetLocalTmpPath(int32_t userId, const string &relativePath)
static string GetCacheTmpPath(int32_t userId, const string &relativePath)
{
return GetLocalPath(userId, relativePath) + PATH_TEMP_SUFFIX;
return HMDFS_PATH_PREFIX + to_string(userId) + LOCAL_PATH_SUFFIX + "/services/drivekit_cache/" +
relativePath + PATH_TEMP_SUFFIX;
}
static int HandleCloudError(CloudError error, FaultOperation faultOperation)
@ -562,7 +563,7 @@ static string GetAssetPath(shared_ptr<CloudInode> cInode, struct FuseData *data)
{
string path;
filesystem::path parentPath;
path = GetLocalTmpPath(data->userId, cInode->path);
path = GetCacheTmpPath(data->userId, cInode->path);
parentPath = filesystem::path(path).parent_path();
ForceCreateDirectory(parentPath.string());
LOGD("fileType: %d, create dir: %s, relative path: %s",
@ -583,7 +584,7 @@ static void fuse_inval(fuse_session *se, fuse_ino_t parentIno, fuse_ino_t childI
static int CloudOpenOnLocal(struct FuseData *data, shared_ptr<CloudInode> cInode, struct fuse_file_info *fi)
{
string localPath = GetLocalPath(data->userId, cInode->path);
string tmpPath = GetLocalTmpPath(data->userId, cInode->path);
string tmpPath = GetCacheTmpPath(data->userId, cInode->path);
char resolvedPath[PATH_MAX + 1] = {'\0'};
char *realPath = realpath(tmpPath.c_str(), resolvedPath);
if (realPath == nullptr) {

View File

@ -27,7 +27,7 @@
"name": "cloudfiledaemon",
"path": ["/system/bin/sa_main", "/system/profile/cloudfiledaemon.json"],
"uid": "1009",
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket"],
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket", "dfs_share"],
"sandbox": 0,
"secon": "u:r:cloudfiledaemon:s0",
"apl": "system_basic",
@ -45,7 +45,7 @@
"name": "cloudfileservice",
"path": ["/system/bin/sa_main", "/system/profile/cloudfileservice.json"],
"uid": "dfs",
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket"],
"gid": ["dfs", "user_data_rw", "system", "ddms", "netsys_socket", "dfs_share"],
"sandbox": 0,
"jobs" : {
"on-start" : "services:cloudfileservice"