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.
22 lines
295 B
C
22 lines
295 B
C
#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;
|
|
}
|