r23795: more v2->v3 conversion
[samba.git] / source4 / lib / replace / system / filesys.h
1 #ifndef _system_filesys_h
2 #define _system_filesys_h
3 /* 
4    Unix SMB/CIFS implementation.
5
6    filesystem system include wrappers
7
8    Copyright (C) Andrew Tridgell 2004
9    
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
13    
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.
18
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.
23
24    You should have received a copy of the GNU Lesser General Public
25    License along with this library; if not, write to the Free Software
26    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
28 */
29
30 #include <unistd.h>
31 #include <sys/stat.h>
32
33 #ifdef HAVE_SYS_PARAM_H
34 #include <sys/param.h>
35 #endif
36
37 #ifdef HAVE_SYS_MOUNT_H
38 #include <sys/mount.h>
39 #endif
40
41 #ifdef HAVE_MNTENT_H
42 #include <mntent.h>
43 #endif
44
45 #ifdef HAVE_SYS_VFS_H
46 #include <sys/vfs.h>
47 #endif
48
49 #ifdef HAVE_SYS_ACL_H
50 #include <sys/acl.h>
51 #endif
52
53 #ifdef HAVE_ACL_LIBACL_H
54 #include <acl/libacl.h>
55 #endif
56
57 #ifdef HAVE_SYS_FS_S5PARAM_H 
58 #include <sys/fs/s5param.h>
59 #endif
60
61 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
62 #include <sys/filsys.h> 
63 #endif
64
65 #ifdef HAVE_SYS_STATFS_H
66 # include <sys/statfs.h>
67 #endif
68
69 #ifdef HAVE_DUSTAT_H              
70 #include <sys/dustat.h>
71 #endif
72
73 #ifdef HAVE_SYS_STATVFS_H          
74 #include <sys/statvfs.h>
75 #endif
76
77 #ifdef HAVE_SYS_FILIO_H
78 #include <sys/filio.h>
79 #endif
80
81 #include <sys/file.h>
82
83 #ifdef HAVE_FCNTL_H
84 #include <fcntl.h>
85 #else
86 #ifdef HAVE_SYS_FCNTL_H
87 #include <sys/fcntl.h>
88 #endif
89 #endif
90
91 #ifdef HAVE_SYS_MODE_H
92 /* apparently AIX needs this for S_ISLNK */
93 #ifndef S_ISLNK
94 #include <sys/mode.h>
95 #endif
96 #endif
97
98 #ifdef HAVE_SYS_IOCTL_H
99 #include <sys/ioctl.h>
100 #endif
101
102 /*
103  * Veritas File System.  Often in addition to native.
104  * Quotas different.
105  */
106 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
107 #define VXFS_QUOTA
108 #endif
109
110 #if HAVE_SYS_ATTRIBUTES_H
111 #include <sys/attributes.h>
112 #endif
113
114 /* mutually exclusive (SuSE 8.2) */
115 #if HAVE_ATTR_XATTR_H
116 #include <attr/xattr.h>
117 #elif HAVE_SYS_XATTR_H
118 #include <sys/xattr.h>
119 #endif
120
121
122 #ifdef HAVE_SYS_RESOURCE_H
123 #include <sys/resource.h>
124 #endif
125
126 /* Some POSIX definitions for those without */
127  
128 #ifndef S_IFDIR
129 #define S_IFDIR         0x4000
130 #endif
131 #ifndef S_ISDIR
132 #define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
133 #endif
134 #ifndef S_IRWXU
135 #define S_IRWXU 00700           /* read, write, execute: owner */
136 #endif
137 #ifndef S_IRUSR
138 #define S_IRUSR 00400           /* read permission: owner */
139 #endif
140 #ifndef S_IWUSR
141 #define S_IWUSR 00200           /* write permission: owner */
142 #endif
143 #ifndef S_IXUSR
144 #define S_IXUSR 00100           /* execute permission: owner */
145 #endif
146 #ifndef S_IRWXG
147 #define S_IRWXG 00070           /* read, write, execute: group */
148 #endif
149 #ifndef S_IRGRP
150 #define S_IRGRP 00040           /* read permission: group */
151 #endif
152 #ifndef S_IWGRP
153 #define S_IWGRP 00020           /* write permission: group */
154 #endif
155 #ifndef S_IXGRP
156 #define S_IXGRP 00010           /* execute permission: group */
157 #endif
158 #ifndef S_IRWXO
159 #define S_IRWXO 00007           /* read, write, execute: other */
160 #endif
161 #ifndef S_IROTH
162 #define S_IROTH 00004           /* read permission: other */
163 #endif
164 #ifndef S_IWOTH
165 #define S_IWOTH 00002           /* write permission: other */
166 #endif
167 #ifndef S_IXOTH
168 #define S_IXOTH 00001           /* execute permission: other */
169 #endif
170
171 #ifndef O_ACCMODE
172 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
173 #endif
174
175 #ifndef MAXPATHLEN
176 #define MAXPATHLEN 256
177 #endif
178
179 #ifndef SEEK_SET
180 #define SEEK_SET 0
181 #endif
182
183 #endif