xref: /haiku/src/add-ons/kernel/file_systems/userlandfs/server/fuse/FUSELowLevel.h (revision 44cceee67e056d8e34cb017d5f5c07b9fac874c0)
1 /*
2  * Copyright 2022, Adrien Destugues <pulkomandy@pulkomandy.tk>
3  * Distributed under terms of the MIT license.
4  */
5 
6 #ifndef FUSELOWLEVEL_H
7 #define FUSELOWLEVEL_H
8 
9 #include <semaphore.h>
10 #include <stdlib.h>
11 
12 #include "fuse_api.h"
13 
14 
15 typedef	int	(*ReadDirBufferFiller) (void* buffer, char* buf, size_t bufsize, const char* name,
16 	const struct stat* st, off_t offset);
17 
18 void fuse_ll_init(const fuse_lowlevel_ops* ops, void* userdata, struct fuse_conn_info* conn);
19 void fuse_ll_destroy(const fuse_lowlevel_ops* ops, void *userdata);
20 int fuse_ll_lookup(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
21 	struct stat* st);
22 int fuse_ll_getattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct stat* st);
23 int fuse_ll_setattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, const struct stat *attr,
24 	int to_set);
25 int fuse_ll_readlink(const fuse_lowlevel_ops* ops, fuse_ino_t ino, char* buffer, size_t size);
26 int fuse_ll_mkdir(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
27 	mode_t mode);
28 int fuse_ll_unlink(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name);
29 int fuse_ll_rmdir(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name);
30 int fuse_ll_symlink(const fuse_lowlevel_ops* ops, const char* link, fuse_ino_t parent,
31 	const char* name);
32 int fuse_ll_rename(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
33 	fuse_ino_t newparent, const char *newname);
34 int fuse_ll_link(const fuse_lowlevel_ops* ops, fuse_ino_t ino, fuse_ino_t newparent,
35 	const char *newname);
36 int fuse_ll_open(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
37 int fuse_ll_read(const fuse_lowlevel_ops* ops, fuse_ino_t ino, char* buffer, size_t bufferSize,
38 	off_t position, fuse_file_info* ffi);
39 int fuse_ll_write(const fuse_lowlevel_ops* ops, fuse_ino_t ino, const char *buf,
40 	size_t size, off_t off, struct fuse_file_info *fi);
41 int fuse_ll_flush(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
42 int fuse_ll_release(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
43 int fuse_ll_fsync(const fuse_lowlevel_ops* ops, fuse_ino_t ino, int datasync,
44 	struct fuse_file_info *fi);
45 int fuse_ll_opendir(const fuse_lowlevel_ops* ops, fuse_ino_t inode, struct fuse_file_info* ffi);
46 int fuse_ll_readdir(const fuse_lowlevel_ops* ops, fuse_ino_t ino, void* cookie,
47 	char* buffer, size_t bufferSize, ReadDirBufferFiller filler, off_t pos, fuse_file_info* ffi);
48 int fuse_ll_releasedir(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
49 int fuse_ll_statfs(const fuse_lowlevel_ops* ops, fuse_ino_t inode, struct statvfs* stat);
50 int fuse_ll_getxattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, const char *name,
51 	char* buffer, size_t size);
52 int fuse_ll_listxattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, char* buffer, size_t size);
53 int fuse_ll_access(const fuse_lowlevel_ops* ops, fuse_ino_t ino, int mask);
54 int fuse_ll_create(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
55 	mode_t mode, struct fuse_file_info *fi, fuse_ino_t& ino);
56 
57 
58 
59 #endif /* !FUSELOWLEVEL_H */
60