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
15typedef	int	(*ReadDirBufferFiller) (void* buffer, char* buf, size_t bufsize, const char* name,
16	const struct stat* st, off_t offset);
17
18void fuse_ll_init(const fuse_lowlevel_ops* ops, void* userdata, struct fuse_conn_info* conn);
19void fuse_ll_destroy(const fuse_lowlevel_ops* ops, void *userdata);
20int fuse_ll_lookup(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
21	struct stat* st);
22int fuse_ll_getattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct stat* st);
23int fuse_ll_setattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, const struct stat *attr,
24	int to_set);
25int fuse_ll_readlink(const fuse_lowlevel_ops* ops, fuse_ino_t ino, char* buffer, size_t size);
26int fuse_ll_mkdir(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
27	mode_t mode);
28int fuse_ll_unlink(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name);
29int fuse_ll_rmdir(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name);
30int fuse_ll_symlink(const fuse_lowlevel_ops* ops, const char* link, fuse_ino_t parent,
31	const char* name);
32int fuse_ll_rename(const fuse_lowlevel_ops* ops, fuse_ino_t parent, const char *name,
33	fuse_ino_t newparent, const char *newname);
34int fuse_ll_link(const fuse_lowlevel_ops* ops, fuse_ino_t ino, fuse_ino_t newparent,
35	const char *newname);
36int fuse_ll_open(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
37int 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);
39int 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);
41int fuse_ll_flush(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
42int fuse_ll_release(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
43int fuse_ll_fsync(const fuse_lowlevel_ops* ops, fuse_ino_t ino, int datasync,
44	struct fuse_file_info *fi);
45int fuse_ll_opendir(const fuse_lowlevel_ops* ops, fuse_ino_t inode, struct fuse_file_info* ffi);
46int 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);
48int fuse_ll_releasedir(const fuse_lowlevel_ops* ops, fuse_ino_t ino, struct fuse_file_info *fi);
49int fuse_ll_statfs(const fuse_lowlevel_ops* ops, fuse_ino_t inode, struct statvfs* stat);
50int fuse_ll_getxattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, const char *name,
51	char* buffer, size_t size);
52int fuse_ll_listxattr(const fuse_lowlevel_ops* ops, fuse_ino_t ino, char* buffer, size_t size);
53int fuse_ll_access(const fuse_lowlevel_ops* ops, fuse_ino_t ino, int mask);
54int 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