This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
static fstring username;
static int got_pass;
static int numops = 1000;
-static BOOL showall;
-static BOOL analyze;
-static BOOL hide_unlock_fails;
-static BOOL use_oplocks;
+static bool showall;
+static bool analyze;
+static bool hide_unlock_fails;
+static bool use_oplocks;
#define FILENAME "\\locktest.dat"
#define LOCKRANGE 100
return -1;
}
-static BOOL try_close(struct smbcli_state *c, int fstype, int fd)
+static bool try_close(struct smbcli_state *c, int fstype, int fd)
{
switch (fstype) {
case FSTYPE_SMB:
return close(fd) == 0;
}
- return False;
+ return false;
}
-static BOOL try_lock(struct smbcli_state *c, int fstype,
+static bool try_lock(struct smbcli_state *c, int fstype,
int fd, uint_t start, uint_t len,
enum brl_type op)
{
return fcntl(fd,F_SETLK,&lock) == 0;
}
- return False;
+ return false;
}
-static BOOL try_unlock(struct smbcli_state *c, int fstype,
+static bool try_unlock(struct smbcli_state *c, int fstype,
int fd, uint_t start, uint_t len)
{
struct flock lock;
return fcntl(fd,F_SETLK,&lock) == 0;
}
- return False;
+ return false;
}
/*****************************************************
slprintf(myname,sizeof(myname), "lock-%u-%u", getpid(), count++);
nt_status = smbcli_full_connection(NULL,
- &c, myname, server_n, NULL, 0, share, "?????",
- username, lp_workgroup(), password, 0,
- NULL);
-
+ &c, myname, server_n, 0, share, NULL,
+ username, lp_workgroup(), password, NULL);
if (!NT_STATUS_IS_OK(nt_status)) {
DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
return NULL;
smbcli_close(cli[server][conn], fnum[server][fstype][conn][f]);
}
smbcli_ulogoff(cli[server][conn]);
- smbcli_shutdown(cli[server][conn]);
+ talloc_free(cli[server][conn]);
}
cli[server][conn] = connect_one(share[server]);
if (!cli[server][conn]) {
-static BOOL test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
+static bool test_one(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
char *nfs[NSERVERS],
int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
struct record *rec)
uint_t r2 = rec->r2;
enum brl_type op;
int server;
- BOOL ret[NSERVERS];
+ bool ret[NSERVERS];
if (r1 < READ_PCT) {
op = READ_LOCK;
op==READ_LOCK?"READ_LOCK":"WRITE_LOCK",
ret[0], ret[1]);
}
- if (ret[0] != ret[1]) return False;
+ if (ret[0] != ret[1]) return false;
} else if (r2 < LOCK_PCT+UNLOCK_PCT) {
/* unset a lock */
for (server=0;server<NSERVERS;server++) {
start, start+len-1, len,
ret[0], ret[1]);
}
- if (!hide_unlock_fails && ret[0] != ret[1]) return False;
+ if (!hide_unlock_fails && ret[0] != ret[1]) return false;
} else {
/* reopen the file */
for (server=0;server<NSERVERS;server++) {
O_RDWR|O_CREAT);
if (fnum[server][fstype][conn][f] == -1) {
printf("failed to reopen on share1\n");
- return False;
+ return false;
}
}
if (showall) {
conn, fstype, f);
}
}
- return True;
+ return true;
}
static void close_files(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
recorded[n].len *= RANGE_MULTIPLE;
recorded[n].r1 = random() % 100;
recorded[n].r2 = random() % 100;
- recorded[n].needed = True;
+ recorded[n].needed = true;
}
reconnect(cli, nfs, fnum, share1, share2);
for (i=0;i<n-1;i++) {
int m;
- recorded[i].needed = False;
+ recorded[i].needed = false;
close_files(cli, nfs, fnum);
open_files(cli, nfs, fnum);
m = retest(cli, nfs, fnum, n);
if (m == n) {
- recorded[i].needed = True;
+ recorded[i].needed = true;
} else {
if (i < m) {
memmove(&recorded[i], &recorded[i+1],
close_files(cli, nfs, fnum);
reconnect(cli, nfs, fnum, share1, share2);
open_files(cli, nfs, fnum);
- showall = True;
+ showall = true;
n1 = retest(cli, nfs, fnum, n);
if (n1 != n-1) {
printf("ERROR - inconsistent result (%u %u)\n", n1, n);
int opt;
char *p;
int seed;
+ struct loadparm_context *lp_ctx;
setlinebuf(stdout);
argc -= 4;
argv += 4;
- lp_load(dyn_CONFIGFILE,True,False,False);
- load_interfaces();
+ lp_load(dyn_CONFIGFILE, &lp_ctx);
if (getenv("USER")) {
fstrcpy(username,getenv("USER"));
seed = atoi(optarg);
break;
case 'u':
- hide_unlock_fails = True;
+ hide_unlock_fails = true;
break;
case 'o':
numops = atoi(optarg);
break;
case 'O':
- use_oplocks = True;
+ use_oplocks = true;
break;
case 'a':
- showall = True;
+ showall = true;
break;
case 'A':
- analyze = True;
+ analyze = true;
break;
case 'h':
usage();