Debian Codegraph @

src/xattr.h

raw
1 /* xattr.h -- POSIX Extended Attribute function mappings.
2
3 Copyright (C) 2016, 2018-2024 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
17
18 #include <stdio.h>
19 #include <url.h>
20
21 #ifndef _XATTR_H
22 #define _XATTR_H
23
24 /* Store metadata name/value attributes against fp. */
25 int set_file_metadata (const struct url *origin_url, const struct url *referrer_url, FILE *fp);
26
27 #if defined(__linux)
28 /* libc on Linux has fsetxattr (5 arguments). */
29 # include <sys/xattr.h>
30 # define USE_XATTR
31 #elif defined(__APPLE__)
32 /* libc on OS/X has fsetxattr (6 arguments). */
33 # include <sys/xattr.h>
34 # define fsetxattr(file, name, buffer, size, flags) \
35 fsetxattr ((file), (name), (buffer), (size), 0, (flags))
36 # define USE_XATTR
37 #elif defined(__FreeBSD_version) && (__FreeBSD_version > 500000)
38 /* FreeBSD */
39 # include <sys/types.h>
40 # include <sys/extattr.h>
41 # define fsetxattr(file, name, buffer, size, flags) \
42 extattr_set_fd ((file), EXTATTR_NAMESPACE_USER, (name), (buffer), (size))
43 # define USE_XATTR
44 #endif
45
46 #endif /* _XATTR_H */