Extract filesystem-related functions into fs.c
[tinc] / src / fs.h
1 #ifndef TINC_FS_H
2 #define TINC_FS_H
3
4 #include "system.h"
5
6 typedef enum {
7         DIR_CACHE       = 1 << 0,
8         DIR_CONFBASE    = 1 << 1,
9         DIR_CONFDIR     = 1 << 2,
10         DIR_HOSTS       = 1 << 3,
11         DIR_INVITATIONS = 1 << 4,
12 } tinc_dir_t;
13
14 // Create one or multiple directories inside tincd configuration directory
15 extern bool makedirs(tinc_dir_t dirs);
16
17 // Open file. If it does not exist, create a new file with the specified access mode.
18 extern FILE *fopenmask(const char *filename, const char *mode, mode_t perms) ATTR_DEALLOCATOR(fclose);
19
20 // Get absolute path to a possibly nonexistent file or directory
21 extern char *absolute_path(const char *path) ATTR_MALLOC;
22
23 #endif // TINC_FS_H