xref: /dragonfly/test/stress/fsstress/global.h (revision 7d3e9a5b)
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write the Free Software Foundation, Inc., 59
21  * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22  *
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  *
26  * http://www.sgi.com
27  *
28  * For further information regarding this notice, see:
29  *
30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31  */
32 
33 #ifndef GLOBAL_H
34 #define GLOBAL_H
35 
36 /* xfs-specific includes */
37 
38 #ifndef NO_XFS
39 #include <libxfs.h>
40 #include <attributes.h>
41 #else
42 #include <xfscompat.h>
43 #endif
44 
45 /* libc includes */
46 
47 #ifdef __DragonFly__
48 #include <sys/types.h>
49 #include <sys/param.h>
50 #endif
51 #include <sys/stat.h>
52 #ifndef __DragonFly__
53 #include <sys/statvfs.h>
54 #endif
55 #include <sys/time.h>
56 #include <sys/ioctl.h>
57 #include <sys/wait.h>
58 #ifndef __DragonFly__
59 #include <malloc.h>
60 #endif
61 #include <dirent.h>
62 #include <errno.h>
63 #include <stdio.h>
64 #include <stdlib.h>
65 #include <unistd.h>
66 #include <sys/fcntl.h>
67 #include <string.h>
68 #ifndef O_DIRECT
69 #define O_DIRECT        040000
70 #endif
71 
72 #ifdef __DragonFly__
73 typedef off_t	off64_t;
74 #define stat64	stat
75 #define lseek64	lseek
76 #define lstat64	lstat
77 #define fstat64	fstat
78 #define ftruncate64	ftruncate
79 #define truncate64	truncate
80 #define readdir64	readdir
81 
82 static __inline
83 void *
84 memalign(int blksize, int bytes)
85 {
86     void *ptr;
87     int blkmask;
88     static int pagesize;
89 
90     if (pagesize == 0)
91 	pagesize = getpagesize();
92     if (blksize < pagesize)
93 	blksize = pagesize;
94     blkmask = blksize - 1;
95     ptr = malloc((bytes + blkmask) & ~blkmask);
96     bzero(ptr, bytes);
97     return(ptr);
98 }
99 
100 #endif
101 
102 #endif
103 
104