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