]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - io/io.h
xfs_io: implement 'copy_range' command
[thirdparty/xfsprogs-dev.git] / io / io.h
CommitLineData
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 */
45typedef 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
52extern fileio_t *filetable; /* open file table */
53extern int filecount; /* number of open files */
54extern fileio_t *file; /* active file in file table */
55extern int filelist_f(void);
56
57/*
58 * Memory mapped file regions
59 */
60typedef 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
68extern mmap_region_t *maptable; /* mmap'd region array */
69extern int mapcount; /* #entries in the mapping table */
70extern mmap_region_t *mapping; /* active mapping table entry */
71extern int maplist_f(void);
0bba1a49 72extern 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
78extern off64_t filesize(void);
79extern int openfile(char *, xfs_fsop_geom_t *, int, mode_t);
80extern int addfile(char *, int , xfs_fsop_geom_t *, int);
2ac030ae 81extern void printxattr(uint, int, int, const char *, int, int);
48c46ee3 82
3d93ccb7
NS
83extern unsigned int recurse_all;
84extern unsigned int recurse_dir;
85
48c46ee3 86extern void *buffer;
2c2f6d79 87extern size_t buffersize;
10899f17
DC
88extern int vectors;
89extern struct iovec *iov;
2c2f6d79 90extern int alloc_buffer(size_t, int, unsigned int);
48c46ee3
NS
91extern int read_buffer(int, off64_t, long long, long long *,
92 int, int);
93extern void dump_buffer(off64_t, ssize_t);
0bba1a49 94
2ac030ae 95extern void attr_init(void);
0bba1a49
NS
96extern void bmap_init(void);
97extern void file_init(void);
aa210c4d 98extern void flink_init(void);
0bba1a49
NS
99extern void freeze_init(void);
100extern void fsync_init(void);
5c7bef67 101extern void getrusage_init(void);
0bba1a49 102extern void help_init(void);
9527f2d5 103extern void imap_init(void);
0bba1a49
NS
104extern void inject_init(void);
105extern void mmap_init(void);
106extern void open_init(void);
74043ab2 107extern void parent_init(void);
0bba1a49
NS
108extern void pread_init(void);
109extern void prealloc_init(void);
110extern void pwrite_init(void);
111extern void quit_init(void);
b169249b 112extern void seek_init(void);
3f071c2d 113extern void shutdown_init(void);
c7dd81c7 114extern void sync_init(void);
0bba1a49
NS
115extern void truncate_init(void);
116
117#ifdef HAVE_FADVISE
118extern void fadvise_init(void);
119#else
120#define fadvise_init() do { } while (0)
121#endif
122
0bba1a49
NS
123#ifdef HAVE_RESBLKS
124extern void resblks_init(void);
125#else
126#define resblks_init() do { } while (0)
127#endif
128
129#ifdef HAVE_SENDFILE
130extern void sendfile_init(void);
131#else
132#define sendfile_init() do { } while (0)
133#endif
134
0bba1a49
NS
135#ifdef HAVE_MADVISE
136extern void madvise_init(void);
137#else
138#define madvise_init() do { } while (0)
139#endif
140
141#ifdef HAVE_MINCORE
142extern void mincore_init(void);
143#else
144#define mincore_init() do { } while (0)
145#endif
8f0e0912
CH
146
147#ifdef HAVE_FIEMAP
148extern 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
154extern 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
160extern void sync_range_init(void);
161#else
162#define sync_range_init() do { } while (0)
163#endif
3bc05641
BF
164
165#ifdef HAVE_READDIR
166extern void readdir_init(void);
167#else
168#define readdir_init() do { } while (0)
169#endif
bb8aab66
DW
170
171extern void reflink_init(void);