/* FUSE: Filesystem in Userspace Copyright (C) 2001-2007 Miklos Szeredi Copyright (C) 2011 Sebastian Pipping ICFS: Interactively Controlled File System Copyright (C) 2024-2025 Fedir Kovalov This program can be distributed under the terms of the GNU GPLv2. See the file LICENSE. */ #define FUSE_USE_VERSION 31 #define _GNU_SOURCE #include #include #include #include #include #include "fuse_operations.h" #include "sourcefs.h" #include "ui-socket.h" const char *mountpoint = NULL; int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Usage: icfs [target directory] [path to " "the permanent permissions database\n"); return EXIT_FAILURE; } // if umask != 0, the filesystem will create files with more restrictive // permissions than it's caller reqested umask(0); // ui socket should always be initialized before anything else, since it // handles the setuid bits! int ret = init_ui_socket(argv[argc - 1]); if (ret != 0) { fprintf(stderr, "Could not initalize ui-socket.\n"); exit(EXIT_FAILURE); } mountpoint = realpath(argv[argc - 2], NULL); ret = source_init(mountpoint); if (ret != 0) { perror("source_init"); exit(EXIT_FAILURE); } ret = fuse_main(argc - 1, argv, get_fuse_operations(), NULL); free((void *)mountpoint); source_destroy(); destroy_ui_socket(); return ret; }