summaryrefslogtreecommitdiff
path: root/source4/torture/raw/pingpong.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/torture/raw/pingpong.c')
-rwxr-xr-xsource4/torture/raw/pingpong.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/source4/torture/raw/pingpong.c b/source4/torture/raw/pingpong.c
index 027034275a..2e9de28d67 100755
--- a/source4/torture/raw/pingpong.c
+++ b/source4/torture/raw/pingpong.c
@@ -37,10 +37,10 @@
over and over until it completes.
reading from the file can be enabled with
- --option=torture:read=True
+ --option=torture:read=true
writing to the file can be enabled with
- --option=torture:write=True
+ --option=torture:write=true
*/
#include "includes.h"
@@ -50,11 +50,9 @@
#include "system/filesys.h"
#include "libcli/libcli.h"
#include "torture/util.h"
+#include "param/param.h"
-
-
-
-void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout)
+static void lock_byte(struct smbcli_state *cli, int fd, int offset, int lock_timeout)
{
union smb_lock io;
struct smb_lock_entry lock;
@@ -92,7 +90,7 @@ try_again:
}
}
-void unlock_byte(struct smbcli_state *cli, int fd, int offset)
+static void unlock_byte(struct smbcli_state *cli, int fd, int offset)
{
union smb_lock io;
struct smb_lock_entry lock;
@@ -119,7 +117,7 @@ void unlock_byte(struct smbcli_state *cli, int fd, int offset)
}
}
-void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
+static void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
{
union smb_write io;
NTSTATUS status;
@@ -139,7 +137,7 @@ void write_byte(struct smbcli_state *cli, int fd, uint8_t c, int offset)
}
}
-void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
+static void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
{
union smb_read io;
NTSTATUS status;
@@ -150,7 +148,7 @@ void read_byte(struct smbcli_state *cli, int fd, uint8_t *c, int offset)
io.readx.in.maxcnt = 1;
io.readx.in.offset = offset;
io.readx.in.remaining = 0;
- io.readx.in.read_for_execute = False;
+ io.readx.in.read_for_execute = false;
io.readx.out.data = c;
status = smb_raw_read(cli->tree, &io);
@@ -178,13 +176,13 @@ static double end_timer(void)
/*
ping pong
*/
-BOOL torture_ping_pong(struct torture_context *torture)
+bool torture_ping_pong(struct torture_context *torture)
{
const char *fn;
int num_locks;
TALLOC_CTX *mem_ctx = talloc_new(torture);
- static BOOL do_reads;
- static BOOL do_writes;
+ static bool do_reads;
+ static bool do_writes;
int lock_timeout;
int fd;
struct smbcli_state *cli;
@@ -193,21 +191,21 @@ BOOL torture_ping_pong(struct torture_context *torture)
uint8_t *val;
int count, loops;
- fn = lp_parm_string(-1, "torture", "filename");
+ fn = lp_parm_string(global_loadparm, NULL, "torture", "filename");
if (fn == NULL) {
DEBUG(0,("You must specify the filename using --option=torture:filename=...\n"));
return false;
}
- num_locks = lp_parm_int(-1, "torture", "num_locks", -1);
+ num_locks = lp_parm_int(global_loadparm, NULL, "torture", "num_locks", -1);
if (num_locks == -1) {
DEBUG(0,("You must specify num_locks using --option=torture:num_locks=...\n"));
return false;
}
- do_reads = lp_parm_bool(-1, "torture", "read", False);
- do_writes = lp_parm_bool(-1, "torture", "write", False);
- lock_timeout = lp_parm_int(-1, "torture", "lock_timeout", 100000);
+ do_reads = lp_parm_bool(global_loadparm, NULL, "torture", "read", false);
+ do_writes = lp_parm_bool(global_loadparm, NULL, "torture", "write", false);
+ lock_timeout = lp_parm_int(global_loadparm, NULL, "torture", "lock_timeout", 100000);
if (!torture_open_connection(&cli, 0)) {
DEBUG(0,("Could not open connection\n"));