Whamcloud - gitweb
b=21581 too long file / path names for old tar
[fs/lustre-release.git] / libsysio / include / native.h
1 /*
2  *    This Cplant(TM) source code is the property of Sandia National
3  *    Laboratories.
4  *
5  *    This Cplant(TM) source code is copyrighted by Sandia National
6  *    Laboratories.
7  *
8  *    The redistribution of this Cplant(TM) source code is subject to the
9  *    terms of the GNU Lesser General Public License
10  *    (see cit/LGPL or http://www.gnu.org/licenses/lgpl.html)
11  *
12  *    Cplant(TM) Copyright 1998-2004 Sandia Corporation. 
13  *    Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
14  *    license for use of this work by or on behalf of the US Government.
15  *    Export of this program may require a license from the United States
16  *    Government.
17  */
18
19 /*
20  * This library is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU Lesser General Public
22  * License as published by the Free Software Foundation; either
23  * version 2.1 of the License, or (at your option) any later version.
24  * 
25  * This library is distributed in the hope that it will be useful,
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28  * Lesser General Public License for more details.
29  * 
30  * You should have received a copy of the GNU Lesser General Public
31  * License along with this library; if not, write to the Free Software
32  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
33  *
34  * Questions or comments about this library should be sent to:
35  *
36  * Lee Ward
37  * Sandia National Laboratories, New Mexico
38  * P.O. Box 5800
39  * Albuquerque, NM 87185-1110
40  *
41  * lee@sandia.gov
42  */
43
44 /*
45  * Native file system support.
46  */
47
48 #if ALPHA_LINUX
49
50 /*
51  * stat struct from asm/stat.h, as returned 
52  * by alpha linux kernel
53  */
54 struct _sysio_native_stat {
55         unsigned int    st_dev;
56         unsigned int    st_ino;
57         unsigned int    st_mode;
58         unsigned int    st_nlink;
59         unsigned int    st_uid;
60         unsigned int    st_gid;
61         unsigned int    st_rdev;
62         long            st_size;
63         unsigned long   st_atime;
64         unsigned long   st_mtime;
65         unsigned long   st_ctime;
66         unsigned int    st_blksize;
67         int             st_blocks;
68         unsigned int    st_flags;
69         unsigned int    st_gen;
70 };
71
72 #define SYSIO_COPY_STAT(src, dest)                    \
73 do {                                            \
74         memset((dest), 0, sizeof((*dest)));     \
75         (dest)->st_dev     = (src)->st_dev;     \
76         (dest)->st_ino     = (src)->st_ino;     \
77         (dest)->st_mode    = (src)->st_mode;    \
78         (dest)->st_nlink   = (src)->st_nlink;   \
79         (dest)->st_uid     = (src)->st_uid;     \
80         (dest)->st_gid     = (src)->st_gid;     \
81         (dest)->st_rdev    = (src)->st_rdev;    \
82         (dest)->st_size    = (src)->st_size;    \
83         (dest)->st_atime   = (src)->st_atime;   \
84         (dest)->st_mtime   = (src)->st_mtime;   \
85         (dest)->st_ctime   = (src)->st_ctime;   \
86         (dest)->st_blksize = (src)->st_blksize; \
87         (dest)->st_blocks  = (src)->st_blocks;  \
88         (dest)->st_flags   = (src)->st_flags;   \
89         (dest)->st_gen     = (src)->st_gen;     \
90 } while (0)
91
92 #else 
93 #define _sysio_native_stat intnl_stat
94 #define SYSIO_COPY_STAT(src, dest) *(dest) = *(src) 
95 #endif
96
97 /*
98  * System calls.
99  */
100 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_lstat64)
101 #define SYSIO_SYS_stat          SYS_lstat64
102 #elif defined(SYS_lstat)
103 #define SYSIO_SYS_stat          SYS_lstat
104 #endif
105 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_fstat64)
106 #define SYSIO_SYS_fstat         SYS_fstat64
107 #elif defined(SYS_fstat)
108 #define SYSIO_SYS_fstat         SYS_fstat
109 #endif
110 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_truncate64)
111 #define SYSIO_SYS_truncate      SYS_truncate64
112 #elif defined(SYS_truncate)
113 #define SYSIO_SYS_truncate      SYS_truncate
114 #endif
115 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_ftruncate64)
116 #define SYSIO_SYS_ftruncate     SYS_ftruncate64
117 #elif defined(SYS_ftruncate)
118 #define SYSIO_SYS_ftruncate     SYS_ftruncate
119 #endif
120 #if defined(SYS_open)
121 #define SYSIO_SYS_open          SYS_open
122 #endif
123 #if defined(SYS_close)
124 #define SYSIO_SYS_close         SYS_close
125 #endif
126 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_lseek64)
127 #define SYSIO_SYS_lseek         SYS_lseek64
128 #elif defined(SYS_lseek)
129 #define SYSIO_SYS_lseek         SYS_lseek
130 #endif
131 #if defined(SYS__llseek)
132 # if defined (__mips64__)
133 #  define SYSIO_SYS__llseek     SYS_O32__llseek
134 # else
135 #  define SYSIO_SYS__llseek     SYS__llseek
136 # endif
137 #endif
138 #if defined(SYS_read)
139 #define SYSIO_SYS_read          SYS_read
140 #endif
141 #if defined(SYS_write)
142 #define SYSIO_SYS_write         SYS_write
143 #endif
144 #if defined(SYS_readv)
145 #define SYSIO_SYS_readv         SYS_readv
146 #endif
147 #if defined(SYS_writev)
148 #define SYSIO_SYS_writev        SYS_writev
149 #endif
150 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_pread64)
151 #define SYSIO_SYS_pread         SYS_pread64
152 #elif defined(SYS_pread)
153 #define SYSIO_SYS_pread         SYS_pread
154 #endif
155 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_pwrite64)
156 #define SYSIO_SYS_pwrite        SYS_pwrite64
157 #elif defined(SYS_pwrite)
158 #define SYSIO_SYS_pwrite        SYS_pwrite
159 #endif
160 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_fcntl64)
161 #define SYSIO_SYS_fcntl         SYS_fcntl64
162 #elif defined(SYS_fcntl)
163 #define SYSIO_SYS_fcntl         SYS_fcntl
164 #endif
165 #if defined(SYS_fsync)
166 #define SYSIO_SYS_fsync         SYS_fsync
167 #endif
168 #if defined(ALPHA_LINUX) && defined(SYS_osf_fdatasync)
169 #define SYSIO_SYS_fdatasync     SYS_osf_fdatasync
170 #elif defined(SYS_fdatasync)
171 #define SYSIO_SYS_fdatasync     SYS_fdatasync
172 #endif
173 #if defined(SYS_chmod)
174 #define SYSIO_SYS_chmod         SYS_chmod
175 #endif
176 #if defined(SYS_fchmod)
177 #define SYSIO_SYS_fchmod        SYS_fchmod
178 #endif
179 #if defined(SYS_chown)
180 #define SYSIO_SYS_chown         SYS_chown
181 #endif
182 #if defined(SYS_fchown)
183 #define SYSIO_SYS_fchown        SYS_fchown
184 #endif
185 #if defined(SYS_umask)
186 #define SYSIO_SYS_umask         SYS_umask
187 #endif
188 #if defined(SYS_mkdir)
189 #define SYSIO_SYS_mkdir         SYS_mkdir
190 #endif
191 #if defined(SYS_rmdir)
192 #define SYSIO_SYS_rmdir         SYS_rmdir
193 #endif
194 #if defined(SYS_getdirentries)
195 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_getdirentries64)
196 #define SYSIO_SYS_getdirentries SYS_getdirentries64
197 #elif defined(SYS_getdirentries)
198 #define SYSIO_SYS_getdirentries SYS_getdirentries
199 #endif
200 #endif
201 #if defined(_LARGEFILE64_SOURCE) && defined(SYS_getdents64)
202 # define SYSIO_SYS_getdents64   SYS_getdents64
203 #elif defined(SYS_getdents)
204 # if defined (__mips64__)
205 #  define SYSIO_SYS_getdents64  SYS_getdents
206 # else
207 #  define SYSIO_SYS_getdents    SYS_getdents
208 # endif
209 #endif
210 #if defined(SYS_link)
211 #define SYSIO_SYS_link          SYS_link
212 #endif
213 #if defined(SYS_unlink)
214 #define SYSIO_SYS_unlink        SYS_unlink
215 #endif
216 #if defined(SYS_symlink)
217 #define SYSIO_SYS_symlink       SYS_symlink
218 #endif
219 #if defined(SYS_rename)
220 #define SYSIO_SYS_rename        SYS_rename
221 #endif
222 #if defined(SYS_readlink)
223 #define SYSIO_SYS_readlink      SYS_readlink
224 #endif
225 #if defined(SYS_utimes)
226 #define SYSIO_SYS_utimes        SYS_utimes
227 #endif
228 #if defined(SYS_utime)
229 #define SYSIO_SYS_utime         SYS_utime
230 #endif
231 #if defined(SYS_socketcall)
232 # if defined (__mips64__)
233 #  define SYSIO_SYS_socketcall  SYS_O32_socketcall
234 # else
235 #  define SYSIO_SYS_socketcall  SYS_socketcall
236 # endif
237 #endif
238 #if defined(SYS_socket)
239 #define SYSIO_SYS_socket        SYS_socket
240 #endif
241 #if defined(SYS_accept)
242 #define SYSIO_SYS_accept        SYS_accept
243 #endif
244 #if defined(SYS_bind)
245 #define SYSIO_SYS_bind          SYS_bind
246 #endif
247 #if defined(SYS_listen)
248 #define SYSIO_SYS_listen        SYS_listen
249 #endif
250 #if defined(SYS_connect)
251 #define SYSIO_SYS_connect       SYS_connect
252 #endif
253 #if defined(SYS_ioctl)
254 #define SYSIO_SYS_ioctl         SYS_ioctl
255 #endif