r23183: Check in a change made by Tridge:
[sfrench/samba-autobuild/.git] / source / torture / locktest2.c
index 97844b5609ecfbea1ad374ab0862d453079592f4..184c84be439a4ab98246534ffe719fe490db8385 100644 (file)
@@ -18,8 +18,6 @@
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#define NO_SYSLOG
-
 #include "includes.h"
 
 static fstring password;
@@ -31,6 +29,9 @@ static BOOL analyze;
 static BOOL hide_unlock_fails;
 static BOOL use_oplocks;
 
+extern char *optarg;
+extern int optind;
+
 #define FILENAME "\\locktest.dat"
 #define LOCKRANGE 100
 #define LOCKBASE 0
@@ -135,12 +136,13 @@ static BOOL try_unlock(struct cli_state *c, int fstype,
        return False;
 }      
 
-static void print_brl(SMB_DEV_T dev, SMB_INO_T ino, int pid, 
+static void print_brl(struct file_id id, struct server_id pid, 
                      enum brl_type lock_type,
+                     enum brl_flavour lock_flav,
                      br_off start, br_off size)
 {
-       printf("%6d   %05x:%05x    %s  %.0f:%.0f(%.0f)\n", 
-              (int)pid, (int)dev, (int)ino, 
+       printf("%6d   %s    %s  %.0f:%.0f(%.0f)\n", 
+              (int)procid_to_pid(&pid), file_id_static_string(&id),
               lock_type==READ_LOCK?"R":"W",
               (double)start, (double)start+size-1,(double)size);
 
@@ -173,11 +175,11 @@ static struct cli_state *connect_one(char *share)
                }
        }
 
-       slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
+       slprintf(myname,sizeof(myname), "lock-%lu-%u", (unsigned long)getpid(), count++);
 
        nt_status = cli_full_connection(&c, myname, server_n, NULL, 0, share, "?????", 
                                        username, lp_workgroup(), password, 0,
-                                       NULL);
+                                       Undefined, NULL);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("cli_full_connection failed with error %s\n", nt_errstr(nt_status)));
@@ -373,7 +375,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
        ZERO_STRUCT(fnum);
        ZERO_STRUCT(cli);
 
-       recorded = (struct record *)malloc(sizeof(*recorded) * numops);
+       recorded = SMB_MALLOC_ARRAY(struct record, numops);
 
        for (n=0; n<numops; n++) {
                recorded[n].conn = random() % NCONNECTIONS;
@@ -472,8 +474,6 @@ static void usage(void)
  int main(int argc,char *argv[])
 {
        char *share1, *share2, *nfspath1, *nfspath2;
-       extern char *optarg;
-       extern int optind;
        int opt;
        char *p;
        int seed;
@@ -500,7 +500,7 @@ static void usage(void)
        argc -= 4;
        argv += 4;
 
-       lp_load(dyn_CONFIGFILE,True,False,False);
+       lp_load(dyn_CONFIGFILE,True,False,False,True);
        load_interfaces();
 
        if (getenv("USER")) {