summaryrefslogtreecommitdiff
path: root/databases/compass/files/xattr.h
blob: 1ed546a49dee5c2152b20651cbcf292c1e6ded1f (plain) (blame)
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
/*
 * xattr is a Linux kernel API that has to be mapped to the FreeBSD API
 * code below is adopted and simplified from the 'xattr' python module
 * https://github.com/xattr/xattr/blob/master/xattr/lib_build.c
 */

#ifdef __FreeBSD__
#include <sys/types.h>

/* FreeBSD compatibility API */
#define XATTR_XATTR_NOFOLLOW 0x0001
#define XATTR_XATTR_CREATE 0x0002
#define XATTR_XATTR_REPLACE 0x0004
#define XATTR_XATTR_NOSECURITY 0x0008

#define XATTR_CREATE 0x1
#define XATTR_REPLACE 0x2

ssize_t getxattr(const char *path, const char *name,
                 void *value, ssize_t size, u_int32_t position,
                 int options);
ssize_t setxattr(const char *path, const char *name,
                 void *value, ssize_t size, u_int32_t position,
                 int options);
ssize_t removexattr(const char *path, const char *name,
                    int options);
ssize_t listxattr(const char *path, char *namebuf,
                  size_t size, int options);
ssize_t fgetxattr(int fd, const char *name, void *value,
                  ssize_t size, u_int32_t position, int options);
ssize_t fsetxattr(int fd, const char *name, void *value,
                  ssize_t size, u_int32_t position, int options);
ssize_t fremovexattr(int fd, const char *name, int options);
ssize_t flistxattr(int fd, char *namebuf, size_t size, int options);

#endif

#ifndef XATTR_MAXNAMELEN
#define XATTR_MAXNAMELEN 127
#endif