Dont rebuild .pot file always, for fresh checkouts it will be readonly
[xfstests-dev.git] / include / tlibio.h
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  * 
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.
7  * 
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.
11  * 
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.
18  * 
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.
22  * 
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  * 
26  * http://www.sgi.com 
27  * 
28  * For further information regarding this notice, see: 
29  * 
30  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
31  */
32
33 #define LIO_IO_SYNC             00001   /* read/write */
34 #define LIO_IO_ASYNC            00002   /* reada/writea/aio_write/aio_read */
35 #define LIO_IO_SLISTIO          00004   /* single stride sync listio */
36 #define LIO_IO_ALISTIO          00010   /* single stride async listio */
37 #define LIO_IO_SYNCV            00020   /* single-buffer readv/writev */
38 #define LIO_IO_SYNCP            00040   /* pread/pwrite */
39
40 #ifdef sgi
41 #define LIO_IO_ATYPES           00077   /* all io types */
42 #define LIO_IO_TYPES            00061   /* all io types, non-async */
43 #endif /* sgi */
44 #ifdef linux
45 #define LIO_IO_TYPES            00021   /* all io types */
46 #endif /* linux */
47 #ifdef CRAY
48 #define LIO_IO_TYPES            00017   /* all io types */
49 #endif /* CRAY */
50
51 #define LIO_WAIT_NONE           00010000 /* return asap -- use with care */
52 #define LIO_WAIT_ACTIVE         00020000 /* spin looking at iosw fields, or EINPROGRESS */
53 #define LIO_WAIT_RECALL         00040000 /* call recall(2)/aio_suspend(3) */
54 #define LIO_WAIT_SIGPAUSE       00100000 /* call pause */
55 #define LIO_WAIT_SIGACTIVE      00200000 /* spin waiting for signal */
56 #ifdef sgi
57 #define LIO_WAIT_CBSUSPEND      00400000 /* aio_suspend waiting for callback */
58 #define LIO_WAIT_SIGSUSPEND     01000000 /* aio_suspend waiting for signal */
59 #define LIO_WAIT_ATYPES         01760000 /* all async wait types, except nowait */
60 #define LIO_WAIT_TYPES          00020000 /* all sync wait types (sorta) */
61 #endif /* sgi */
62 #ifdef linux
63 #define LIO_WAIT_TYPES          00300000 /* all wait types, except nowait */
64 #endif /* linux */
65 #ifdef CRAY
66 #define LIO_WAIT_TYPES          00360000 /* all wait types, except nowait */
67 #endif /* CRAY */
68
69 /* meta wait io  */
70 /*  00  000 0000 */
71
72 #ifdef sgi
73 /* all callback wait types */
74 #define LIO_WAIT_CBTYPES        (LIO_WAIT_CBSUSPEND)
75 /* all signal wait types */
76 #define LIO_WAIT_SIGTYPES       (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND)
77 /* all aio_{read,write} or lio_listio */
78 #define LIO_IO_ASYNC_TYPES      (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO)
79 #endif /* sgi */
80 #ifdef linux
81 /* all signal wait types */
82 #define LIO_WAIT_SIGTYPES       (LIO_WAIT_SIGPAUSE)
83 #endif /* linux */
84 #ifdef CRAY
85 /* all signal wait types */
86 #define LIO_WAIT_SIGTYPES       (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE)
87 #endif /* CRAY */
88
89 /*
90  * This bit provides a way to randomly pick an io type and wait method.
91  * lio_read_buffer() and lio_write_buffer() functions will call
92  * lio_random_methods() with the given method.
93  */
94 #define LIO_RANDOM              010000000
95
96 /*
97  * This bit provides a way for the programmer to use async i/o with
98  * signals and to use their own signal handler.  By default,
99  * the signal will only be given to the system call if the wait
100  * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE.
101  * Whenever these wait methods are used, libio signal handler
102  * will be used.
103  */
104 #define LIO_USE_SIGNAL          020000000
105
106 /*
107  * prototypes/structures for functions in the libio.c module.  See comments
108  * in that module, or man page entries for information on the individual
109  * functions.
110  */
111
112 int  stride_bounds(int offset, int stride, int nstrides,
113                       int bytes_per_stride, int *min_byte, int *max_byte);
114
115 int  lio_set_debug(int level);
116 int  lio_parse_io_arg1(char *string);
117 void lio_help1(char *prefex);
118 int  lio_parse_io_arg2(char *string, char **badtoken);
119 void lio_help2(char *prefex);
120 int  lio_write_buffer(int fd, int method, char *buffer, int size,
121                       int sig, char **errmsg, long wrd);
122
123 int  lio_read_buffer(int fd, int method, char *buffer, int size,
124                      int sig, char **errmsg, long wrd);
125 int  lio_random_methods(long mask);
126
127 #if CRAY
128 #include <sys/iosw.h>
129 int  lio_wait4asyncio(int method, int fd, struct iosw **statptr);
130 int  lio_check_asyncio(char *io_type, int size, struct iosw *status);
131 #endif /* CRAY */
132 #ifdef sgi
133 #include <aio.h>
134 int  lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp);
135 int  lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method);
136 #endif /* sgi */
137
138 /*
139  * Define the structure that contains the infomation that is used
140  * by the parsing and help functions.
141  */
142 struct lio_info_type {
143     char *token;
144     int  bits;
145     char *desc;
146 };
147
148