s3:smb2_break: make use of file_fsp_smb2()
[Samba/gebeck_regimport.git] / lib / replace / system / filesys.h
blob493d87d7d4f82598b2e6673ebba559b2997ca306
1 #ifndef _system_filesys_h
2 #define _system_filesys_h
3 /*
4 Unix SMB/CIFS implementation.
6 filesystem system include wrappers
8 Copyright (C) Andrew Tridgell 2004
10 ** NOTE! The following LGPL license applies to the replace
11 ** library. This does NOT imply that all of Samba is released
12 ** under the LGPL
14 This library is free software; you can redistribute it and/or
15 modify it under the terms of the GNU Lesser General Public
16 License as published by the Free Software Foundation; either
17 version 3 of the License, or (at your option) any later version.
19 This library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
24 You should have received a copy of the GNU Lesser General Public
25 License along with this library; if not, see <http://www.gnu.org/licenses/>.
29 #include <unistd.h>
30 #include <sys/stat.h>
32 #ifdef HAVE_SYS_PARAM_H
33 #include <sys/param.h>
34 #endif
36 #ifdef HAVE_SYS_MOUNT_H
37 #include <sys/mount.h>
38 #endif
40 #ifdef HAVE_MNTENT_H
41 #include <mntent.h>
42 #endif
44 #ifdef HAVE_SYS_VFS_H
45 #include <sys/vfs.h>
46 #endif
48 #ifdef HAVE_SYS_ACL_H
49 #include <sys/acl.h>
50 #endif
52 #ifdef HAVE_ACL_LIBACL_H
53 #include <acl/libacl.h>
54 #endif
56 #ifdef HAVE_SYS_FS_S5PARAM_H
57 #include <sys/fs/s5param.h>
58 #endif
60 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
61 #include <sys/filsys.h>
62 #endif
64 #ifdef HAVE_SYS_STATFS_H
65 # include <sys/statfs.h>
66 #endif
68 #ifdef HAVE_DUSTAT_H
69 #include <sys/dustat.h>
70 #endif
72 #ifdef HAVE_SYS_STATVFS_H
73 #include <sys/statvfs.h>
74 #endif
76 #ifdef HAVE_SYS_FILIO_H
77 #include <sys/filio.h>
78 #endif
80 #ifdef HAVE_SYS_FILE_H
81 #include <sys/file.h>
82 #endif
84 #ifdef HAVE_FCNTL_H
85 #include <fcntl.h>
86 #else
87 #ifdef HAVE_SYS_FCNTL_H
88 #include <sys/fcntl.h>
89 #endif
90 #endif
92 #ifdef HAVE_SYS_MODE_H
93 /* apparently AIX needs this for S_ISLNK */
94 #ifndef S_ISLNK
95 #include <sys/mode.h>
96 #endif
97 #endif
99 #ifdef HAVE_SYS_IOCTL_H
100 #include <sys/ioctl.h>
101 #endif
103 #ifdef HAVE_SYS_UIO_H
104 #include <sys/uio.h>
105 #endif
108 * Veritas File System. Often in addition to native.
109 * Quotas different.
111 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
112 #define VXFS_QUOTA
113 #endif
115 #if HAVE_SYS_ATTRIBUTES_H
116 #include <sys/attributes.h>
117 #endif
119 /* mutually exclusive (SuSE 8.2) */
120 #if HAVE_ATTR_XATTR_H
121 #include <attr/xattr.h>
122 #elif HAVE_SYS_XATTR_H
123 #include <sys/xattr.h>
124 #endif
126 #ifdef HAVE_SYS_EA_H
127 #include <sys/ea.h>
128 #endif
130 #ifdef HAVE_SYS_EXTATTR_H
131 #include <sys/extattr.h>
132 #endif
134 #ifdef HAVE_SYS_RESOURCE_H
135 #include <sys/resource.h>
136 #endif
138 #ifndef XATTR_CREATE
139 #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
140 #endif
142 #ifndef XATTR_REPLACE
143 #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
144 #endif
146 /* Some POSIX definitions for those without */
148 #ifndef S_IFDIR
149 #define S_IFDIR 0x4000
150 #endif
151 #ifndef S_ISDIR
152 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
153 #endif
154 #ifndef S_IRWXU
155 #define S_IRWXU 00700 /* read, write, execute: owner */
156 #endif
157 #ifndef S_IRUSR
158 #define S_IRUSR 00400 /* read permission: owner */
159 #endif
160 #ifndef S_IWUSR
161 #define S_IWUSR 00200 /* write permission: owner */
162 #endif
163 #ifndef S_IXUSR
164 #define S_IXUSR 00100 /* execute permission: owner */
165 #endif
166 #ifndef S_IRWXG
167 #define S_IRWXG 00070 /* read, write, execute: group */
168 #endif
169 #ifndef S_IRGRP
170 #define S_IRGRP 00040 /* read permission: group */
171 #endif
172 #ifndef S_IWGRP
173 #define S_IWGRP 00020 /* write permission: group */
174 #endif
175 #ifndef S_IXGRP
176 #define S_IXGRP 00010 /* execute permission: group */
177 #endif
178 #ifndef S_IRWXO
179 #define S_IRWXO 00007 /* read, write, execute: other */
180 #endif
181 #ifndef S_IROTH
182 #define S_IROTH 00004 /* read permission: other */
183 #endif
184 #ifndef S_IWOTH
185 #define S_IWOTH 00002 /* write permission: other */
186 #endif
187 #ifndef S_IXOTH
188 #define S_IXOTH 00001 /* execute permission: other */
189 #endif
191 #ifndef O_ACCMODE
192 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
193 #endif
195 #ifndef MAXPATHLEN
196 #define MAXPATHLEN 256
197 #endif
199 #ifndef SEEK_SET
200 #define SEEK_SET 0
201 #endif
203 #ifdef _WIN32
204 #define mkdir(d,m) _mkdir(d)
205 #endif
207 #ifdef UID_WRAPPER
208 # ifndef UID_WRAPPER_DISABLE
209 # ifndef UID_WRAPPER_NOT_REPLACE
210 # define UID_WRAPPER_REPLACE
211 # endif /* UID_WRAPPER_NOT_REPLACE */
212 # include "../uid_wrapper/uid_wrapper.h"
213 # endif /* UID_WRAPPER_DISABLE */
214 #else /* UID_WRAPPER */
215 # define uwrap_enabled() 0
216 #endif /* UID_WRAPPER */
219 this allows us to use a uniform error handling for our xattr
220 wrappers
222 #ifndef ENOATTR
223 #define ENOATTR ENODATA
224 #endif
227 #if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
228 ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
229 #define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
230 /* define is in "replace.h" */
231 #endif
233 #if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
234 ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
235 #define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
236 /* define is in "replace.h" */
237 #endif
239 #if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
240 ssize_t rep_listxattr (const char *path, char *list, size_t size);
241 #define listxattr(path, list, size) rep_listxattr(path, list, size)
242 /* define is in "replace.h" */
243 #endif
245 #if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
246 ssize_t rep_flistxattr (int filedes, char *list, size_t size);
247 #define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
248 /* define is in "replace.h" */
249 #endif
251 #if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
252 int rep_removexattr (const char *path, const char *name);
253 #define removexattr(path, name) rep_removexattr(path, name)
254 /* define is in "replace.h" */
255 #endif
257 #if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
258 int rep_fremovexattr (int filedes, const char *name);
259 #define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
260 /* define is in "replace.h" */
261 #endif
263 #if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
264 int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
265 #define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
266 /* define is in "replace.h" */
267 #endif
269 #if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
270 int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
271 #define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
272 /* define is in "replace.h" */
273 #endif
275 #endif