3 Copyright (C) Andrew Tridgell 1999
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>.
18 #define _FILE_OFFSET_BITS 64
32 #include <sys/types.h>
33 #include <sys/socket.h>
44 #ifdef HAVE_SYS_STATVFS_H
45 #include <sys/statvfs.h>
48 #include <sys/param.h>
49 #ifdef HAVE_SYS_MOUNT_H
50 #include <sys/mount.h>
58 #include <netinet/in.h>
59 #include <netinet/tcp.h>
63 #include <attr/xattr.h>
64 #elif HAVE_SYS_XATTR_H
65 #include <sys/xattr.h>
66 #elif HAVE_SYS_ATTRIBUTES_H
67 #include <sys/attributes.h>
70 #ifdef HAVE_SYS_EXTATTR_H
71 #include <sys/extattr.h>
79 #define MSG_WAITALL 0x100
85 #define MIN(x,y) ((x)<(y)?(x):(y))
89 #define TCP_OPTIONS "TCP_NODELAY SO_REUSEADDR"
94 #define uint32 unsigned
102 #define ZERO_STRUCT(x) memset(&(x), 0, sizeof(x))
106 struct child_struct {
113 int cleanup_finished;
114 const char *directory;
116 double bytes_done_warmup;
118 double worst_latency;
119 struct timeval starttime;
120 struct timeval lasttime;
121 off_t bytes_since_fsync;
125 struct timeval last_time;
127 struct op ops[MAX_OPS];
142 const char *directory;
147 int clients_per_process;
148 int one_byte_write_fix;
152 int per_client_results;
154 const char *protocol;
156 int allow_scsi_writes;
158 const char *scsi_dev;
159 const char *iscsi_device;
160 const char *iscsi_initiatorname;
161 int machine_readable;
162 const char *smb_share;
163 const char *smb_user;
168 struct child_struct *child;
178 void (*fn)(struct dbench_op *);
181 struct nb_operations {
182 const char *backend_name;
183 struct backend_op *ops;
185 void (*setup)(struct child_struct *child);
186 void (*cleanup)(struct child_struct *child);
188 extern struct nb_operations *nb_ops;
190 /* CreateDisposition field. */
191 #define FILE_SUPERSEDE 0
193 #define FILE_CREATE 2
194 #define FILE_OPEN_IF 3
195 #define FILE_OVERWRITE 4
196 #define FILE_OVERWRITE_IF 5
198 /* CreateOptions field. */
199 #define FILE_DIRECTORY_FILE 0x0001
200 #define FILE_WRITE_THROUGH 0x0002
201 #define FILE_SEQUENTIAL_ONLY 0x0004
202 #define FILE_NON_DIRECTORY_FILE 0x0040
203 #define FILE_NO_EA_KNOWLEDGE 0x0200
204 #define FILE_EIGHT_DOT_THREE_ONLY 0x0400
205 #define FILE_RANDOM_ACCESS 0x0800
206 #define FILE_DELETE_ON_CLOSE 0x1000
209 #define O_DIRECTORY 0200000
216 extern struct options options;
217 extern int global_random;
218 extern char rw_buf[];