check: exit with exit code 1 after printing the usage message
[xfstests-dev.git] / include / tlibio.h
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2000 Silicon Graphics, Inc.
4  * All Rights Reserved.
5  */
6
7 #define LIO_IO_SYNC             00001   /* read/write */
8 #define LIO_IO_ASYNC            00002   /* reada/writea/aio_write/aio_read */
9 #define LIO_IO_SLISTIO          00004   /* single stride sync listio */
10 #define LIO_IO_ALISTIO          00010   /* single stride async listio */
11 #define LIO_IO_SYNCV            00020   /* single-buffer readv/writev */
12 #define LIO_IO_SYNCP            00040   /* pread/pwrite */
13
14 #ifdef linux
15 #define LIO_IO_TYPES            00021   /* all io types */
16 #endif /* linux */
17
18 #define LIO_WAIT_NONE           00010000 /* return asap -- use with care */
19 #define LIO_WAIT_ACTIVE         00020000 /* spin looking at iosw fields, or EINPROGRESS */
20 #define LIO_WAIT_RECALL         00040000 /* call recall(2)/aio_suspend(3) */
21 #define LIO_WAIT_SIGPAUSE       00100000 /* call pause */
22 #define LIO_WAIT_SIGACTIVE      00200000 /* spin waiting for signal */
23
24 #ifdef linux
25 #define LIO_WAIT_TYPES          00300000 /* all wait types, except nowait */
26 #endif /* linux */
27
28 /* meta wait io  */
29 /*  00  000 0000 */
30
31 #ifdef linux
32 /* all signal wait types */
33 #define LIO_WAIT_SIGTYPES       (LIO_WAIT_SIGPAUSE)
34 #endif /* linux */
35
36 /*
37  * This bit provides a way to randomly pick an io type and wait method.
38  * lio_read_buffer() and lio_write_buffer() functions will call
39  * lio_random_methods() with the given method.
40  */
41 #define LIO_RANDOM              010000000
42
43 /*
44  * This bit provides a way for the programmer to use async i/o with
45  * signals and to use their own signal handler.  By default,
46  * the signal will only be given to the system call if the wait
47  * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE.
48  * Whenever these wait methods are used, libio signal handler
49  * will be used.
50  */
51 #define LIO_USE_SIGNAL          020000000
52
53 /*
54  * prototypes/structures for functions in the libio.c module.  See comments
55  * in that module, or man page entries for information on the individual
56  * functions.
57  */
58
59 int  stride_bounds(int offset, int stride, int nstrides,
60                       int bytes_per_stride, int *min_byte, int *max_byte);
61
62 int  lio_set_debug(int level);
63 int  lio_parse_io_arg1(char *string);
64 void lio_help1(char *prefex);
65 int  lio_parse_io_arg2(char *string, char **badtoken);
66 void lio_help2(char *prefex);
67 int  lio_write_buffer(int fd, int method, char *buffer, int size,
68                       int sig, char **errmsg, long wrd);
69
70 int  lio_read_buffer(int fd, int method, char *buffer, int size,
71                      int sig, char **errmsg, long wrd);
72 int  lio_random_methods(long mask);
73
74 /*
75  * Define the structure that contains the infomation that is used
76  * by the parsing and help functions.
77  */
78 struct lio_info_type {
79     char *token;
80     int  bits;
81     char *desc;
82 };
83
84