windows-torture-test-20060625
[openafs.git] / src / WINNT / tests / torture / include / common.h
1 #ifndef _SCOMMON_H_
2 #define _SCOMMON_H_
3
4 enum states {BM_SETUP, BM_WARMUP, BM_MEASURE};
5
6 #define PSTRING_LEN 2048
7 #define FSTRING_LEN 512
8
9 #define MAX_HANDLES 128
10 #define MAX_FILES 1000
11 #define ssize_t SSIZE_T
12
13 #define aRONLY (1L<<0)          /* 0x01 */
14 #define aHIDDEN (1L<<1)         /* 0x02 */
15 #define aSYSTEM (1L<<2)         /* 0x04 */
16 #define aVOLID (1L<<3)          /* 0x08 */
17 #define aDIR (1L<<4)            /* 0x10 */
18 #define aARCH (1L<<5)           /* 0x20 */
19
20 #define FILE_DIRECTORY_FILE       0x0001
21 #define FILE_WRITE_THROUGH        0x0002
22 #define FILE_SEQUENTIAL_ONLY      0x0004
23 #define FILE_NON_DIRECTORY_FILE   0x0040
24 #define FILE_NO_EA_KNOWLEDGE      0x0200
25 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400
26 #define FILE_RANDOM_ACCESS        0x0800
27 #define FILE_DELETE_ON_CLOSE      0x1000
28
29 #define CMD_CLOSE           0
30 #define CMD_DELTREE         1
31 #define CMD_FIND_FIRST      2
32 //#define CMD_FLUSH           3
33 //#define CMD_LOCKINGX        4
34 #define CMD_NTCREATEX       3
35 #define CMD_QUERY_FILE_INFO 4
36 #define CMD_QUERY_FS_INFO   5
37 #define CMD_QUERY_PATH_INFO 6
38 #define CMD_READX           7
39 #define CMD_RENAME          8
40 #define CMD_RMDIR           9
41 #define CMD_UNLINK          10
42 #define CMD_WRITEX          11
43 #define CMD_XCOPY           12 
44 #define CMD_DELETEFILES     13 
45 #define CMD_COPYFILES       14
46 #define CMD_ATTACH          15
47 #define CMD_DETACH          16
48 #define CMD_MKDIR           17
49 #define CMD_XRMDIR          18
50 #define CMD_SETLOCKER       19
51 #define CMD_CREATEFILE      20
52 #define CMD_MOVE            21
53 #define CMD_NONAFS          22
54 #define CMD_MAX_CMD         23 /* KEEP THIS UP TO DATE! */
55
56 typedef DWORD NTSTATUS;
57
58 typedef char pstring[PSTRING_LEN];
59 typedef char fstring[FSTRING_LEN];
60
61 typedef struct file_info
62 {
63         DWORD mode;
64         time_t mtime;
65         time_t atime;
66         time_t ctime;
67         pstring name;
68 //      char short_name[13*3];
69 } file_info;
70
71 struct cmd_struct {
72   int   count;
73   int   ErrorCount;
74   DWORD ErrorTime;
75   DWORD MilliSeconds;
76   DWORD min_sec;
77   DWORD max_sec;
78   DWORD total_sec;
79   DWORD total_sum_of_squares;
80 };
81
82 static struct 
83 {
84         char *name; /* name used in results */
85         char *disable_name; /* name used in disable (-d) option */
86         unsigned id; /* cmd id */
87     char *ms_api;
88 } cmd_names[] = {
89         {"Close", "CLOSE", CMD_CLOSE, "(CloseHandle)"},
90         {"DelTree", "DELTREE", CMD_DELTREE, "(FindFirstFile/FindNextFile/DeleteFile/RemoveDirectory)"},
91         {"Find First", "FIND_FIRST", CMD_FIND_FIRST, "(FindFirstFile/FindNextFile)"},
92 //      {"Flush", "FLUSH", CMD_FLUSH},
93 //      {"Locking & X", "LOCKINGX", CMD_LOCKINGX},
94         {"NT Create & X", "NTCREATEX", CMD_NTCREATEX, "(CreateFile/CreateDirectory)"},
95         {"Query File Info", "QUERY_FILE_INFO", CMD_QUERY_FILE_INFO, "(GetFileAttributesEx)"},
96         {"Query File System Info", "QUERY_FS_INFO", CMD_QUERY_FS_INFO, "(GetDiskFreeSpaceEx)"},
97         {"Query Path Info", "QUERY_PATH_INFO", CMD_QUERY_PATH_INFO, "(GetFileAttributesEx)"},
98         {"Read & X", "READX", CMD_READX, "(SetFilePointer/ReadFile)"},
99         {"Rename", "RENAME", CMD_RENAME, "(MoveFileEx)"},
100         {"Rmdir", "RMDIR", CMD_RMDIR, "(RemoveDirectory)"},
101         {"Unlink","UNLINK", CMD_UNLINK, "(DeleteFile)"},
102         {"Write & X", "WRITEX", CMD_WRITEX, "(SetFilePointer/WriteFile/FlushFileBuffers)"},
103     {"CopyEx", "XCOPY", CMD_XCOPY, "(DOS xcopy)"},
104     {"DeleteFiles", "DELETEFILES", CMD_DELETEFILES, "(DOS del)"},
105     {"CopyFiles", "COPYFILES", CMD_COPYFILES, "(DOS copy)"},
106     {"Attach", "ATTACH", CMD_ATTACH, "(M.I.T.)"},
107     {"Detach", "DETACH", CMD_DETACH, "(M.I.T.)"},
108     {"Mkdir", "MKDIR", CMD_MKDIR, "(DOS mkdir)"},
109     {"Xrmdir", "XRMDIR", CMD_XRMDIR, "(DOS rmdir)"},
110     {"SetLocker", "SETLOCKER", CMD_SETLOCKER, "(M.I.T.)"},
111     {"CreateFile", "CREATEFILE", CMD_CREATEFILE, "(CreateFile/SetFilePointer/WriteFile/FlushFileBuffers/CloseHandle)"},
112     {"Move", "MOVE", CMD_MOVE, "(DOS move)"},
113     {"NonAFS", "NonAFS", CMD_NONAFS, ""},
114         {NULL, NULL, 0, NULL}
115 };
116
117 typedef struct {
118     int     ExitStatus;
119     char    Reason[1024];
120 } EXIT_STATUS;
121
122 typedef struct {
123         BOOL                PrintStats;
124         BOOL                *child_status_out;
125         int                 AfsTrace;
126         int                 ProcessNumber;
127         int                 BufferSize;
128         int                 CurrentLoop;
129         int                 ProcessID;
130         int                 *pThreadStatus;
131         int                 LogID;
132         struct cmd_struct   *CommandInfo;
133         char                *TargetDirectory;
134         char                *CommandLine;
135         char                *ClientText;
136         char                *PathToSecondDir;
137         char                *AfsLocker;
138         char                *HostName;
139         EXIT_STATUS         *pExitStatus;
140         } PARAMETERLIST;
141
142 typedef struct {
143         int fd;
144         int handle;
145     char *name; 
146         int reads, writes;
147 } FTABLE;
148
149
150 #endif