added -L switch to tell smbtorture to use oplocks
authorAndrew Tridgell <tridge@samba.org>
Tue, 13 Jun 2000 09:33:43 +0000 (09:33 +0000)
committerAndrew Tridgell <tridge@samba.org>
Tue, 13 Jun 2000 09:33:43 +0000 (09:33 +0000)
(This used to be commit 73033d0803317c7de017cac7f7669f4afb08e7c0)

source3/utils/nbio.c
source3/utils/torture.c

index f72be36842fb48d007fe61761b8acaa9234d9243..973f7d0628a0703173f504be32115f41210fe539 100644 (file)
@@ -50,8 +50,6 @@ static void sigsegv(int sig)
 void nb_setup(struct cli_state *cli)
 {
        signal(SIGSEGV, sigsegv);
-       /* to be like a true Windows client we need to negotiate oplocks */
-       cli->use_oplocks = True;
        c = cli;
 }
 
index aa2737af301da8d041cf8f6e653b22e8c22a87e6..a53ba1ce60904fd86187b5fa95bae2be0b2d985d 100644 (file)
@@ -32,6 +32,7 @@ static int nprocs=1, numops=100;
 static int procnum; /* records process count number when forking */
 static struct cli_state current_cli;
 static fstring randomfname;
+static BOOL use_oplocks;
 
 static double create_procs(void (*fn)(int));
 
@@ -107,6 +108,7 @@ static BOOL open_connection(struct cli_state *c)
        }
 
        c->timeout = 120000; /* set a really long timeout (2 minutes) */
+       if (use_oplocks) c->use_oplocks = True;
 
        if (!cli_session_request(c, &calling, &called)) {
                printf("%s rejected the session\n",host);
@@ -1565,7 +1567,6 @@ static void run_maxfidtest(int dummy)
        fstring fname;
        int fnum;
        int retries=4;
-       int n = numops;
 
        cli = current_cli;
 
@@ -2109,6 +2110,7 @@ static void usage(void)
        printf("\t-o num_operations\n");
        printf("\t-O socket_options\n");
        printf("\t-m maximum protocol\n");
+       printf("\t-L use oplocks\n");
        printf("\n\n");
 
        printf("tests are:");
@@ -2180,7 +2182,7 @@ static void usage(void)
 
        fstrcpy(workgroup, lp_workgroup());
 
-       while ((opt = getopt(argc, argv, "hW:U:n:N:O:o:m:")) != EOF) {
+       while ((opt = getopt(argc, argv, "hW:U:n:N:O:o:m:L")) != EOF) {
                switch (opt) {
                case 'W':
                        fstrcpy(workgroup,optarg);
@@ -2197,6 +2199,9 @@ static void usage(void)
                case 'O':
                        sockops = optarg;
                        break;
+               case 'L':
+                       use_oplocks = True;
+                       break;
                case 'n':
                        fstrcpy(myname, optarg);
                        break;