source: branches/samba-3.5.x/lib/util/wrap_xattr.c

Last change on this file was 414, checked in by Herwig Bauernfeind, 15 years ago

Samba 3.5.0: Initial import

File size: 3.6 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3
4 POSIX NTVFS backend - xattr support using filesystem xattrs
5
6 Copyright (C) Andrew Tridgell 2004
7
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.
12
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.
17
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/>.
20*/
21
22#include "includes.h"
23#include "system/filesys.h"
24#include "../lib/util/wrap_xattr.h"
25
26#if defined(HAVE_XATTR_SUPPORT) && defined(XATTR_ADDITIONAL_OPTIONS)
27static ssize_t _wrap_darwin_fgetxattr(int fd, const char *name, void *value, size_t size)
28{
29 return fgetxattr(fd, name, value, size, 0, 0);
30}
31static ssize_t _wrap_darwin_getxattr(const char *path, const char *name, void *value, size_t size)
32{
33 return getxattr(path, name, value, size, 0, 0);
34}
35static int _wrap_darwin_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
36{
37 return fsetxattr(fd, name, value, size, 0, flags);
38}
39static int _wrap_darwin_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
40{
41 return setxattr(path, name, value, size, 0, flags);
42}
43static int _wrap_darwin_fremovexattr(int fd, const char *name)
44{
45 return fremovexattr(fd, name, 0);
46}
47static int _wrap_darwin_removexattr(const char *path, const char *name)
48{
49 return removexattr(path, name, 0);
50}
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)
58static ssize_t _none_fgetxattr(int fd, const char *name, void *value, size_t size)
59{
60 errno = ENOSYS;
61 return -1;
62}
63static ssize_t _none_getxattr(const char *path, const char *name, void *value, size_t size)
64{
65 errno = ENOSYS;
66 return -1;
67}
68static int _none_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
69{
70 errno = ENOSYS;
71 return -1;
72}
73static int _none_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
74{
75 errno = ENOSYS;
76 return -1;
77}
78static int _none_fremovexattr(int fd, const char *name)
79{
80 errno = ENOSYS;
81 return -1;
82}
83static int _none_removexattr(const char *path, const char *name)
84{
85 errno = ENOSYS;
86 return -1;
87}
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
95
96_PUBLIC_ ssize_t wrap_fgetxattr(int fd, const char *name, void *value, size_t size)
97{
98 return fgetxattr(fd, name, value, size);
99}
100_PUBLIC_ ssize_t wrap_getxattr(const char *path, const char *name, void *value, size_t size)
101{
102 return getxattr(path, name, value, size);
103}
104_PUBLIC_ int wrap_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
105{
106 return fsetxattr(fd, name, value, size, flags);
107}
108_PUBLIC_ int wrap_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
109{
110 return setxattr(path, name, value, size, flags);
111}
112_PUBLIC_ int wrap_fremovexattr(int fd, const char *name)
113{
114 return fremovexattr(fd, name);
115}
116_PUBLIC_ int wrap_removexattr(const char *path, const char *name)
117{
118 return removexattr(path, name);
119}
120
Note: See TracBrowser for help on using the repository browser.