Use xfs.h rather than libxfs.h
[xfstests-dev.git] / src / iopat.c
1 /*
2  * Copyright (c) 2000-2003 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include <fcntl.h>
20 #include <sys/ioctl.h>
21 #include <xfs/xfs.h>
22 struct xfs_flock64 f;
23
24 int main(int argc, char **argv)
25 {
26    int fd, i;
27
28    int64_t x[131072];
29
30    for (i = 0; i < 131072; i++) {
31       x[i] = -1;
32    }
33    fd = open(argv[1], O_RDWR | O_CREAT, 0644);
34
35 #ifdef WRITE
36    f.l_whence = 0;
37    f.l_start = 0;
38    f.l_len = 1048576;
39    xfsctl (argv[1], fd, XFS_IOC_RESVSP, &f);
40    for (i = 0; i < 131072; i++) {
41       x[i] = i;
42    }
43    write(fd, &x, 1048576);
44 #endif
45
46 #ifdef READ
47    read(fd, &x, 1048576);
48    for (i = 0; i < 131072; i++) {
49       if (x[i] != i) {
50          printf("error: %d %d %d\n",i,8*i,x[i]);
51          exit(1);
52       }
53    }
54 #endif
55
56    close(fd);
57 }
58