1 /*
2  * Copyright (c) 2023 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_FUSE_OPERATIONS_H
16 #define CLOUD_FILE_DAEMON_FUSE_OPERATIONS_H
17 
18 #include "file_operations_base.h"
19 
20 namespace OHOS {
21 namespace FileManagement {
22 namespace CloudDisk {
23 class FuseOperations final {
24 public:
25     static void Lookup(fuse_req_t req, fuse_ino_t parent, const char *name);
26     static void Access(fuse_req_t req, fuse_ino_t ino, int mask);
27     static void GetAttr(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
28     static void Open(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
29     static void Forget(fuse_req_t req, fuse_ino_t ino, uint64_t nLookup);
30     static void ForgetMulti(fuse_req_t req, size_t count, struct fuse_forget_data *forgets);
31     static void MkDir(fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode);
32     static void RmDir(fuse_req_t req, fuse_ino_t parent, const char *name);
33     static void Unlink(fuse_req_t req, fuse_ino_t parent, const char *name);
34     static void Release(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
35     static void MkNod(fuse_req_t req, fuse_ino_t parent, const char *name,
36                       mode_t mode, dev_t rdev);
37     static void Create(fuse_req_t req, fuse_ino_t parent, const char *name,
38                        mode_t mode, struct fuse_file_info *fi);
39     static void ReadDir(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off,
40                         struct fuse_file_info *fi);
41     static void SetXattr(fuse_req_t req, fuse_ino_t ino, const char *name,
42                          const char *value, size_t size, int flags);
43     static void GetXattr(fuse_req_t req, fuse_ino_t ino, const char *name,
44                          size_t size);
45     static void Rename(fuse_req_t req, fuse_ino_t parent, const char *name,
46                        fuse_ino_t newParent, const char *newName, unsigned int flags);
47     static void Read(fuse_req_t req, fuse_ino_t ino, size_t size,
48                      off_t offset, struct fuse_file_info *fi);
49     static void WriteBuf(fuse_req_t req, fuse_ino_t ino, struct fuse_bufvec *bufv,
50                          off_t off, struct fuse_file_info *fi);
51     static void SetAttr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
52                         int valid, struct fuse_file_info *fi);
53     static void Lseek(fuse_req_t req, fuse_ino_t ino, off_t off, int whence,
54                       struct fuse_file_info *fi);
55 };
56 } // CloudDisk
57 } // FileManagement
58 } // OHOS
59 #endif // CLOUD_FILE_DAEMON_FUSE_OPERATIONS_H
60