1 /* 2 * Disktest 3 * Copyright (c) International Business Machines Corp., 2001 4 * 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 19 * 20 * Please send e-mail to yardleyb@us.ibm.com if you have 21 * questions or comments. 22 * 23 * Project Website: TBD 24 * 25 * $Id: io.h,v 1.5 2008/02/14 08:22:23 subrata_modak Exp $ 26 * 27 */ 28 #ifndef IO_H_ 29 #define IO_H_ 1 30 31 #ifdef WINDOWS 32 #include <windows.h> /* HANDLE */ 33 #endif 34 35 #include "defs.h" 36 37 #ifdef PPC 38 #ifdef LINUX 39 /* for linux on power 2.4 O_DIRECT is only defined in asm/fcntl.h */ 40 #ifndef O_DIRECT 41 #define O_DIRECT 0400000 42 #endif 43 #endif 44 #endif 45 46 #ifdef WINDOWS 47 #define CLOSE(fd) CloseHandle(fd) 48 typedef HANDLE fd_t; 49 #else 50 #include <stdio.h> 51 #define CLOSE(fd) close(fd) 52 typedef int fd_t; 53 #endif 54 55 fd_t Open(const char *, const OFF_T); 56 OFF_T Seek(fd_t, OFF_T); 57 OFF_T SeekEnd(fd_t); 58 long Write(fd_t, const void *, const unsigned long); 59 long Read(fd_t, void *, const unsigned long); 60 int Sync (fd_t); 61 62 #endif /* IO_H_ */ 63 64