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
110 /* mutually exclusive (SuSE 8.2) */
111 #if defined(HAVE_SYS_XATTR_H)
112 #include <sys/xattr.h>
113 #elif defined(HAVE_ATTR_XATTR_H)
114 #include <attr/xattr.h>
115 #elif defined(HAVE_SYS_ATTRIBUTES_H)
116 #include <sys/attributes.h>
117 #elif defined(HAVE_ATTR_ATTRIBUTES_H)
118 #include <attr/attributes.h>
125 #ifdef HAVE_SYS_EXTATTR_H
126 #include <sys/extattr.h>
129 #ifdef HAVE_SYS_RESOURCE_H
130 #include <sys/resource.h>
134 #define XATTR_CREATE 0x1 /* set value, fail if attr already exists */
137 #ifndef XATTR_REPLACE
138 #define XATTR_REPLACE 0x2 /* set value, fail if attr does not exist */
141 /* Some POSIX definitions for those without */
144 #define S_IFDIR 0x4000
147 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
150 #define S_IRWXU 00700 /* read, write, execute: owner */
153 #define S_IRUSR 00400 /* read permission: owner */
156 #define S_IWUSR 00200 /* write permission: owner */
159 #define S_IXUSR 00100 /* execute permission: owner */
162 #define S_IRWXG 00070 /* read, write, execute: group */
165 #define S_IRGRP 00040 /* read permission: group */
168 #define S_IWGRP 00020 /* write permission: group */
171 #define S_IXGRP 00010 /* execute permission: group */
174 #define S_IRWXO 00007 /* read, write, execute: other */
177 #define S_IROTH 00004 /* read permission: other */
180 #define S_IWOTH 00002 /* write permission: other */
183 #define S_IXOTH 00001 /* execute permission: other */
187 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
191 #define MAXPATHLEN 256
199 #define mkdir(d,m) _mkdir(d)
207 this allows us to use a uniform error handling for our xattr
211 #define ENOATTR ENODATA
215 #if !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
217 ssize_t
rep_getxattr (const char *path
, const char *name
, void *value
, size_t size
);
218 #define getxattr(path, name, value, size) rep_getxattr(path, name, value, size)
219 /* define is in "replace.h" */
220 ssize_t
rep_fgetxattr (int filedes
, const char *name
, void *value
, size_t size
);
221 #define fgetxattr(filedes, name, value, size) rep_fgetxattr(filedes, name, value, size)
222 /* define is in "replace.h" */
223 ssize_t
rep_listxattr (const char *path
, char *list
, size_t size
);
224 #define listxattr(path, list, size) rep_listxattr(path, list, size)
225 /* define is in "replace.h" */
226 ssize_t
rep_flistxattr (int filedes
, char *list
, size_t size
);
227 #define flistxattr(filedes, value, size) rep_flistxattr(filedes, value, size)
228 /* define is in "replace.h" */
229 int rep_removexattr (const char *path
, const char *name
);
230 #define removexattr(path, name) rep_removexattr(path, name)
231 /* define is in "replace.h" */
232 int rep_fremovexattr (int filedes
, const char *name
);
233 #define fremovexattr(filedes, name) rep_fremovexattr(filedes, name)
234 /* define is in "replace.h" */
235 int rep_setxattr (const char *path
, const char *name
, const void *value
, size_t size
, int flags
);
236 #define setxattr(path, name, value, size, flags) rep_setxattr(path, name, value, size, flags)
237 /* define is in "replace.h" */
238 int rep_fsetxattr (int filedes
, const char *name
, const void *value
, size_t size
, int flags
);
239 #define fsetxattr(filedes, name, value, size, flags) rep_fsetxattr(filedes, name, value, size, flags)
240 /* define is in "replace.h" */
242 #endif /* !defined(HAVE_XATTR_XATTR) || defined(XATTR_ADDITIONAL_OPTIONS) */