• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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 #ifndef CLOUD_FILE_DAEMON_FILE_OPERATIONS_CLOUD_H
16 #define CLOUD_FILE_DAEMON_FILE_OPERATIONS_CLOUD_H
17 
18 #include "cloud_disk_inode.h"
19 #include "file_operations_base.h"
20 #include "meta_file.h"
21 
22 namespace OHOS {
23 namespace FileManagement {
24 namespace CloudDisk {
25 
26 struct CloudOpenParams {
27     MetaBase metaBase;
28     std::shared_ptr<CloudDiskMetaFile> metaFile;
29     std::shared_ptr<CloudDiskFile> filePtr;
30 };
31 
32 struct SessionCountParams {
33     std::string path;
34     std::string cloudId;
35     std::string assets;
36 };
37 
38 struct HandleOpenErrorParams {
39     std::shared_ptr<CloudDiskFile> filePtr;
40     std::shared_ptr<CloudDiskInode> inoPtr;
41     fuse_ino_t ino;
42 };
43 
44 class FileOperationsCloud final : public FileOperationsBase {
45 public:
46     void Lookup(fuse_req_t req, fuse_ino_t parent, const char *name) override;
47     void Access(fuse_req_t req, fuse_ino_t ino, int mask) override;
48     void GetAttr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) override;
49     void Open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) override;
50     void MkDir(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode) override;
51     void RmDir(fuse_req_t req, fuse_ino_t parent, const char *name) override;
52     void Unlink(fuse_req_t req, fuse_ino_t parent, const char *name) override;
53     void Release(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi) override;
54     void MkNod(fuse_req_t req, fuse_ino_t parent, const char *name,
55                mode_t mode, dev_t rdev) override;
56     void Create(fuse_req_t req, fuse_ino_t parent, const char *name,
57                 mode_t mode, struct fuse_file_info *fi) override;
58     void ReadDir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
59                  struct fuse_file_info *fi) override;
60     void SetXattr(fuse_req_t req, fuse_ino_t ino, const char *name,
61                   const char *value, size_t size, int flags) override;
62     void GetXattr(fuse_req_t req, fuse_ino_t ino, const char *name,
63                   size_t size) override;
64     void Rename(fuse_req_t req, fuse_ino_t parent, const char *name,
65                 fuse_ino_t newParent, const char *newName, unsigned int flags) override;
66     void Read(fuse_req_t req, fuse_ino_t ino, size_t size,
67               off_t offset, struct fuse_file_info *fi) override;
68     void WriteBuf(fuse_req_t req, fuse_ino_t ino, struct fuse_bufvec *bufv,
69                   off_t off, struct fuse_file_info *fi) override;
70     void SetAttr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
71                  int valid, struct fuse_file_info *fi) override;
72     void Lseek(fuse_req_t req, fuse_ino_t ino, off_t off, int whence,
73                struct fuse_file_info *fi) override;
74     void Ioctl(fuse_req_t req, fuse_ino_t ino, int cmd, void *arg, struct fuse_file_info *fi,
75                unsigned flags, const void *inBuf, size_t inBufsz, size_t outBufsz) override;
76 };
77 } // namespace CloudDisk
78 } // namespace FileManagement
79 } // namespace OHOS
80 #endif // CLOUD_FILE_DAEMON_FILE_OPERATIONS_CLOUD_H
81