Added source files initialization.
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.
This commit is contained in:
21
sources/sourcefs.c
Normal file
21
sources/sourcefs.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "sourcefs.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
static struct source_files_handle {
|
||||
int root_fd;
|
||||
} handle;
|
||||
|
||||
int source_init(const char *root_path) {
|
||||
int root_fd = open(root_path, O_PATH);
|
||||
|
||||
if (root_fd == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
handle.root_fd = root_fd;
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user