s3-torture/denytest.c: replace cli_read_old() with cli_read()
[Samba/gebeck_regimport.git] / lib / util / wrap_xattr.c
blobb7e69c3676668ae16cde405940b6678a7ca7990b
1 /*
2 Unix SMB/CIFS implementation.
4 POSIX NTVFS backend - xattr support using filesystem xattrs
6 Copyright (C) Andrew Tridgell 2004
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "includes.h"
23 #include "system/filesys.h"
24 #include "../lib/util/wrap_xattr.h"
26 #if defined(HAVE_XATTR_SUPPORT) && defined(XATTR_ADDITIONAL_OPTIONS)
27 static ssize_t _wrap_darwin_fgetxattr(int fd, const char *name, void *value, size_t size)
29 return fgetxattr(fd, name, value, size, 0, 0);
31 static ssize_t _wrap_darwin_getxattr(const char *path, const char *name, void *value, size_t size)
33 return getxattr(path, name, value, size, 0, 0);
35 static int _wrap_darwin_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
37 return fsetxattr(fd, name, value, size, 0, flags);
39 static int _wrap_darwin_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
41 return setxattr(path, name, value, size, 0, flags);
43 static int _wrap_darwin_fremovexattr(int fd, const char *name)
45 return fremovexattr(fd, name, 0);
47 static int _wrap_darwin_removexattr(const char *path, const char *name)
49 return removexattr(path, name, 0);
51 #define fgetxattr _wrap_darwin_fgetxattr
52 #define getxattr _wrap_darwin_getxattr
53 #define fsetxattr _wrap_darwin_fsetxattr
54 #define setxattr _wrap_darwin_setxattr
55 #define fremovexattr _wrap_darwin_fremovexattr
56 #define removexattr _wrap_darwin_removexattr
57 #elif !defined(HAVE_XATTR_SUPPORT)
58 static ssize_t _none_fgetxattr(int fd, const char *name, void *value, size_t size)
60 errno = ENOSYS;
61 return -1;
63 static ssize_t _none_getxattr(const char *path, const char *name, void *value, size_t size)
65 errno = ENOSYS;
66 return -1;
68 static int _none_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
70 errno = ENOSYS;
71 return -1;
73 static int _none_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
75 errno = ENOSYS;
76 return -1;
78 static int _none_fremovexattr(int fd, const char *name)
80 errno = ENOSYS;
81 return -1;
83 static int _none_removexattr(const char *path, const char *name)
85 errno = ENOSYS;
86 return -1;
88 #define fgetxattr _none_fgetxattr
89 #define getxattr _none_getxattr
90 #define fsetxattr _none_fsetxattr
91 #define setxattr _none_setxattr
92 #define fremovexattr _none_fremovexattr
93 #define removexattr _none_removexattr
94 #endif
96 _PUBLIC_ ssize_t wrap_fgetxattr(int fd, const char *name, void *value, size_t size)
98 return fgetxattr(fd, name, value, size);
100 _PUBLIC_ ssize_t wrap_getxattr(const char *path, const char *name, void *value, size_t size)
102 return getxattr(path, name, value, size);
104 _PUBLIC_ int wrap_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
106 return fsetxattr(fd, name, value, size, flags);
108 _PUBLIC_ int wrap_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
110 return setxattr(path, name, value, size, flags);
112 _PUBLIC_ int wrap_fremovexattr(int fd, const char *name)
114 return fremovexattr(fd, name);
116 _PUBLIC_ int wrap_removexattr(const char *path, const char *name)
118 return removexattr(path, name);