summaryrefslogtreecommitdiff
path: root/source4/torture/locktest.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-04-21 17:58:23 -0400
committerSimo Sorce <idra@samba.org>2008-04-21 18:12:33 -0400
commit4e83011f72ba3df387512755a17760b42a7bf2f2 (patch)
tree8870bc1bf9181d3ed732db64324307fe533a07d6 /source4/torture/locktest.c
parent8a3e3391fb82c2ee8ef67dbded753d6fad564827 (diff)
downloadsamba-4e83011f72ba3df387512755a17760b42a7bf2f2.tar.gz
Remove more event_context_init() uses from function calls within deep down the code.
Make sure we pass around the event_context where we need it instead. All test but a few python ones fail. Jelmer promised to fix them. (This used to be commit 3045d391626fba169aa26be52174883e18d323e9)
Diffstat (limited to 'source4/torture/locktest.c')
-rw-r--r--source4/torture/locktest.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/source4/torture/locktest.c b/source4/torture/locktest.c
index 618568acf9f..8959232edb6 100644
--- a/source4/torture/locktest.c
+++ b/source4/torture/locktest.c
@@ -19,6 +19,7 @@
#include "includes.h"
#include "lib/cmdline/popt_common.h"
+#include "lib/events/events.h"
#include "system/filesys.h"
#include "system/time.h"
#include "pstring.h"
@@ -107,7 +108,8 @@ static struct record *recorded;
/*****************************************************
return a connection to a server
*******************************************************/
-static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
+static struct smbcli_state *connect_one(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
char *share, int snum, int conn)
{
struct smbcli_state *c;
@@ -162,7 +164,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
share, NULL,
servers[snum],
lp_resolve_context(lp_ctx),
- NULL, &options);
+ ev, &options);
if (!NT_STATUS_IS_OK(status)) {
sleep(2);
}
@@ -176,7 +178,8 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
}
-static void reconnect(struct loadparm_context *lp_ctx,
+static void reconnect(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
char *share[NSERVERS])
{
@@ -193,7 +196,7 @@ static void reconnect(struct loadparm_context *lp_ctx,
}
talloc_free(cli[server][conn]);
}
- cli[server][conn] = connect_one(lp_ctx, share[server],
+ cli[server][conn] = connect_one(ev, lp_ctx, share[server],
server, conn);
if (!cli[server][conn]) {
DEBUG(0,("Failed to connect to %s\n", share[server]));
@@ -396,7 +399,9 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
we then do random locking ops in tamdem on the 4 fnums from each
server and ensure that the results match
*/
-static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
+static int test_locks(struct event_context *ev,
+ struct loadparm_context *lp_ctx,
+ char *share[NSERVERS])
{
struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
int fnum[NSERVERS][NCONNECTIONS][NFILES];
@@ -447,7 +452,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
#endif
}
- reconnect(lp_ctx, cli, fnum, share);
+ reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
n = retest(cli, fnum, numops);
@@ -465,7 +470,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
n1 = n;
close_files(cli, fnum);
- reconnect(lp_ctx, cli, fnum, share);
+ reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
for (i=0;i<n-skip;i+=skip) {
@@ -503,7 +508,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
}
close_files(cli, fnum);
- reconnect(lp_ctx, cli, fnum, share);
+ reconnect(ev, lp_ctx, cli, fnum, share);
open_files(cli, fnum);
showall = true;
n1 = retest(cli, fnum, n);
@@ -543,6 +548,7 @@ static void usage(poptContext pc)
int opt;
int seed, server;
int username_count=0;
+ struct event_context *ev;
struct loadparm_context *lp_ctx;
poptContext pc;
int argc_new, i;
@@ -631,12 +637,14 @@ static void usage(poptContext pc)
servers[1] = servers[0];
}
+ ev = event_context_init(talloc_autofree_context());
+
gensec_init(lp_ctx);
DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n",
seed, lock_base, lock_range, min_length));
srandom(seed);
- return test_locks(lp_ctx, share);
+ return test_locks(ev, lp_ctx, share);
}