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 2 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, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /* This file links against either fileio.c to do operations against a
21 local filesystem (making dbench), or sockio.c to issue SMB-like
22 command packets over a socket (making tbench).
24 So, the pattern of operations and the control structure is the same
25 for both benchmarks, but the operations performed are different.
30 char *client_filename = DATADIR "client_oplocks.txt";
33 FILE * open_client_dump(void)
37 if ((f = fopen(client_filename, "rt")) != NULL)
41 "dbench: error opening %s: %s\n", client_filename,
47 #define ival(s) strtol(s, NULL, 0)
49 void child_run(struct child_struct *child)
59 sprintf(cname,"client%d", child->id);
61 f = open_client_dump();
67 while (fgets(line, sizeof(line)-1, f)) {
70 all_string_sub(line,"client1", cname);
71 all_string_sub(line,"\\", "/");
72 all_string_sub(line," /", " ");
74 /* parse the command parameters */
75 params[0] = strtok(line," \n");
77 while (params[i]) params[++i] = strtok(NULL," \n");
82 if (!strcmp(params[0],"NTCreateX")) {
83 nb_createx(child, params[1], ival(params[2]), ival(params[3]),
85 } else if (!strcmp(params[0],"Close")) {
86 nb_close(child, ival(params[1]));
87 } else if (!strcmp(params[0],"Rename")) {
88 nb_rename(child, params[1], params[2]);
89 } else if (!strcmp(params[0],"Unlink")) {
90 nb_unlink(child, params[1]);
91 } else if (!strcmp(params[0],"Rmdir")) {
92 nb_rmdir(child, params[1]);
93 } else if (!strcmp(params[0],"QUERY_PATH_INFORMATION")) {
94 nb_qpathinfo(child, params[1]);
95 } else if (!strcmp(params[0],"QUERY_FILE_INFORMATION")) {
96 nb_qfileinfo(child, ival(params[1]));
97 } else if (!strcmp(params[0],"QUERY_FS_INFORMATION")) {
98 nb_qfsinfo(child, ival(params[1]));
99 } else if (!strcmp(params[0],"FIND_FIRST")) {
100 nb_findfirst(child, params[1]);
101 } else if (!strcmp(params[0],"WriteX")) {
102 nb_writex(child, ival(params[1]),
103 ival(params[2]), ival(params[3]), ival(params[4]));
104 } else if (!strcmp(params[0],"ReadX")) {
105 nb_readx(child, ival(params[1]),
106 ival(params[2]), ival(params[3]), ival(params[4]));
107 } else if (!strcmp(params[0],"Flush")) {
108 nb_flush(child, ival(params[1]));
110 printf("Unknown operation %s\n", params[0]);