]>
git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - io/io.h
2 * Copyright (c) 2003-2005 Silicon Graphics, Inc. All Rights Reserved.
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.
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.
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.
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.
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
28 * For further information regarding this notice, see:
30 * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
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)
43 * Regular file I/O control
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 */
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);
58 * Memory mapped file regions
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 */
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);
72 extern void *check_mapping_range(mmap_region_t
*, off64_t
, size_t, int);
75 * Various xfs_io helper routines/globals
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);
81 extern void printxattr(uint
, int, int, const char *, int, int);
84 extern ssize_t buffersize
;
85 extern int alloc_buffer(ssize_t
, int, unsigned int);
86 extern int read_buffer(int, off64_t
, long long, long long *,
88 extern void dump_buffer(off64_t
, ssize_t
);
90 extern void attr_init(void);
91 extern void bmap_init(void);
92 extern void file_init(void);
93 extern void freeze_init(void);
94 extern void fsync_init(void);
95 extern void getrusage_init(void);
96 extern void help_init(void);
97 extern void inject_init(void);
98 extern void mmap_init(void);
99 extern void open_init(void);
100 extern void pread_init(void);
101 extern void prealloc_init(void);
102 extern void pwrite_init(void);
103 extern void quit_init(void);
104 extern void truncate_init(void);
107 extern void fadvise_init(void);
109 #define fadvise_init() do { } while (0)
113 extern void inject_init(void);
115 #define inject_init() do { } while (0)
119 extern void resblks_init(void);
121 #define resblks_init() do { } while (0)
125 extern void sendfile_init(void);
127 #define sendfile_init() do { } while (0)
131 extern void shutdown_init(void);
133 #define shutdown_init() do { } while (0)
137 extern void madvise_init(void);
139 #define madvise_init() do { } while (0)
143 extern void mincore_init(void);
145 #define mincore_init() do { } while (0)