1f08c3bdfSopenharmony_ci/* 2f08c3bdfSopenharmony_ci * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 3f08c3bdfSopenharmony_ci * 4f08c3bdfSopenharmony_ci * This program is free software; you can redistribute it and/or modify it 5f08c3bdfSopenharmony_ci * under the terms of version 2 of the GNU General Public License as 6f08c3bdfSopenharmony_ci * published by the Free Software Foundation. 7f08c3bdfSopenharmony_ci * 8f08c3bdfSopenharmony_ci * This program is distributed in the hope that it would be useful, but 9f08c3bdfSopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 10f08c3bdfSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11f08c3bdfSopenharmony_ci * 12f08c3bdfSopenharmony_ci * Further, this software is distributed without any warranty that it is 13f08c3bdfSopenharmony_ci * free of the rightful claim of any third person regarding infringement 14f08c3bdfSopenharmony_ci * or the like. Any license provided herein, whether implied or 15f08c3bdfSopenharmony_ci * otherwise, applies only to this software file. Patent licenses, if 16f08c3bdfSopenharmony_ci * any, provided herein do not apply to combinations of this program with 17f08c3bdfSopenharmony_ci * other software, or any other product whatsoever. 18f08c3bdfSopenharmony_ci * 19f08c3bdfSopenharmony_ci * You should have received a copy of the GNU General Public License along 20f08c3bdfSopenharmony_ci * with this program; if not, write the Free Software Foundation, Inc., 21f08c3bdfSopenharmony_ci * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22f08c3bdfSopenharmony_ci * 23f08c3bdfSopenharmony_ci * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, 24f08c3bdfSopenharmony_ci * Mountain View, CA 94043, or: 25f08c3bdfSopenharmony_ci * 26f08c3bdfSopenharmony_ci * http://www.sgi.com 27f08c3bdfSopenharmony_ci * 28f08c3bdfSopenharmony_ci * For further information regarding this notice, see: 29f08c3bdfSopenharmony_ci * 30f08c3bdfSopenharmony_ci * http://oss.sgi.com/projects/GenInfo/NoticeExplan/ 31f08c3bdfSopenharmony_ci */ 32f08c3bdfSopenharmony_ci 33f08c3bdfSopenharmony_ci#define LIO_IO_SYNC 00001 /* read/write */ 34f08c3bdfSopenharmony_ci#define LIO_IO_ASYNC 00002 /* reada/writea/aio_write/aio_read */ 35f08c3bdfSopenharmony_ci#define LIO_IO_SLISTIO 00004 /* single stride sync listio */ 36f08c3bdfSopenharmony_ci#define LIO_IO_ALISTIO 00010 /* single stride async listio */ 37f08c3bdfSopenharmony_ci#define LIO_IO_SYNCV 00020 /* single-buffer readv/writev */ 38f08c3bdfSopenharmony_ci#define LIO_IO_SYNCP 00040 /* pread/pwrite */ 39f08c3bdfSopenharmony_ci 40f08c3bdfSopenharmony_ci#ifdef sgi 41f08c3bdfSopenharmony_ci#define LIO_IO_ATYPES 00077 /* all io types */ 42f08c3bdfSopenharmony_ci#define LIO_IO_TYPES 00061 /* all io types, non-async */ 43f08c3bdfSopenharmony_ci#endif /* sgi */ 44f08c3bdfSopenharmony_ci#if defined(__linux__) && !defined(__UCLIBC__) 45f08c3bdfSopenharmony_ci#define LIO_IO_TYPES 00061 /* all io types */ 46f08c3bdfSopenharmony_ci#define LIO_IO_ATYPES 00077 /* all io types */ 47f08c3bdfSopenharmony_ci#endif 48f08c3bdfSopenharmony_ci#if defined(__sun) || defined(__hpux) || defined(_AIX) || defined(__UCLIBC__) 49f08c3bdfSopenharmony_ci#define LIO_IO_TYPES 00021 /* all io types except pread/pwrite */ 50f08c3bdfSopenharmony_ci#endif /* linux */ 51f08c3bdfSopenharmony_ci#ifdef CRAY 52f08c3bdfSopenharmony_ci#define LIO_IO_TYPES 00017 /* all io types */ 53f08c3bdfSopenharmony_ci#endif /* CRAY */ 54f08c3bdfSopenharmony_ci 55f08c3bdfSopenharmony_ci#ifndef LIO_IO_ATYPES 56f08c3bdfSopenharmony_ci#define LIO_IO_ATYPES LIO_IO_TYPES 57f08c3bdfSopenharmony_ci#endif 58f08c3bdfSopenharmony_ci 59f08c3bdfSopenharmony_ci#define LIO_WAIT_NONE 00010000 /* return asap -- use with care */ 60f08c3bdfSopenharmony_ci#define LIO_WAIT_ACTIVE 00020000 /* spin looking at iosw fields, or EINPROGRESS */ 61f08c3bdfSopenharmony_ci#define LIO_WAIT_RECALL 00040000 /* call recall(2)/aio_suspend(3) */ 62f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGPAUSE 00100000 /* call pause */ 63f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGACTIVE 00200000 /* spin waiting for signal */ 64f08c3bdfSopenharmony_ci#if defined(sgi) || defined(__linux__) 65f08c3bdfSopenharmony_ci#define LIO_WAIT_CBSUSPEND 00400000 /* aio_suspend waiting for callback */ 66f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGSUSPEND 01000000 /* aio_suspend waiting for signal */ 67f08c3bdfSopenharmony_ci#define LIO_WAIT_ATYPES 01760000 /* all async wait types, except nowait */ 68f08c3bdfSopenharmony_ci#define LIO_WAIT_TYPES 00020000 /* all sync wait types (sorta) */ 69f08c3bdfSopenharmony_ci#endif /* sgi */ 70f08c3bdfSopenharmony_ci#if defined(__sun) || defined(__hpux) || defined(_AIX) 71f08c3bdfSopenharmony_ci#define LIO_WAIT_TYPES 00300000 /* all wait types, except nowait */ 72f08c3bdfSopenharmony_ci#endif /* linux */ 73f08c3bdfSopenharmony_ci#ifdef CRAY 74f08c3bdfSopenharmony_ci#define LIO_WAIT_TYPES 00360000 /* all wait types, except nowait */ 75f08c3bdfSopenharmony_ci#endif /* CRAY */ 76f08c3bdfSopenharmony_ci 77f08c3bdfSopenharmony_ci/* meta wait io */ 78f08c3bdfSopenharmony_ci/* 00 000 0000 */ 79f08c3bdfSopenharmony_ci 80f08c3bdfSopenharmony_ci#if defined(sgi) || defined(__linux__) 81f08c3bdfSopenharmony_ci/* all callback wait types */ 82f08c3bdfSopenharmony_ci#define LIO_WAIT_CBTYPES (LIO_WAIT_CBSUSPEND) 83f08c3bdfSopenharmony_ci/* all signal wait types */ 84f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE|LIO_WAIT_SIGSUSPEND) 85f08c3bdfSopenharmony_ci/* all aio_{read,write} or lio_listio */ 86f08c3bdfSopenharmony_ci#define LIO_IO_ASYNC_TYPES (LIO_IO_ASYNC|LIO_IO_SLISTIO|LIO_IO_ALISTIO) 87f08c3bdfSopenharmony_ci#endif /* sgi */ 88f08c3bdfSopenharmony_ci#if defined(__sun) || defined(__hpux) || defined(_AIX) 89f08c3bdfSopenharmony_ci/* all signal wait types */ 90f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE) 91f08c3bdfSopenharmony_ci#endif /* linux */ 92f08c3bdfSopenharmony_ci#ifdef CRAY 93f08c3bdfSopenharmony_ci/* all signal wait types */ 94f08c3bdfSopenharmony_ci#define LIO_WAIT_SIGTYPES (LIO_WAIT_SIGPAUSE|LIO_WAIT_SIGACTIVE) 95f08c3bdfSopenharmony_ci#endif /* CRAY */ 96f08c3bdfSopenharmony_ci 97f08c3bdfSopenharmony_ci/* 98f08c3bdfSopenharmony_ci * This bit provides a way to randomly pick an io type and wait method. 99f08c3bdfSopenharmony_ci * lio_read_buffer() and lio_write_buffer() functions will call 100f08c3bdfSopenharmony_ci * lio_random_methods() with the given method. 101f08c3bdfSopenharmony_ci */ 102f08c3bdfSopenharmony_ci#define LIO_RANDOM 010000000 103f08c3bdfSopenharmony_ci 104f08c3bdfSopenharmony_ci/* 105f08c3bdfSopenharmony_ci * This bit provides a way for the programmer to use async i/o with 106f08c3bdfSopenharmony_ci * signals and to use their own signal handler. By default, 107f08c3bdfSopenharmony_ci * the signal will only be given to the system call if the wait 108f08c3bdfSopenharmony_ci * method is LIO_WAIT_SIGPAUSE or LIO_WAIT_SIGACTIVE. 109f08c3bdfSopenharmony_ci * Whenever these wait methods are used, libio signal handler 110f08c3bdfSopenharmony_ci * will be used. 111f08c3bdfSopenharmony_ci */ 112f08c3bdfSopenharmony_ci#define LIO_USE_SIGNAL 020000000 113f08c3bdfSopenharmony_ci 114f08c3bdfSopenharmony_ci/* 115f08c3bdfSopenharmony_ci * prototypes/structures for functions in the libio.c module. See comments 116f08c3bdfSopenharmony_ci * in that module, or man page entries for information on the individual 117f08c3bdfSopenharmony_ci * functions. 118f08c3bdfSopenharmony_ci */ 119f08c3bdfSopenharmony_ci 120f08c3bdfSopenharmony_ciint stride_bounds(int offset, int stride, int nstrides, 121f08c3bdfSopenharmony_ci int bytes_per_stride, int *min_byte, int *max_byte); 122f08c3bdfSopenharmony_ci 123f08c3bdfSopenharmony_ciint lio_set_debug(int level); 124f08c3bdfSopenharmony_ciint lio_parse_io_arg1(char *string); 125f08c3bdfSopenharmony_civoid lio_help1(char *prefex); 126f08c3bdfSopenharmony_ciint lio_parse_io_arg2(char *string, char **badtoken); 127f08c3bdfSopenharmony_civoid lio_help2(char *prefex); 128f08c3bdfSopenharmony_ciint lio_write_buffer(int fd, int method, char *buffer, int size, 129f08c3bdfSopenharmony_ci int sig, char **errmsg, long wrd); 130f08c3bdfSopenharmony_ci 131f08c3bdfSopenharmony_ciint lio_read_buffer(int fd, int method, char *buffer, int size, 132f08c3bdfSopenharmony_ci int sig, char **errmsg, long wrd); 133f08c3bdfSopenharmony_ciint lio_random_methods(long mask); 134f08c3bdfSopenharmony_ci 135f08c3bdfSopenharmony_ci#if CRAY 136f08c3bdfSopenharmony_ci#include <sys/iosw.h> 137f08c3bdfSopenharmony_ciint lio_wait4asyncio(int method, int fd, struct iosw **statptr); 138f08c3bdfSopenharmony_ciint lio_check_asyncio(char *io_type, int size, struct iosw *status); 139f08c3bdfSopenharmony_ci#endif /* CRAY */ 140f08c3bdfSopenharmony_ci#if defined (sgi) 141f08c3bdfSopenharmony_ci#include <aio.h> 142f08c3bdfSopenharmony_ciint lio_wait4asyncio(int method, int fd, aiocb_t *aiocbp); 143f08c3bdfSopenharmony_ciint lio_check_asyncio(char *io_type, int size, aiocb_t *aiocbp, int method); 144f08c3bdfSopenharmony_ci#endif /* sgi */ 145f08c3bdfSopenharmony_ci#if defined(__linux__) && !defined(__UCLIBC__) 146f08c3bdfSopenharmony_ci#include <aio.h> 147f08c3bdfSopenharmony_ciint lio_wait4asyncio(int method, int fd, struct aiocb *aiocbp); 148f08c3bdfSopenharmony_ciint lio_check_asyncio(char *io_type, int size, struct aiocb *aiocbp, int method); 149f08c3bdfSopenharmony_ci#endif 150f08c3bdfSopenharmony_ci 151f08c3bdfSopenharmony_ci/* 152f08c3bdfSopenharmony_ci * Define the structure that contains the infomation that is used 153f08c3bdfSopenharmony_ci * by the parsing and help functions. 154f08c3bdfSopenharmony_ci */ 155f08c3bdfSopenharmony_cistruct lio_info_type { 156f08c3bdfSopenharmony_ci char *token; 157f08c3bdfSopenharmony_ci int bits; 158f08c3bdfSopenharmony_ci char *desc; 159f08c3bdfSopenharmony_ci}; 160f08c3bdfSopenharmony_ci 161f08c3bdfSopenharmony_ci 162