1 /*
2  * Copyright (C) 2021 Jakub Kruszona-Zawadzki, Core Technology Sp. z o.o.
3  *
4  * This file is part of MooseFS.
5  *
6  * MooseFS is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, version 2 (only).
9  *
10  * MooseFS is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with MooseFS; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA
18  * or visit http://www.gnu.org/licenses/gpl-2.0.html
19  */
20 
21 #ifndef _MFS_FUSE_H_
22 #define _MFS_FUSE_H_
23 
24 #include "fusecommon.h"
25 
26 // int mfs_rootnode_setup(char *path);
27 
28 #if FUSE_USE_VERSION >= 26
29 void mfs_statfs (fuse_req_t req, fuse_ino_t ino);
30 #else
31 void mfs_statfs (fuse_req_t req);
32 #endif
33 void mfs_access (fuse_req_t req, fuse_ino_t ino, int mask);
34 void mfs_lookup (fuse_req_t req, fuse_ino_t parent, const char *name);
35 void mfs_forget (fuse_req_t req, fuse_ino_t ino, unsigned long nlookup);
36 #if FUSE_VERSION >= 29
37 void mfs_forget_multi(fuse_req_t req, size_t count, struct fuse_forget_data *forgets);
38 #endif
39 void mfs_getattr (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
40 void mfs_setattr (fuse_req_t req, fuse_ino_t ino, struct stat *stbuf, int to_set, struct fuse_file_info *fi);
41 void mfs_mknod (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, dev_t rdev);
42 void mfs_unlink (fuse_req_t req, fuse_ino_t parent, const char *name);
43 void mfs_mkdir (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode);
44 void mfs_rmdir (fuse_req_t req, fuse_ino_t parent, const char *name);
45 void mfs_symlink (fuse_req_t req, const char *path, fuse_ino_t parent, const char *name);
46 void mfs_readlink (fuse_req_t req, fuse_ino_t ino);
47 #if FUSE_VERSION >= 30
48 void mfs_rename (fuse_req_t req, fuse_ino_t parent, const char *name, fuse_ino_t newparent, const char *newname,unsigned int flags);
49 #else
50 void mfs_rename (fuse_req_t req, fuse_ino_t parent, const char *name, fuse_ino_t newparent, const char *newname);
51 #endif
52 void mfs_link (fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent, const char *newname);
53 void mfs_opendir (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
54 void mfs_readdir (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi);
55 void mfs_releasedir (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
56 void mfs_create (fuse_req_t req, fuse_ino_t parent, const char *name, mode_t mode, struct fuse_file_info *fi);
57 void mfs_open (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
58 void mfs_release (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
59 void mfs_read (fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi);
60 void mfs_write (fuse_req_t req, fuse_ino_t ino, const char *buf, size_t size, off_t off, struct fuse_file_info *fi);
61 void mfs_flush (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi);
62 void mfs_fsync (fuse_req_t req, fuse_ino_t ino, int datasync, struct fuse_file_info *fi);
63 #if defined(__APPLE__)
64 void mfs_setxattr (fuse_req_t req, fuse_ino_t ino, const char *name, const char *value, size_t size, int flags, uint32_t position);
65 void mfs_getxattr (fuse_req_t req, fuse_ino_t ino, const char *name, size_t size, uint32_t position);
66 #else
67 void mfs_setxattr (fuse_req_t req, fuse_ino_t ino, const char *name, const char *value, size_t size, int flags);
68 void mfs_getxattr (fuse_req_t req, fuse_ino_t ino, const char *name, size_t size);
69 #endif /* __APPLE__ */
70 void mfs_listxattr (fuse_req_t req, fuse_ino_t ino, size_t size);
71 void mfs_removexattr (fuse_req_t req, fuse_ino_t ino, const char *name);
72 #if FUSE_VERSION >= 26
73 void mfs_getlk (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock);
74 void mfs_setlk (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock, int sl);
75 #endif
76 #if FUSE_VERSION >= 29
77 void mfs_flock (fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, int op);
78 #endif
79 #if FUSE_VERSION >= 30
80 void mfs_readdirplus(fuse_req_t req, fuse_ino_t ino, size_t size, off_t off, struct fuse_file_info *fi);
81 #endif
82 
83 void mfs_dentry_invalidate(uint32_t parent,uint8_t nleng,const char *name);
84 void mfs_inode_clear_cache(uint32_t inode,uint64_t offset,uint64_t leng);
85 void mfs_inode_change_fleng(uint32_t inode,uint64_t fleng);
86 
87 #if defined(__FreeBSD__)
88 void mfs_freebsd_workarounds(int on);
89 #endif
90 
91 void mfs_setdisables(uint32_t disables);
92 
93 void mfs_term(void);
94 void mfs_init (int debug_mode_in,int keep_cache_in,double direntry_cache_timeout_in,double entry_cache_timeout_in,double attr_cache_timeout_in,double xattr_cache_timeout_in,double groups_cache_timeout,int mkdir_copy_sgid_in,int sugid_clear_mode_in,int xattr_acl_support_in,double fsync_before_close_min_time_in,int no_xattrs_in,int no_posix_locks_in,int no_bsd_locks_in);
95 
96 #ifdef HAVE_FUSE3
97 void mfs_setsession(struct fuse_session *se);
98 #else /* FUSE2 */
99 void mfs_setchan(struct fuse_chan *ch);
100 #endif
101 
102 #endif
103