]>
Commit | Line | Data |
---|---|---|
1 | // SPDX-License-Identifier: GPL-2.0 | |
2 | /* | |
3 | * Copyright (c) 2003-2005 Silicon Graphics, Inc. | |
4 | * All Rights Reserved. | |
5 | */ | |
6 | ||
7 | #include "xfs.h" | |
8 | #include "libfrog/paths.h" | |
9 | ||
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) | |
16 | #define IO_ONCE ( 2) | |
17 | ||
18 | /* | |
19 | * File descriptor options | |
20 | */ | |
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) | |
29 | #define IO_NONBLOCK (1<<8) | |
30 | #define IO_TMPFILE (1<<9) | |
31 | #define IO_PATH (1<<10) | |
32 | #define IO_NOFOLLOW (1<<11) | |
33 | ||
34 | /* undergoing atomic update, do not close */ | |
35 | #define IO_ATOMICUPDATE (1<<12) | |
36 | ||
37 | /* | |
38 | * Regular file I/O control | |
39 | */ | |
40 | typedef struct fileio { | |
41 | int fd; /* open file descriptor */ | |
42 | int flags; /* flags describing file state */ | |
43 | char *name; /* file name at time of open */ | |
44 | struct xfs_fsop_geom geom; /* XFS filesystem geometry */ | |
45 | struct fs_path fs_path; /* XFS path information */ | |
46 | } fileio_t; | |
47 | ||
48 | extern fileio_t *filetable; /* open file table */ | |
49 | extern int filecount; /* number of open files */ | |
50 | extern fileio_t *file; /* active file in file table */ | |
51 | extern int filelist_f(void); | |
52 | extern int stat_f(int argc, char **argv); | |
53 | /* | |
54 | * Memory mapped file regions | |
55 | */ | |
56 | typedef struct mmap_region { | |
57 | void *addr; /* address of start of mapping */ | |
58 | size_t length; /* length of mapping */ | |
59 | off_t offset; /* start offset into backing file */ | |
60 | int prot; /* protection mode of the mapping */ | |
61 | int flags; /* MAP_* flags passed to mmap() */ | |
62 | char *name; /* name of backing file */ | |
63 | } mmap_region_t; | |
64 | ||
65 | extern mmap_region_t *maptable; /* mmap'd region array */ | |
66 | extern int mapcount; /* #entries in the mapping table */ | |
67 | extern mmap_region_t *mapping; /* active mapping table entry */ | |
68 | extern int maplist_f(void); | |
69 | extern void *check_mapping_range(mmap_region_t *, off_t, size_t, int); | |
70 | ||
71 | /* | |
72 | * Various xfs_io helper routines/globals | |
73 | */ | |
74 | ||
75 | extern off_t filesize(void); | |
76 | extern int openfile(char *, struct xfs_fsop_geom *, int, mode_t, | |
77 | struct fs_path *); | |
78 | extern int addfile(char *, int , struct xfs_fsop_geom *, int, | |
79 | struct fs_path *); | |
80 | extern int closefile(void); | |
81 | extern void printxattr(uint, int, int, const char *, int, int); | |
82 | ||
83 | extern unsigned int recurse_all; | |
84 | extern unsigned int recurse_dir; | |
85 | ||
86 | extern void *io_buffer; | |
87 | extern size_t io_buffersize; | |
88 | extern int vectors; | |
89 | extern struct iovec *iov; | |
90 | extern int alloc_buffer(size_t, int, unsigned int); | |
91 | extern int read_buffer(int, off_t, long long, long long *, | |
92 | int, int); | |
93 | extern void dump_buffer(off_t, ssize_t); | |
94 | ||
95 | extern void attr_init(void); | |
96 | extern void bmap_init(void); | |
97 | extern void encrypt_init(void); | |
98 | extern void file_init(void); | |
99 | extern void flink_init(void); | |
100 | extern void freeze_init(void); | |
101 | extern void fsuuid_init(void); | |
102 | extern void fsync_init(void); | |
103 | extern void getrusage_init(void); | |
104 | extern void help_init(void); | |
105 | extern void imap_init(void); | |
106 | extern void inject_init(void); | |
107 | extern void label_init(void); | |
108 | extern void mmap_init(void); | |
109 | extern void open_init(void); | |
110 | extern void parent_init(void); | |
111 | extern void pread_init(void); | |
112 | extern void prealloc_init(void); | |
113 | extern void pwrite_init(void); | |
114 | extern void quit_init(void); | |
115 | extern void resblks_init(void); | |
116 | extern void seek_init(void); | |
117 | extern void shutdown_init(void); | |
118 | extern void stat_init(void); | |
119 | extern void swapext_init(void); | |
120 | extern void sync_init(void); | |
121 | extern void truncate_init(void); | |
122 | extern void utimes_init(void); | |
123 | extern void fadvise_init(void); | |
124 | extern void sendfile_init(void); | |
125 | extern void madvise_init(void); | |
126 | extern void mincore_init(void); | |
127 | extern void fiemap_init(void); | |
128 | ||
129 | #ifdef HAVE_COPY_FILE_RANGE | |
130 | extern void copy_range_init(void); | |
131 | #else | |
132 | #define copy_range_init() do { } while (0) | |
133 | #endif | |
134 | ||
135 | #ifdef HAVE_CACHESTAT | |
136 | extern void cachestat_init(void); | |
137 | #else | |
138 | #define cachestat_init() do { } while (0) | |
139 | #endif | |
140 | ||
141 | extern void sync_range_init(void); | |
142 | extern void readdir_init(void); | |
143 | extern void reflink_init(void); | |
144 | extern void cowextsize_init(void); | |
145 | ||
146 | #ifdef HAVE_GETFSMAP | |
147 | extern void fsmap_init(void); | |
148 | #else | |
149 | # define fsmap_init() do { } while (0) | |
150 | #endif | |
151 | ||
152 | #ifdef HAVE_DEVMAPPER | |
153 | extern void log_writes_init(void); | |
154 | #else | |
155 | #define log_writes_init() do { } while (0) | |
156 | #endif | |
157 | ||
158 | extern void scrub_init(void); | |
159 | extern void repair_init(void); | |
160 | extern void crc32cselftest_init(void); | |
161 | extern void bulkstat_init(void); | |
162 | void exchangerange_init(void); | |
163 | void fsprops_init(void); | |
164 | void aginfo_init(void); |