]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/io.h
2 * Copyright (c) 2003-2005 Silicon Graphics, Inc.
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.
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.
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
23 * Read/write patterns (default is always "forward")
25 #define IO_RANDOM ( 0)
26 #define IO_FORWARD ( 1)
27 #define IO_BACKWARD (-1)
31 * File descriptor options
33 #define IO_READONLY (1<<0)
34 #define IO_DIRECT (1<<1)
35 #define IO_REALTIME (1<<2)
36 #define IO_APPEND (1<<3)
37 #define IO_OSYNC (1<<4)
38 #define IO_CREAT (1<<5)
39 #define IO_TRUNC (1<<6)
40 #define IO_FOREIGN (1<<7)
41 #define IO_NONBLOCK (1<<8)
42 #define IO_TMPFILE (1<<9)
43 #define IO_PATH (1<<10)
44 #define IO_NOFOLLOW (1<<11)
47 * Regular file I/O control
49 typedef struct fileio
{
50 int fd
; /* open file descriptor */
51 int flags
; /* flags describing file state */
52 char *name
; /* file name at time of open */
53 xfs_fsop_geom_t geom
; /* XFS filesystem geometry */
54 struct fs_path fs_path
; /* XFS path information */
57 extern fileio_t
*filetable
; /* open file table */
58 extern int filecount
; /* number of open files */
59 extern fileio_t
*file
; /* active file in file table */
60 extern int filelist_f(void);
61 extern int stat_f(int argc
, char **argv
);
63 * Memory mapped file regions
65 typedef struct mmap_region
{
66 void *addr
; /* address of start of mapping */
67 size_t length
; /* length of mapping */
68 off64_t offset
; /* start offset into backing file */
69 int prot
; /* protection mode of the mapping */
70 bool map_sync
; /* is this a MAP_SYNC mapping? */
71 char *name
; /* name of backing file */
74 extern mmap_region_t
*maptable
; /* mmap'd region array */
75 extern int mapcount
; /* #entries in the mapping table */
76 extern mmap_region_t
*mapping
; /* active mapping table entry */
77 extern int maplist_f(void);
78 extern void *check_mapping_range(mmap_region_t
*, off64_t
, size_t, int);
81 * Various xfs_io helper routines/globals
84 extern off64_t
filesize(void);
85 extern int openfile(char *, xfs_fsop_geom_t
*, int, mode_t
,
87 extern int addfile(char *, int , xfs_fsop_geom_t
*, int,
89 extern void printxattr(uint
, int, int, const char *, int, int);
91 extern unsigned int recurse_all
;
92 extern unsigned int recurse_dir
;
95 extern size_t buffersize
;
97 extern struct iovec
*iov
;
98 extern int alloc_buffer(size_t, int, unsigned int);
99 extern int read_buffer(int, off64_t
, long long, long long *,
101 extern void dump_buffer(off64_t
, ssize_t
);
103 extern void attr_init(void);
104 extern void bmap_init(void);
105 extern void encrypt_init(void);
106 extern void file_init(void);
107 extern void flink_init(void);
108 extern void freeze_init(void);
109 extern void fsync_init(void);
110 extern void getrusage_init(void);
111 extern void help_init(void);
112 extern void imap_init(void);
113 extern void inject_init(void);
114 extern void label_init(void);
115 extern void mmap_init(void);
116 extern void open_init(void);
117 extern void parent_init(void);
118 extern void pread_init(void);
119 extern void prealloc_init(void);
120 extern void pwrite_init(void);
121 extern void quit_init(void);
122 extern void seek_init(void);
123 extern void shutdown_init(void);
124 extern void stat_init(void);
125 extern void swapext_init(void);
126 extern void sync_init(void);
127 extern void truncate_init(void);
128 extern void utimes_init(void);
131 extern void fadvise_init(void);
133 #define fadvise_init() do { } while (0)
137 extern void resblks_init(void);
139 #define resblks_init() do { } while (0)
143 extern void sendfile_init(void);
145 #define sendfile_init() do { } while (0)
149 extern void madvise_init(void);
151 #define madvise_init() do { } while (0)
155 extern void mincore_init(void);
157 #define mincore_init() do { } while (0)
161 extern void fiemap_init(void);
163 #define fiemap_init() do { } while (0)
166 #ifdef HAVE_COPY_FILE_RANGE
167 extern void copy_range_init(void);
169 #define copy_range_init() do { } while (0)
172 #ifdef HAVE_SYNC_FILE_RANGE
173 extern void sync_range_init(void);
175 #define sync_range_init() do { } while (0)
179 extern void readdir_init(void);
181 #define readdir_init() do { } while (0)
184 extern void reflink_init(void);
186 extern void cowextsize_init(void);
189 extern void fsmap_init(void);
191 # define fsmap_init() do { } while (0)
194 #ifdef HAVE_DEVMAPPER
195 extern void log_writes_init(void);
197 #define log_writes_init() do { } while (0)
200 extern void scrub_init(void);