• 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 #define LOG_TAG "UdmfCopyFileMock"
17 #include "copy/file_copy_manager.h"
18 
19 #include <cstring>
20 #include <dirent.h>
21 #include <fcntl.h>
22 #include <filesystem>
23 #include <limits>
24 #include <memory>
25 #include <sys/stat.h>
26 #include <sys/types.h>
27 #include <unistd.h>
28 
29 #include "logger.h"
30 
31 namespace OHOS {
32 namespace Storage {
33 namespace DistributedFile {
34 std::shared_ptr<FileCopyManager> FileCopyManager::instance_ = nullptr;
35 
GetInstance()36 std::shared_ptr<FileCopyManager> FileCopyManager::GetInstance()
37 {
38     static auto instance = std::make_shared<FileCopyManager>();
39     return instance;
40 }
41 
Copy(const std::string & srcUri,const std::string & destUri,ProcessCallback & processCallback)42 int32_t FileCopyManager::Copy(const std::string &srcUri, const std::string &destUri, ProcessCallback &processCallback)
43 {
44     return 0;
45 }
46 
ExecRemote(std::shared_ptr<FileInfos> infos,ProcessCallback & processCallback)47 int32_t FileCopyManager::ExecRemote(std::shared_ptr<FileInfos> infos, ProcessCallback &processCallback)
48 {
49     return 0;
50 }
51 
Cancel(const bool isKeepFiles)52 int32_t FileCopyManager::Cancel(const bool isKeepFiles)
53 {
54     return 0;
55 }
56 
Cancel(const std::string & srcUri,const std::string & destUri,const bool isKeepFiles)57 int32_t FileCopyManager::Cancel(const std::string &srcUri, const std::string &destUri, const bool isKeepFiles)
58 {
59     return 0;
60 }
61 
DeleteResFile(std::shared_ptr<FileInfos> infos)62 void FileCopyManager::DeleteResFile(std::shared_ptr<FileInfos> infos)
63 {
64 }
65 
ExecLocal(std::shared_ptr<FileInfos> infos)66 int32_t FileCopyManager::ExecLocal(std::shared_ptr<FileInfos> infos)
67 {
68     return 0;
69 }
70 
CopyFile(const std::string & src,const std::string & dest,std::shared_ptr<FileInfos> infos)71 int32_t FileCopyManager::CopyFile(const std::string &src, const std::string &dest, std::shared_ptr<FileInfos> infos)
72 {
73     return 0;
74 }
75 
fs_req_cleanup(uv_fs_t * req)76 void fs_req_cleanup(uv_fs_t* req)
77 {
78 }
79 
SendFileCore(std::shared_ptr<FDGuard> srcFdg,std::shared_ptr<FDGuard> destFdg,std::shared_ptr<FileInfos> infos)80 int32_t FileCopyManager::SendFileCore(std::shared_ptr<FDGuard> srcFdg,
81     std::shared_ptr<FDGuard> destFdg, std::shared_ptr<FileInfos> infos)
82 {
83     return 0;
84 }
85 
CopyDirFunc(const std::string & src,const std::string & dest,std::shared_ptr<FileInfos> infos)86 int32_t FileCopyManager::CopyDirFunc(const std::string &src, const std::string &dest, std::shared_ptr<FileInfos> infos)
87 {
88     return 0;
89 }
90 
CopySubDir(const std::string & srcPath,const std::string & destPath,std::shared_ptr<FileInfos> infos)91 int32_t FileCopyManager::CopySubDir(const std::string &srcPath,
92     const std::string &destPath, std::shared_ptr<FileInfos> infos)
93 {
94     return 0;
95 }
96 
RecurCopyDir(const std::string & srcPath,const std::string & destPath,std::shared_ptr<FileInfos> infos)97 int32_t FileCopyManager::RecurCopyDir(const std::string &srcPath,
98     const std::string &destPath, std::shared_ptr<FileInfos> infos)
99 {
100     return 0;
101 }
102 
AddFileInfos(std::shared_ptr<FileInfos> infos)103 void FileCopyManager::AddFileInfos(std::shared_ptr<FileInfos> infos)
104 {
105 }
106 
RemoveFileInfos(std::shared_ptr<FileInfos> infos)107 void FileCopyManager::RemoveFileInfos(std::shared_ptr<FileInfos> infos)
108 {
109 }
110 
CreateFileInfos(const std::string & srcUri,const std::string & destUri,std::shared_ptr<FileInfos> & infos)111 int32_t FileCopyManager::CreateFileInfos(const std::string &srcUri,
112     const std::string &destUri, std::shared_ptr<FileInfos> &infos)
113 {
114     return 0;
115 }
116 
GetModeFromFlags(unsigned int flags)117 std::string GetModeFromFlags(unsigned int flags)
118 {
119     return 0;
120 }
121 
OpenSrcFile(const std::string & srcPth,std::shared_ptr<FileInfos> infos,int32_t & srcFd)122 int32_t FileCopyManager::OpenSrcFile(const std::string &srcPth, std::shared_ptr<FileInfos> infos, int32_t &srcFd)
123 {
124     return 0;
125 }
126 
MakeDir(const std::string & path)127 int FileCopyManager::MakeDir(const std::string &path)
128 {
129     return 0;
130 }
131 
IsRemoteUri(const std::string & uri)132 bool FileCopyManager::IsRemoteUri(const std::string &uri)
133 {
134     return true;
135 }
136 
IsMediaUri(const std::string & uriPath)137 bool FileCopyManager::IsMediaUri(const std::string &uriPath)
138 {
139     return true;
140 }
141 
CheckOrCreatePath(const std::string & destPath)142 int32_t FileCopyManager::CheckOrCreatePath(const std::string &destPath)
143 {
144     return 0;
145 }
146 } // namespace DistributedFile
147 } // namespace Storage
148 } // namespace OHOS