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  *
24  * $Id: defs.h,v 1.5 2008/02/14 08:22:22 subrata_modak Exp $
25  * $Log: defs.h,v $
26  * Revision 1.5  2008/02/14 08:22:22  subrata_modak
27  * Disktest application update to version 1.4.2, by, Brent Yardley <yardleyb@us.ibm.com>
28  *
29  * Revision 1.5  2006/04/21 23:10:43  yardleyb
30  * Major updates for v1_3_3 of disktest.  View README for details.
31  *
32  * Revision 1.4  2005/10/12 23:13:35  yardleyb
33  * Updates to code to support new function in disktest version 1.3.x.
34  * Actual changes are recorded in the README
35  *
36  * Revision 1.3  2002/03/30 01:32:14  yardleyb
37  * Major Changes:
38  *
39  * Added Dumping routines for
40  * data miscompares,
41  *
42  * Updated performance output
43  * based on command line.  Gave
44  * one decimal in MB/s output.
45  *
46  * Rewrote -pL IO routine to show
47  * correct stats.  Now show pass count
48  * when using -C.
49  *
50  * Minor Changes:
51  *
52  * Code cleanup to remove the plethera
53  * if #ifdef for windows/unix functional
54  * differences.
55  *
56  * Revision 1.2  2002/02/21 19:37:34  yardleyb
57  * Added license and header info
58  *
59  * Revision 1.1  2001/12/04 18:52:33  yardleyb
60  * Checkin of new source files and removal
61  * of outdated source
62  *
63  */
64 #ifndef _DEFS_H
65 #define _DEFS_H 1
66 
67 #include "sys/types.h"
68 
69 #ifdef WINDOWS
70 #include <windows.h>
71 #define ALLOC(size) HeapAlloc(GetProcessHeap(), 0, size)
72 #define RESIZE(mem, size) HeapReAlloc(GetProcessHeap(), 0, mem, size)
73 #define FREE(mem) HeapFree(GetProcessHeap(), 0, mem)
74 #define GETPID()	_getpid()
75 #define GETLASTERROR() GetLastError()
76 #define INVALID_FD(fd) (fd == INVALID_HANDLE_VALUE)
77 
78 typedef __int64 OFF_T;
79 typedef int pid_t;
80 
81 #else
82 #include <stdlib.h>
83 #define ALLOC(size) malloc(size)
84 #define RESIZE(mem, size) realloc(mem, size)
85 #define FREE(mem) free(mem)
86 
87 #define GETPID()	getpid()
88 #define GETLASTERROR() errno
89 #define INVALID_FD(fd) (fd == -1)
90 
91 #define TRUE 1
92 #define FALSE 0
93 
94 typedef int BOOL;
95 typedef void * HANDLE;
96 
97 /* typedef off_t OFF_T; */
98 typedef long long int OFF_T;
99 
100 #endif /* WINDOWS */
101 
102 typedef enum op {
103 	WRITER,READER,NONE,RETRY
104 } op_t;
105 
106 typedef struct action {
107 	op_t    oper;
108 	unsigned long trsiz;
109 	OFF_T   lba;
110 } action_t;
111 
112 #endif /* _DEFS_H */
113 
114 
115