fedir
bfc22c79e0
Passthrough is usable now. There have been issues with the `access` operation: it's unclear what it must return, since the answer isn't known at the time when it is called. If it always returns "denied", many applications would finish without trying to open a file, thinking the access would not be granted after `access` call. Although always returning "permitted" seems like a better choice, it still might cause unexpected behaviour. Perhaps one way to solve this, is actually asking user whether to allow access. In any case, this issue needs to be looked into.
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
|
|
|
|
#ifndef SOURCEFS_H
|
|
#define SOURCEFS_H
|
|
|
|
#include <dirent.h>
|
|
#include <sys/stat.h>
|
|
|
|
/**
|
|
* Initializes the source file handling.
|
|
*
|
|
* @param root_path The root of the source files folder.
|
|
* @return 0 on success, -1 on failure.
|
|
*/
|
|
int source_init(const char *root_path);
|
|
|
|
/* 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);
|
|
|
|
struct dirent *source_readdir(DIR *dirp);
|
|
|
|
DIR *source_opendir(const char *filename);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
#endif // !SOURCEFS_H
|