| 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, see <http://www.gnu.org/licenses/>.
 | 
|---|
| 26 | 
 | 
|---|
| 27 | */
 | 
|---|
| 28 | 
 | 
|---|
| 29 | #include <unistd.h>
 | 
|---|
| 30 | #include <sys/stat.h>
 | 
|---|
| 31 | 
 | 
|---|
| 32 | #ifdef HAVE_SYS_PARAM_H
 | 
|---|
| 33 | #include <sys/param.h>
 | 
|---|
| 34 | #endif
 | 
|---|
| 35 | 
 | 
|---|
| 36 | #ifdef HAVE_SYS_MOUNT_H
 | 
|---|
| 37 | #include <sys/mount.h>
 | 
|---|
| 38 | #endif
 | 
|---|
| 39 | 
 | 
|---|
| 40 | #ifdef HAVE_MNTENT_H
 | 
|---|
| 41 | #include <mntent.h>
 | 
|---|
| 42 | #endif
 | 
|---|
| 43 | 
 | 
|---|
| 44 | #ifdef HAVE_SYS_VFS_H
 | 
|---|
| 45 | #include <sys/vfs.h>
 | 
|---|
| 46 | #endif
 | 
|---|
| 47 | 
 | 
|---|
| 48 | #ifdef HAVE_SYS_ACL_H
 | 
|---|
| 49 | #include <sys/acl.h>
 | 
|---|
| 50 | #endif
 | 
|---|
| 51 | 
 | 
|---|
| 52 | #ifdef HAVE_ACL_LIBACL_H
 | 
|---|
| 53 | #include <acl/libacl.h>
 | 
|---|
| 54 | #endif
 | 
|---|
| 55 | 
 | 
|---|
| 56 | #ifdef HAVE_SYS_FS_S5PARAM_H
 | 
|---|
| 57 | #include <sys/fs/s5param.h>
 | 
|---|
| 58 | #endif
 | 
|---|
| 59 | 
 | 
|---|
| 60 | #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
 | 
|---|
| 61 | #include <sys/filsys.h>
 | 
|---|
| 62 | #endif
 | 
|---|
| 63 | 
 | 
|---|
| 64 | #ifdef HAVE_SYS_STATFS_H
 | 
|---|
| 65 | # include <sys/statfs.h>
 | 
|---|
| 66 | #endif
 | 
|---|
| 67 | 
 | 
|---|
| 68 | #ifdef HAVE_DUSTAT_H
 | 
|---|
| 69 | #include <sys/dustat.h>
 | 
|---|
| 70 | #endif
 | 
|---|
| 71 | 
 | 
|---|
| 72 | #ifdef HAVE_SYS_STATVFS_H
 | 
|---|
| 73 | #include <sys/statvfs.h>
 | 
|---|
| 74 | #endif
 | 
|---|
| 75 | 
 | 
|---|
| 76 | #ifdef HAVE_SYS_FILIO_H
 | 
|---|
| 77 | #include <sys/filio.h>
 | 
|---|
| 78 | #endif
 | 
|---|
| 79 | 
 | 
|---|
| 80 | #ifdef HAVE_SYS_FILE_H
 | 
|---|
| 81 | #include <sys/file.h>
 | 
|---|
| 82 | #endif
 | 
|---|
| 83 | 
 | 
|---|
| 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
 | 
|---|
| 91 | 
 | 
|---|
| 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
 | 
|---|
| 98 | 
 | 
|---|
| 99 | #ifdef HAVE_SYS_IOCTL_H
 | 
|---|
| 100 | #include <sys/ioctl.h>
 | 
|---|
| 101 | #endif
 | 
|---|
| 102 | 
 | 
|---|
| 103 | /*
 | 
|---|
| 104 |  * Veritas File System.  Often in addition to native.
 | 
|---|
| 105 |  * Quotas different.
 | 
|---|
| 106 |  */
 | 
|---|
| 107 | #if defined(HAVE_SYS_FS_VX_QUOTA_H)
 | 
|---|
| 108 | #define VXFS_QUOTA
 | 
|---|
| 109 | #endif
 | 
|---|
| 110 | 
 | 
|---|
| 111 | #if HAVE_SYS_ATTRIBUTES_H
 | 
|---|
| 112 | #include <sys/attributes.h>
 | 
|---|
| 113 | #endif
 | 
|---|
| 114 | 
 | 
|---|
| 115 | /* mutually exclusive (SuSE 8.2) */
 | 
