-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathutils.h
49 lines (35 loc) · 1.25 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
fuse_xattrs - Add xattrs support using sidecar files
Copyright (C) 2016 Felipe Barriga Richards <felipe {at} felipebarriga.cl>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#ifndef FUSE_XATTRS_UTILS_H
#define FUSE_XATTRS_UTILS_H
#define DEBUG 1
#include <string.h>
#include <stdio.h>
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#define debug_print(fmt, ...) \
do { \
if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILENAME__, __LINE__, __func__, ##__VA_ARGS__); \
} while (0)
#define error_print(fmt, ...) \
do { if (DEBUG) fprintf(stderr, "%s:%d:%s(): " fmt, __FILENAME__, \
__LINE__, __func__, ##__VA_ARGS__); } while (0)
enum namespace {
SECURITY,
SYSTEM,
TRUSTED,
USER,
ERROR
};
enum namespace get_namespace(const char *name);
char *get_sidecar_path(const char *path);
char *sanitize_value(const char *value, size_t value_size);
char *prepend_source_directory(const char *b);
extern const size_t BINARY_SIDECAR_EXT_SIZE;
const int filename_is_sidecar(const char *string);
int is_directory(const char *path);
int is_regular_file(const char *path);
#endif //FUSE_XATTRS_UTILS_H