]>
Commit | Line | Data |
---|---|---|
959ef981 | 1 | // SPDX-License-Identifier: GPL-2.0 |
48c46ee3 | 2 | /* |
da23017d NS |
3 | * Copyright (c) 2003-2005 Silicon Graphics, Inc. |
4 | * All Rights Reserved. | |
48c46ee3 NS |
5 | */ |
6 | ||
dcabd4e7 | 7 | #include "xfs.h" |
42b4c8e8 | 8 | #include "libfrog/paths.h" |
dcabd4e7 | 9 | |
8fb2237e NS |
10 | /* |
11 | * Read/write patterns (default is always "forward") | |
12 | */ | |
13 | #define IO_RANDOM ( 0) | |
14 | #define IO_FORWARD ( 1) | |
15 | #define IO_BACKWARD (-1) | |
43ba1d61 | 16 | #define IO_ONCE ( 2) |
8fb2237e NS |
17 | |
18 | /* | |
19 | * File descriptor options | |
20 | */ | |
48c46ee3 NS |
21 | #define IO_READONLY (1<<0) |
22 | #define IO_DIRECT (1<<1) | |
23 | #define IO_REALTIME (1<<2) | |
24 | #define IO_APPEND (1<<3) | |
25 | #define IO_OSYNC (1<<4) | |
26 | #define IO_CREAT (1<<5) | |
27 | #define IO_TRUNC (1<<6) | |
28 | #define IO_FOREIGN (1<<7) | |
57f46ec0 | 29 | #define IO_NONBLOCK (1<<8) |
da2b3c09 | 30 | #define IO_TMPFILE (1<<9) |
fc52865c DH |
31 | #define IO_PATH (1<<10) |
32 | #define IO_NOFOLLOW (1<<11) | |
48c46ee3 NS |
33 | |
34 | /* | |
35 | * Regular file I/O control | |
36 | */ | |
37 | typedef struct fileio { | |
38 | int fd; /* open file descriptor */ | |
39 | int flags; /* flags describing file state */ | |
40 | char *name; /* file name at time of open */ | |
2668d323 | 41 | struct xfs_fsop_geom geom; /* XFS filesystem geometry */ |
3fcab549 | 42 | struct fs_path fs_path; /* XFS path information */ |
48c46ee3 NS |
43 | } fileio_t; |
44 | ||
45 | extern fileio_t *filetable; /* open file table */ | |
46 | extern int filecount; /* number of open files */ | |
47 | extern fileio_t *file; /* active file in file table */ | |
48 | extern int filelist_f(void); | |
a8cef9f6 | 49 | extern int stat_f(int argc, char **argv); |
48c46ee3 NS |
50 | /* |
51 | * Memory mapped file regions | |
52 | */ | |
53 | typedef struct mmap_region { | |
54 | void *addr; /* address of start of mapping */ | |
55 | size_t length; /* length of mapping */ | |
9e726740 | 56 | off_t offset; /* start offset into backing file */ |
48c46ee3 | 57 | int prot; /* protection mode of the mapping */ |
28965957 | 58 | int flags; /* MAP_* flags passed to mmap() */ |
48c46ee3 NS |
59 | char *name; /* name of backing file */ |
60 | } mmap_region_t; | |
61 | ||
62 | extern mmap_region_t *maptable; /* mmap'd region array */ | |
63 | extern int mapcount; /* #entries in the mapping table */ | |
64 | extern mmap_region_t *mapping; /* active mapping table entry */ | |
65 | extern int maplist_f(void); | |
9e726740 | 66 | extern void *check_mapping_range(mmap_region_t *, off_t, size_t, int); |
48c46ee3 NS |
67 | |
68 | /* | |
69 | * Various xfs_io helper routines/globals | |
70 | */ | |
71 | ||
9e726740 | 72 | extern off_t filesize(void); |
2668d323 | 73 | extern int openfile(char *, struct xfs_fsop_geom *, int, mode_t, |
3fcab549 | 74 | struct fs_path *); |
2668d323 | 75 | extern int addfile(char *, int , struct xfs_fsop_geom *, int, |
3fcab549 | 76 | struct fs_path *); |
2ac030ae | 77 | extern void printxattr(uint, int, int, const char *, int, int); |
48c46ee3 | 78 | |
3d93ccb7 NS |
79 | extern unsigned int recurse_all; |
80 | extern unsigned int recurse_dir; | |
81 | ||
86715ccb ES |
82 | extern void *io_buffer; |
83 | extern size_t io_buffersize; | |
10899f17 DC |
84 | extern int vectors; |
85 | extern struct iovec *iov; | |
2c2f6d79 | 86 | extern int alloc_buffer(size_t, int, unsigned int); |
9e726740 | 87 | extern int read_buffer(int, off_t, long long, long long *, |
48c46ee3 | 88 | int, int); |
9e726740 | 89 | extern void dump_buffer(off_t, ssize_t); |
0bba1a49 | 90 | |
2ac030ae | 91 | extern void attr_init(void); |
0bba1a49 | 92 | extern void bmap_init(void); |
0cf66b0f | 93 | extern void encrypt_init(void); |
0bba1a49 | 94 | extern void file_init(void); |
aa210c4d | 95 | extern void flink_init(void); |
0bba1a49 | 96 | extern void freeze_init(void); |
d9151538 | 97 | extern void fsuuid_init(void); |
0bba1a49 | 98 | extern void fsync_init(void); |
5c7bef67 | 99 | extern void getrusage_init(void); |
0bba1a49 | 100 | extern void help_init(void); |
9527f2d5 | 101 | extern void imap_init(void); |
0bba1a49 | 102 | extern void inject_init(void); |
cfa10b0f | 103 | extern void label_init(void); |
0bba1a49 NS |
104 | extern void mmap_init(void); |
105 | extern void open_init(void); | |
74043ab2 | 106 | extern void parent_init(void); |
0bba1a49 NS |
107 | extern void pread_init(void); |
108 | extern void prealloc_init(void); | |
109 | extern void pwrite_init(void); | |
110 | extern void quit_init(void); | |
c4bd48ef | 111 | extern void resblks_init(void); |
b169249b | 112 | extern void seek_init(void); |
3f071c2d | 113 | extern void shutdown_init(void); |
a8cef9f6 | 114 | extern void stat_init(void); |
57e7138a | 115 | extern void swapext_init(void); |
c7dd81c7 | 116 | extern void sync_init(void); |
0bba1a49 | 117 | extern void truncate_init(void); |
8211d1b5 | 118 | extern void utimes_init(void); |
0bba1a49 | 119 | extern void fadvise_init(void); |
0bba1a49 | 120 | extern void sendfile_init(void); |
0bba1a49 | 121 | extern void madvise_init(void); |
0bba1a49 | 122 | extern void mincore_init(void); |
8f0e0912 | 123 | extern void fiemap_init(void); |
a278c389 | 124 | |
628e112a AS |
125 | #ifdef HAVE_COPY_FILE_RANGE |
126 | extern void copy_range_init(void); | |
127 | #else | |
128 | #define copy_range_init() do { } while (0) | |
129 | #endif | |
130 | ||
a278c389 | 131 | extern void sync_range_init(void); |
3bc05641 | 132 | extern void readdir_init(void); |
bb8aab66 | 133 | extern void reflink_init(void); |
1e51132f | 134 | extern void cowextsize_init(void); |
3fcab549 DW |
135 | |
136 | #ifdef HAVE_GETFSMAP | |
137 | extern void fsmap_init(void); | |
138 | #else | |
139 | # define fsmap_init() do { } while (0) | |
140 | #endif | |
813c67c7 | 141 | |
851c5d11 RZ |
142 | #ifdef HAVE_DEVMAPPER |
143 | extern void log_writes_init(void); | |
144 | #else | |
145 | #define log_writes_init() do { } while (0) | |
146 | #endif | |
147 | ||
813c67c7 | 148 | extern void scrub_init(void); |
bec810e8 | 149 | extern void repair_init(void); |
99a5535c | 150 | extern void crc32cselftest_init(void); |
3c8276c4 | 151 | extern void bulkstat_init(void); |