• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 
16 #include <file_mount_manager.h>
17 #include <distributed_file_daemon_proxy.h>
18 #include "dfs_error.h"
19 #include "ipc_skeleton.h"
20 #include "utils_log.h"
21 
22 #undef LOG_DOMAIN
23 #undef LOG_TAG
24 #define LOG_DOMAIN 0xD004315
25 #define LOG_TAG "distributedfile_daemon"
26 
27 namespace OHOS {
28 namespace Storage {
29 namespace DistributedFile {
30 std::shared_ptr<FileMountManager> FileMountManager::instance_ = nullptr;
31 
GetInstance()32 std::shared_ptr<FileMountManager> FileMountManager::GetInstance()
33 {
34     static std::once_flag once;
35     std::call_once(once, []() {
36         FileMountManager::instance_ = std::make_shared<FileMountManager>();
37     });
38 
39     return instance_;
40 }
41 
GetDfsUrisDirFromLocal(const std::vector<std::string> & uriList,const int32_t userId,std::unordered_map<std::string,AppFileService::ModuleRemoteFileShare::HmdfsUriInfo> & uriToDfsUriMaps)42 int32_t FileMountManager::GetDfsUrisDirFromLocal(const std::vector<std::string> &uriList,
43                                                  const int32_t userId,
44                                                  std::unordered_map<std::string,
45                                                  AppFileService::ModuleRemoteFileShare::HmdfsUriInfo> &uriToDfsUriMaps)
46 {
47     auto distributedFileDaemonProxy = DistributedFileDaemonProxy::GetInstance();
48     if (!distributedFileDaemonProxy) {
49         LOGE("proxy is null");
50         return OHOS::FileManagement::E_SA_LOAD_FAILED;
51     }
52     return distributedFileDaemonProxy->GetDfsUrisDirFromLocal(uriList, userId, uriToDfsUriMaps);
53 }
54 
55 }
56 }
57 }