]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blame - io/io.h
Improve the statistics reporting for xfs_io.
[thirdparty/xfsprogs-dev.git] / io / io.h
CommitLineData
48c46ee3 1/*
5c7bef67 2 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All Rights Reserved.
48c46ee3
NS
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write the Free Software Foundation, Inc., 59
21 * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31 */
32
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
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
NS
82
83extern void *buffer;
84extern ssize_t buffersize;
85extern int alloc_buffer(ssize_t, int, unsigned int);
86extern int read_buffer(int, off64_t, long long, long long *,
87 int, int);
88extern void dump_buffer(off64_t, ssize_t);
0bba1a49 89
2ac030ae 90extern void attr_init(void);
0bba1a49
NS
91extern void bmap_init(void);
92extern void file_init(void);
93extern void freeze_init(void);
94extern void fsync_init(void);
5c7bef67 95extern void getrusage_init(void);
0bba1a49
NS
96extern void help_init(void);
97extern void inject_init(void);
98extern void mmap_init(void);
99extern void open_init(void);
100extern void pread_init(void);
101extern void prealloc_init(void);
102extern void pwrite_init(void);
103extern void quit_init(void);
104extern void truncate_init(void);
105
106#ifdef HAVE_FADVISE
107extern void fadvise_init(void);
108#else
109#define fadvise_init() do { } while (0)
110#endif
111
112#ifdef HAVE_INJECT
113extern void inject_init(void);
114#else
115#define inject_init() do { } while (0)
116#endif
117
118#ifdef HAVE_RESBLKS
119extern void resblks_init(void);
120#else
121#define resblks_init() do { } while (0)
122#endif
123
124#ifdef HAVE_SENDFILE
125extern void sendfile_init(void);
126#else
127#define sendfile_init() do { } while (0)
128#endif
129
130#ifdef HAVE_SHUTDOWN
131extern void shutdown_init(void);
132#else
133#define shutdown_init() do { } while (0)
134#endif
135
136#ifdef HAVE_MADVISE
137extern void madvise_init(void);
138#else
139#define madvise_init() do { } while (0)
140#endif
141
142#ifdef HAVE_MINCORE
143extern void mincore_init(void);
144#else
145#define mincore_init() do { } while (0)
146#endif
147