fedir
e48cbc62f1
Now source files handling is delegated to functions defined in `sourcefs.c` file. By encapsulating methods for managing the underlying source files structure we ensure that all code changes to the source file protection strategy will be localized to `sourcefs.c` file. Also changed Makefile to use more sane way of handling options and build flags.
39 lines
847 B
C
39 lines
847 B
C
#include <stdlib.h>
|
|
#define FUSE_USE_VERSION 31
|
|
|
|
#include "sourcefs.h"
|
|
#include <fuse3/fuse.h>
|
|
|
|
const char *mountpoint;
|
|
|
|
/*
|
|
* #In this function we need to:
|
|
*
|
|
* * Open the folder we are mounting over (and remember it).
|
|
* * Initialize the process table.
|
|
*/
|
|
static void *icfs_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
|
|
(void)conn; /* Explicit way to tell we ignore these arguments. */
|
|
(void)cfg; /* This also silences the compiler warnings. */
|
|
|
|
source_init(mountpoint);
|
|
return NULL;
|
|
}
|
|
|
|
static const struct fuse_operations icfs_oper = {
|
|
.init = icfs_init,
|
|
};
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
int ret;
|
|
|
|
// FUSE won't tell us the mountpoint on it's own, so we need to extract it
|
|
// ourselves.
|
|
mountpoint = realpath(argv[argc - 2], NULL);
|
|
|
|
ret = fuse_main(argc, argv, &icfs_oper, NULL);
|
|
|
|
return ret;
|
|
}
|