|---|
| 116 | #if HAVE_ATTR_XATTR_H
 | 
|---|
| 117 | #include <attr/xattr.h>
 | 
|---|
| 118 | #elif HAVE_SYS_XATTR_H
 | 
|---|
| 119 | #include <sys/xattr.h>
 | 
|---|
| 120 | #endif
 | 
|---|
| 121 | 
 | 
|---|
| 122 | 
 | 
|---|
| 123 | #ifdef HAVE_SYS_RESOURCE_H
 | 
|---|
| 124 | #include <sys/resource.h>
 | 
|---|
| 125 | #endif
 | 
|---|
| 126 | 
 | 
|---|
| 127 | /* Some POSIX definitions for those without */
 | 
|---|
| 128 | 
 | 
|---|
| 129 | #ifndef S_IFDIR
 | 
|---|
| 130 | #define S_IFDIR         0x4000
 | 
|---|
| 131 | #endif
 | 
|---|
| 132 | #ifndef S_ISDIR
 | 
|---|
| 133 | #define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
 | 
|---|
| 134 | #endif
 | 
|---|
| 135 | #ifndef S_IRWXU
 | 
|---|
| 136 | #define S_IRWXU 00700           /* read, write, execute: owner */
 | 
|---|
| 137 | #endif
 | 
|---|
| 138 | #ifndef S_IRUSR
 | 
|---|
| 139 | #define S_IRUSR 00400           /* read permission: owner */
 | 
|---|
| 140 | #endif
 | 
|---|
| 141 | #ifndef S_IWUSR
 | 
|---|
| 142 | #define S_IWUSR 00200           /* write permission: owner */
 | 
|---|
| 143 | #endif
 | 
|---|
| 144 | #ifndef S_IXUSR
 | 
|---|
| 145 | #define S_IXUSR 00100           /* execute permission: owner */
 | 
|---|
| 146 | #endif
 | 
|---|
| 147 | #ifndef S_IRWXG
 | 
|---|
| 148 | #define S_IRWXG 00070           /* read, write, execute: group */
 | 
|---|
| 149 | #endif
 | 
|---|
| 150 | #ifndef S_IRGRP
 | 
|---|
| 151 | #define S_IRGRP 00040           /* read permission: group */
 | 
|---|
| 152 | #endif
 | 
|---|
| 153 | #ifndef S_IWGRP
 | 
|---|
| 154 | #define S_IWGRP 00020           /* write permission: group */
 | 
|---|
| 155 | #endif
 | 
|---|
| 156 | #ifndef S_IXGRP
 | 
|---|
| 157 | #define S_IXGRP 00010           /* execute permission: group */
 | 
|---|
| 158 | #endif
 | 
|---|
| 159 | #ifndef S_IRWXO
 | 
|---|
| 160 | #define S_IRWXO 00007           /* read, write, execute: other */
 | 
|---|
| 161 | #endif
 | 
|---|
| 162 | #ifndef S_IROTH
 | 
|---|
| 163 | #define S_IROTH 00004           /* read permission: other */
 | 
|---|
| 164 | #endif
 | 
|---|
| 165 | #ifndef S_IWOTH
 | 
|---|
| 166 | #define S_IWOTH 00002           /* write permission: other */
 | 
|---|
| 167 | #endif
 | 
|---|
| 168 | #ifndef S_IXOTH
 | 
|---|
| 169 | #define S_IXOTH 00001           /* execute permission: other */
 | 
|---|
| 170 | #endif
 | 
|---|
| 171 | 
 | 
|---|
| 172 | #ifndef O_ACCMODE
 | 
|---|
| 173 | #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
 | 
|---|
| 174 | #endif
 | 
|---|
| 175 | 
 | 
|---|
| 176 | #ifndef MAXPATHLEN
 | 
|---|
| 177 | #define MAXPATHLEN 256
 | 
|---|
| 178 | #endif
 | 
|---|
| 179 | 
 | 
|---|
| 180 | #ifndef SEEK_SET
 | 
|---|
| 181 | #define SEEK_SET 0
 | 
|---|
| 182 | #endif
 | 
|---|
| 183 | 
 | 
|---|
| 184 | #ifdef _WIN32
 | 
|---|
| 185 | #define mkdir(d,m) _mkdir(d)
 | 
|---|
| 186 | #endif
 | 
|---|
| 187 | 
 | 
|---|
| 188 | #endif
 | 
|---|