]>
Commit | Line | Data |
---|---|---|
48c46ee3 | 1 | /* |
da23017d NS |
2 | * Copyright (c) 2003-2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
48c46ee3 | 4 | * |
da23017d NS |
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 | |
48c46ee3 NS |
7 | * published by the Free Software Foundation. |
8 | * | |
da23017d NS |
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. | |
48c46ee3 | 13 | * |
da23017d NS |
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 | |
48c46ee3 NS |
17 | */ |
18 | ||
dcabd4e7 CH |
19 | #include "xfs.h" |
20 | ||
8fb2237e NS |
21 | /* |
22 | * Read/write patterns (default is always "forward") | |
23 | */ | |
24 | #define IO_RANDOM ( 0) | |
25 | #define IO_FORWARD ( 1) | |
26 | #define IO_BACKWARD (-1) | |
27 | ||
28 | /* | |
29 | * File descriptor options | |
30 | */ | |
48c46ee3 NS |
31 | #define IO_READONLY (1<<0) |
32 | #define IO_DIRECT (1<<1) | |
33 | #define IO_REALTIME (1<<2) | |
34 | #define IO_APPEND (1<<3) | |
35 | #define IO_OSYNC (1<<4) | |
36 | #define IO_CREAT (1<<5) | |
37 | #define IO_TRUNC (1<<6) | |
38 | #define IO_FOREIGN (1<<7) | |
57f46ec0 | 39 | #define IO_NONBLOCK (1<<8) |
da2b3c09 | 40 | #define IO_TMPFILE (1<<9) |
48c46ee3 NS |
41 | |
42 | /* | |
43 | * Regular file I/O control | |
44 | */ | |
45 | typedef struct fileio { | |
46 | int fd; /* open file descriptor */ | |
47 | int flags; /* flags describing file state */ | |
48 | char *name; /* file name at time of open */ | |
49 | xfs_fsop_geom_t geom; /* XFS filesystem geometry */ | |
50 | } fileio_t; | |
51 | ||
52 | extern fileio_t *filetable; /* open file table */ | |
53 | extern int filecount; /* number of open files */ | |
54 | extern fileio_t *file; /* active file in file table */ | |
55 | extern int filelist_f(void); | |
56 | ||
57 | /* | |
58 | * Memory mapped file regions | |
59 | */ | |
60 | typedef struct mmap_region { | |
61 | void *addr; /* address of start of mapping */ | |
62 | size_t length; /* length of mapping */ | |
63 | off64_t offset; /* start offset into backing file */ | |
64 | int prot; /* protection mode of the mapping */ | |
65 | char *name; /* name of backing file */ | |
66 | } mmap_region_t; | |
67 | ||
68 | extern mmap_region_t *maptable; /* mmap'd region array */ | |
69 | extern int mapcount; /* #entries in the mapping table */ | |
70 | extern mmap_region_t *mapping; /* active mapping table entry */ | |
71 | extern int maplist_f(void); | |
0bba1a49 | 72 | extern void *check_mapping_range(mmap_region_t *, off64_t, size_t, int); |
48c46ee3 NS |
73 | |
74 | /* | |
75 | * Various xfs_io helper routines/globals | |
76 | */ | |
77 | ||
78 | extern off64_t filesize(void); | |
79 | extern int openfile(char *, xfs_fsop_geom_t *, int, mode_t); | |
80 | extern int addfile(char *, int , xfs_fsop_geom_t *, int); | |
2ac030ae | 81 | extern void printxattr(uint, int, int, const char *, int, int); |
48c46ee3 | 82 | |
3d93ccb7 NS |
83 | extern unsigned int recurse_all; |
84 | extern unsigned int recurse_dir; | |
85 | ||
48c46ee3 | 86 | extern void *buffer; |
2c2f6d79 | 87 | extern size_t buffersize; |
10899f17 DC |
88 | extern int vectors; |
89 | extern struct iovec *iov; | |
2c2f6d79 | 90 | extern int alloc_buffer(size_t, int, unsigned int); |
48c46ee3 NS |
91 | extern int read_buffer(int, off64_t, long long, long long *, |
92 | int, int); | |
93 | extern void dump_buffer(off64_t, ssize_t); | |
0bba1a49 | 94 | |
2ac030ae | 95 | extern void attr_init(void); |
0bba1a49 NS |
96 | extern void bmap_init(void); |
97 | extern void file_init(void); | |
aa210c4d | 98 | extern void flink_init(void); |
0bba1a49 NS |
99 | extern void freeze_init(void); |
100 | extern void fsync_init(void); | |
5c7bef67 | 101 | extern void getrusage_init(void); |
0bba1a49 | 102 | extern void help_init(void); |
9527f2d5 | 103 | extern void imap_init(void); |
0bba1a49 NS |
104 | extern void inject_init(void); |
105 | extern void mmap_init(void); | |
106 | extern void open_init(void); | |
74043ab2 | 107 | extern void parent_init(void); |
0bba1a49 NS |
108 | extern void pread_init(void); |
109 | extern void prealloc_init(void); | |
110 | extern void pwrite_init(void); | |
111 | extern void quit_init(void); | |
b169249b | 112 | extern void seek_init(void); |
3f071c2d | 113 | extern void shutdown_init(void); |
c7dd81c7 | 114 | extern void sync_init(void); |
0bba1a49 NS |
115 | extern void truncate_init(void); |
116 | ||
117 | #ifdef HAVE_FADVISE | |
118 | extern void fadvise_init(void); | |
119 | #else | |
120 | #define fadvise_init() do { } while (0) | |
121 | #endif | |
122 | ||
0bba1a49 NS |
123 | #ifdef HAVE_RESBLKS |
124 | extern void resblks_init(void); | |
125 | #else | |
126 | #define resblks_init() do { } while (0) | |
127 | #endif | |
128 | ||
129 | #ifdef HAVE_SENDFILE | |
130 | extern void sendfile_init(void); | |
131 | #else | |
132 | #define sendfile_init() do { } while (0) | |
133 | #endif | |
134 | ||
0bba1a49 NS |
135 | #ifdef HAVE_MADVISE |
136 | extern void madvise_init(void); | |
137 | #else | |
138 | #define madvise_init() do { } while (0) | |
139 | #endif | |
140 | ||
141 | #ifdef HAVE_MINCORE | |
142 | extern void mincore_init(void); | |
143 | #else | |
144 | #define mincore_init() do { } while (0) | |
145 | #endif | |
8f0e0912 CH |
146 | |
147 | #ifdef HAVE_FIEMAP | |
148 | extern void fiemap_init(void); | |
149 | #else | |
150 | #define fiemap_init() do { } while (0) | |
151 | #endif | |
a278c389 | 152 | |
628e112a AS |
153 | #ifdef HAVE_COPY_FILE_RANGE |
154 | extern void copy_range_init(void); | |
155 | #else | |
156 | #define copy_range_init() do { } while (0) | |
157 | #endif | |
158 | ||
a278c389 DC |
159 | #ifdef HAVE_SYNC_FILE_RANGE |
160 | extern void sync_range_init(void); | |
161 | #else | |
162 | #define sync_range_init() do { } while (0) | |
163 | #endif | |
3bc05641 BF |
164 | |
165 | #ifdef HAVE_READDIR | |
166 | extern void readdir_init(void); | |
167 | #else | |
168 | #define readdir_init() do { } while (0) | |
169 | #endif | |
bb8aab66 DW |
170 | |
171 | extern void reflink_init(void); |