2 * Copyright (c) 2000 Silicon Graphics, Inc.
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 #define LIO_IO_SYNC 00001 /* read/write */
20 #define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */
21 #define LIO_IO_SLISTIO 00004 /* single stride sync listio */
22 #define LIO_IO_ALISTIO 00010 /* single stride async listio */
23 #define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */
24 #define LIO_IO_SYNCP 00040 /* pread/pwrite */
27 #define LIO_IO_ATYPES 00077 /* all io types */
28 #define LIO_IO_TYPES 00061 /* all io types, non-async */
31 #define LIO_IO_TYPES 00021 /* all io types */
34 #define LIO_IO_TYPES 00017 /* all io types */
37 #define LIO_WAIT_NONE 00010000 /* return asap -- use with care */
38 #define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */
39 #define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */
40 #define LIO_WAIT_SIGPAUSE 00100000 /* call pause */
41 #define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */
43 #define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */
44 #define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */
45 #define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */
46 #define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */
49 #define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */
52 #define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */
59 /* all callback wait types */
60 #define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND)
61 /* all signal wait types */
62 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND)
63 /* all aio_{read,write} or lio_listio */
64 #define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO)
67 /* all signal wait types */
68 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE)
71 /* all signal wait types */
72 #define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE)
76 * This bit provides a way to randomly pick an io type and wait method.
77 * lio_read_buffer() and lio_write_buffer() functions will call
78 * lio_random_methods() with the given method.
80 #define LIO_RANDOM 010000000
83 * This bit provides a way for the programmer to use async i/o with
84 * signals and to use their own signal handler. By default,
85 * the signal will only be given to the system call if the wait
86 * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE.
87 * Whenever these wait methods are used, libio signal handler
90 #define LIO_USE_SIGNAL 020000000
93 * prototypes/structures for functions in the libio.c module. See comments
94 * in that module, or man page entries for information on the individual
98 int stride_bounds(int offset, int stride, int nstrides,
99 int bytes_per_stride, int *min_byte, int *max_byte);
101 int lio_set_debug(int level);
102 int lio_parse_io_arg1(char *string);
103 void lio_help1(char *prefex);
104 int lio_parse_io_arg2(char *string, char **badtoken);
105 void lio_help2(char *prefex);
106 int lio_write_buffer(int fd, int method, char *buffer, int size,
107 int sig, char **errmsg, long wrd);
109 int lio_read_buffer(int fd, int method, char *buffer, int size,
110 int sig, char **errmsg, long wrd);
111 int lio_random_methods(long mask);
114 #include <sys/iosw.h>
115 int lio_wait4asyncio(int method, int fd, struct iosw **statptr);
116 int lio_check_asyncio(char *io_type, int size, struct iosw *status);
120 int lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp);
121 int lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method);
125 * Define the structure that contains the infomation that is used
126 * by the parsing and help functions.
128 struct lio_info_type {