2024-11-20 09:28:20 +01:00
|
|
|
|
|
|
|
|
|
|
|
#ifndef SOURCEFS_H
|
|
|
|
#define SOURCEFS_H
|
|
|
|
|
2024-12-03 18:10:50 +01:00
|
|
|
#include <dirent.h>
|
2024-11-20 10:32:33 +01:00
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2024-11-20 09:28:20 +01:00
|
|
|
/**
|
|
|
|
* Initializes the source file handling.
|
|
|
|
*
|
|
|
|
* @param root_path The root of the source files folder.
|
2024-12-03 18:10:50 +01:00
|
|
|
* @return 0 on success, -1 on failure.
|
2024-11-20 09:28:20 +01:00
|
|
|
*/
|
|
|
|
int source_init(const char *root_path);
|
|
|
|
|
2024-12-15 15:41:28 +01:00
|
|
|
/* All of the functions below are designed to behave exactly as their non-source
|
|
|
|
* counterparts. */
|
|
|
|
|
|
|
|
int source_stat(const char *restrict filename, struct stat *restrict statbuf);
|
2024-11-20 10:32:33 +01:00
|
|
|
|
2024-12-03 18:10:50 +01:00
|
|
|
struct dirent *source_readdir(DIR *dirp);
|
|
|
|
|
|
|
|
DIR *source_opendir(const char *filename);
|
|
|
|
|
2024-12-15 15:41:28 +01:00
|
|
|
int source_unlink(const char *filename);
|
|
|
|
|
|
|
|
int source_mkdir(const char *filename, mode_t mode);
|
|
|
|
|
|
|
|
int source_rmdir(const char *filename);
|
|
|
|
|
|
|
|
int source_symlink(const char *target, const char *linkpath);
|
|
|
|
|
|
|
|
int source_rename(const char *oldpath, const char *newpath);
|
|
|
|
|
2024-12-17 10:11:59 +01:00
|
|
|
int source_link(const char *oldpath, const char *newpath);
|
|
|
|
|
|
|
|
int source_chmod(const char *filename, mode_t mode);
|
|
|
|
|
|
|
|
int source_chown(const char *filename, uid_t owner, gid_t group);
|
|
|
|
|
|
|
|
int source_truncate(const char *filename, off_t length);
|
|
|
|
|
|
|
|
/* `open` and `create` are designed to correspond to fuse operations, not the
|
|
|
|
* libc's `open(2)`. Both of them actually call `openat`. */
|
|
|
|
|
|
|
|
int source_open(const char *filename, int flags);
|
|
|
|
|
|
|
|
int source_create(const char *filename, int flags, mode_t mode);
|
|
|
|
|
2024-11-20 09:28:20 +01:00
|
|
|
#endif // !SOURCEFS_H
|