s4-dsdb/samldb: Skip 'sAMAccountType' and 'primaryGroupID' during Tombstone reanimate
[Samba.git] / lib / replace / system / filesys.h
blobbd6e6a0dd19887b2e08eb9b7b677228c91e4c95e
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 #ifdef HAVE_UNISTD_H
30 #include <unistd.h>
31 #endif
33 #include <sys/stat.h>
35 #ifdef HAVE_SYS_PARAM_H
36 #include <sys/param.h>
37 #endif
39 #ifdef HAVE_SYS_MOUNT_H
40 #include <sys/mount.h>
41 #endif
43 #ifdef HAVE_MNTENT_H
44 #include <mntent.h>
45 #endif
47 #ifdef HAVE_SYS_VFS_H
48 #include <sys/vfs.h>
49 #endif
51 #ifdef HAVE_SYS_ACL_H
52 #include <sys/acl.h>
53 #endif
55 #ifdef HAVE_ACL_LIBACL_H
56 #include <acl/libacl.h>
57 #endif
59 #ifdef HAVE_SYS_FS_S5PARAM_H
60 #include <sys/fs/s5param.h>
61 #endif
63 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
64 #include <sys/filsys.h>
65 #endif
67 #ifdef HAVE_SYS_STATFS_H
68 # include <sys/statfs.h>
69 #endif
71 #ifdef HAVE_DUSTAT_H
72 #include <sys/dustat.h>
73 #endif
75 #ifdef HAVE_SYS_STATVFS_H
76 #include <sys/statvfs.h>
77 #endif
79 #ifdef HAVE_SYS_FILIO_H
80 #include <sys/filio.h>
81 #endif
83 #ifdef HAVE_SYS_FILE_H
84 #include <sys/file.h>
85 #endif
87 #ifdef HAVE_FCNTL_H
88 #include <fcntl.h>
89 #else
90 #ifdef HAVE_SYS_FCNTL_H
91 #include <sys/fcntl.h>
92 #endif
93 #endif
95 #ifdef HAVE_SYS_MODE_H
96 /* apparently AIX needs this for S_ISLNK */
97 #ifndef S_ISLNK
98 #include <sys/mode.h>
99 #endif
100 #endif
102 #ifdef HAVE_SYS_IOCTL_H
103 #include <sys/ioctl.h>
104 #endif
106 #ifdef HAVE_SYS_UIO_H
107 #include <sys/uio.h>
108 #endif
111 * Veritas File System. Often in addition to native.
112 * Quotas different.
114 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
115 #define VXFS_QUOTA
116 #endif
118 #if HAVE_SYS_ATTRIBUTES_H
119 #include <sys/attributes.h>
120 #elif HAVE_ATTR_ATTRIBUTES_H
121 #include <attr/attributes.h>
122 #endif
124 /* mutually exclusive (SuSE 8.2) */
125 #if HAVE_ATTR_XATTR_H
126 #include <attr/xattr.h>
127 #elif HAVE_SYS_XATTR_H
128 #include <sys/xattr.h>
129 #endif
131 #ifdef HAVE_SYS_EA_H
132 #include <sys/ea.h>
133 #endif
135 #ifdef HAVE_SYS_EXTATTR_H
136 #include <sys/extattr.h>
137 #endif
139 #ifdef HAVE_SYS_RESOURCE_H
140 #include <sys/resource.h>
141 #endif
143 #ifndef XATTR_CREATE
144 #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
145 #endif
147 #ifndef XATTR_REPLACE
148 #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
149 #endif
151 /* Some POSIX definitions for those without */
153 #ifndef S_IFDIR
154 #define S_IFDIR 0x4000
155 #endif
156 #ifndef S_ISDIR
157 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
158 #endif
159 #ifndef S_IRWXU
160 #define S_IRWXU 00700 /* read, write, execute: owner */
161 #endif
162 #ifndef S_IRUSR
163 #define S_IRUSR 00400 /* read permission: owner */
164 #endif
165 #ifndef S_IWUSR
166 #define S_IWUSR 00200 /* write permission: owner */
167 #endif
168 #ifndef S_IXUSR
169 #define S_IXUSR 00100 /* execute permission: owner */
170 #endif
171 #ifndef S_IRWXG
172 #define S_IRWXG 00070 /* read, write, execute: group */
173 #endif
174 #ifndef S_IRGRP
175 #define S_IRGRP 00040 /* read permission: group */
176 #endif
177 #ifndef S_IWGRP
178 #define S_IWGRP 00020 /* write permission: group */
179 #endif
180 #ifndef S_IXGRP
181 #define S_IXGRP 00010 /* execute permission: group */
182 #endif
183 #ifndef S_IRWXO
184 #define S_IRWXO 00007 /* read, write, execute: other */
185 #endif
186 #ifndef S_IROTH
187 #define S_IROTH 00004 /* read permission: other */
188 #endif
189 #ifndef S_IWOTH
190 #define S_IWOTH 00002 /* write permission: other */
191 #endif
192 #ifndef S_IXOTH
193 #define S_IXOTH 00001 /* execute permission: other */
194 #endif
196 #ifndef O_ACCMODE
197 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
198 #endif
200 #ifndef MAXPATHLEN
201 #define MAXPATHLEN 256
202 #endif
204 #ifndef SEEK_SET
205 #define SEEK_SET 0
206 #endif
208 #ifdef _WIN32
209 #define mkdir(d,m) _mkdir(d)
210 #endif
213 this allows us to use a uniform error handling for our xattr
214 wrappers
216 #ifndef ENOATTR
217 #define ENOATTR ENODATA
218 #endif
221 #if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
222 ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
223 #define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
224 /* define is in "replace.h" */
225 #endif
227 #if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
228 ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
229 #define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
230 /* define is in "replace.h" */
231 #endif
233 #if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
234 ssize_t rep_listxattr (const char *path, char *list, size_t size);
235 #define listxattr(path, list, size) rep_listxattr(path, list, size)
236 /* define is in "replace.h" */
237 #endif
239 #if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
240 ssize_t rep_flistxattr (int filedes, char *list, size_t size);
241 #define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
242 /* define is in "replace.h" */
243 #endif
245 #if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
246 int rep_removexattr (const char *path, const char *name);
247 #define removexattr(path, name) rep_removexattr(path, name)
248 /* define is in "replace.h" */
249 #endif
251 #if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
252 int rep_fremovexattr (int filedes, const char *name);
253 #define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
254 /* define is in "replace.h" */
255 #endif
257 #if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
258 int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
259 #define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
260 /* define is in "replace.h" */
261 #endif
263 #if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
264 int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
265 #define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
266 /* define is in "replace.h" */
267 #endif
269 #endif