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 (!strncmp(params[0],"SMB", 3)) {
83 printf("ERROR: You are using a dbench 1 load file\n");
87 if (!strcmp(params[0],"NTCreateX")) {
88 nb_createx(child, params[1], ival(params[2]), ival(params[3]),
90 } else if (!strcmp(params[0],"Close")) {
91 nb_close(child, ival(params[1]));
92 } else if (!strcmp(params[0],"Rename")) {
93 nb_rename(child, params[1], params[2]);
94 } else if (!strcmp(params[0],"Unlink")) {
95 nb_unlink(child, params[1]);
96 } else if (!strcmp(params[0],"Deltree")) {
97 nb_deltree(child, params[1]);
98 } else if (!strcmp(params[0],"Rmdir")) {
99 nb_rmdir(child, params[1]);
100 } else if (!strcmp(params[0],"QUERY_PATH_INFORMATION")) {
101 nb_qpathinfo(child, params[1]);
102 } else if (!strcmp(params[0],"QUERY_FILE_INFORMATION")) {
103 nb_qfileinfo(child, ival(params[1]));
104 } else if (!strcmp(params[0],"QUERY_FS_INFORMATION")) {
105 nb_qfsinfo(child, ival(params[1]));
106 } else if (!strcmp(params[0],"FIND_FIRST")) {
107 nb_findfirst(child, params[1]);
108 } else if (!strcmp(params[0],"WriteX")) {
109 nb_writex(child, ival(params[1]),
110 ival(params[2]), ival(params[3]), ival(params[4]));
111 } else if (!strcmp(params[0],"ReadX")) {
112 nb_readx(child, ival(params[1]),
113 ival(params[2]), ival(params[3]), ival(params[4]));
114 } else if (!strcmp(params[0],"Flush")) {
115 nb_flush(child, ival(params[1]));
117 printf("Unknown operation %s\n", params[0]);