1 #ifndef _system_filesys_h
2 #define _system_filesys_h
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
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/>.
35 #ifdef HAVE_SYS_PARAM_H
36 #include <sys/param.h>
39 #ifdef HAVE_SYS_MOUNT_H
40 #include <sys/mount.h>
55 #ifdef HAVE_ACL_LIBACL_H
56 #include <acl/libacl.h>
59 #ifdef HAVE_SYS_FS_S5PARAM_H
60 #include <sys/fs/s5param.h>
63 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
64 #include <sys/filsys.h>
67 #ifdef HAVE_SYS_STATFS_H
68 # include <sys/statfs.h>
72 #include <sys/dustat.h>
75 #ifdef HAVE_SYS_STATVFS_H
76 #include <sys/statvfs.h>
79 #ifdef HAVE_SYS_FILIO_H
80 #include <sys/filio.h>
83 #ifdef HAVE_SYS_FILE_H
90 #ifdef HAVE_SYS_FCNTL_H
91 #include <sys/fcntl.h>
95 #ifdef HAVE_SYS_MODE_H
96 /* apparently AIX needs this for S_ISLNK */
102 #ifdef HAVE_SYS_IOCTL_H
103 #include <sys/ioctl.h>
106 #ifdef HAVE_SYS_UIO_H
111 * Veritas File System. Often in addition to native.
114 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
118 #if defined(HAVE_SYS_ATTRIBUTES_H)
119 #include <sys/attributes.h>
120 #elif defined(HAVE_ATTR_ATTRIBUTES_H)
121 #include <attr/attributes.h>
124 /* mutually exclusive (SuSE 8.2) */
125 #if defined(HAVE_ATTR_XATTR_H)
126 #include <attr/xattr.h>
127 #elif defined(HAVE_SYS_XATTR_H)
128 #include <sys/xattr.h>
135 #ifdef HAVE_SYS_EXTATTR_H
136 #include <sys/extattr.h>
139 #ifdef HAVE_SYS_RESOURCE_H
140 #include <sys/resource.h>
144 #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
147 #ifndef XATTR_REPLACE
148 #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
151 /* Some POSIX definitions for those without */
154 #define S_IFDIR 0x4000
157 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
160 #define S_IRWXU 00700 /* read, write, execute: owner */
163 #define S_IRUSR 00400 /* read permission: owner */
166 #define S_IWUSR 00200 /* write permission: owner */
169 #define S_IXUSR 00100 /* execute permission: owner */
172 #define S_IRWXG 00070 /* read, write, execute: group */
175 #define S_IRGRP 00040 /* read permission: group */
178 #define S_IWGRP 00020 /* write permission: group */
181 #define S_IXGRP 00010 /* execute permission: group */
184 #define S_IRWXO 00007 /* read, write, execute: other */
187 #define S_IROTH 00004 /* read permission: other */
190 #define S_IWOTH 00002 /* write permission: other */
193 #define S_IXOTH 00001 /* execute permission: other */
197 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
201 #define MAXPATHLEN 256
209 #define mkdir(d,m) _mkdir(d)
213 this allows us to use a uniform error handling for our xattr
217 #define ENOATTR ENODATA
221 #if !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
223 ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
224 #define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
225 /* define is in "replace.h" */
226 ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
227 #define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
228 /* define is in "replace.h" */
229 ssize_t rep_listxattr (const char *path, char *list, size_t size);
230 #define listxattr(path, list, size) rep_listxattr(path, list, size)
231 /* define is in "replace.h" */
232 ssize_t rep_flistxattr (int filedes, char *list, size_t size);
233 #define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
234 /* define is in "replace.h" */
235 int rep_removexattr (const char *path, const char *name);
236 #define removexattr(path, name) rep_removexattr(path, name)
237 /* define is in "replace.h" */
238 int rep_fremovexattr (int filedes, const char *name);
239 #define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
240 /* define is in "replace.h" */
241 int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
242 #define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
243 /* define is in "replace.h" */
244 int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
245 #define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
246 /* define is in "replace.h" */
248 #endif /* !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS) */