mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
allow setting of lock range and base in locktest
This commit is contained in:
parent
46b89bc997
commit
97993630ad
@ -31,17 +31,13 @@ static BOOL showall;
|
||||
static BOOL analyze;
|
||||
static BOOL hide_unlock_fails;
|
||||
static BOOL use_oplocks;
|
||||
static unsigned lock_range = 100;
|
||||
static unsigned lock_base = 0;
|
||||
|
||||
#define FILENAME "\\locktest.dat"
|
||||
#define LOCKRANGE 100
|
||||
#define LOCKBASE 0
|
||||
#define MINLENGTH 0
|
||||
|
||||
#define ZERO_ZERO 0
|
||||
|
||||
/*
|
||||
#define LOCKBASE (0x40000000 - 50)
|
||||
*/
|
||||
#define ZERO_ZERO 1
|
||||
|
||||
#define READ_PCT 50
|
||||
#define LOCK_PCT 45
|
||||
@ -416,9 +412,9 @@ static void test_locks(char *share[NSERVERS])
|
||||
#endif
|
||||
recorded[n].conn = random() % NCONNECTIONS;
|
||||
recorded[n].f = random() % NFILES;
|
||||
recorded[n].start = LOCKBASE + ((unsigned)random() % (LOCKRANGE-1));
|
||||
recorded[n].start = lock_base + ((unsigned)random() % (lock_range-1));
|
||||
recorded[n].len = MINLENGTH +
|
||||
random() % (LOCKRANGE-(recorded[n].start-LOCKBASE));
|
||||
random() % (lock_range-(recorded[n].start-lock_base));
|
||||
recorded[n].start *= RANGE_MULTIPLE;
|
||||
recorded[n].len *= RANGE_MULTIPLE;
|
||||
r1 = random() % 100;
|
||||
@ -535,6 +531,8 @@ static void usage(void)
|
||||
-a (show all ops)\n\
|
||||
-A analyse for minimal ops\n\
|
||||
-O use oplocks\n\
|
||||
-R range set lock range\n\
|
||||
-B base set lock base\n\
|
||||
");
|
||||
}
|
||||
|
||||
@ -578,7 +576,7 @@ static void usage(void)
|
||||
|
||||
seed = time(NULL);
|
||||
|
||||
while ((opt = getopt(argc, argv, "U:s:ho:aAW:Ok")) != EOF) {
|
||||
while ((opt = getopt(argc, argv, "U:s:ho:aAW:OkR:B:")) != EOF) {
|
||||
switch (opt) {
|
||||
case 'k':
|
||||
#ifdef HAVE_KRB5
|
||||
@ -598,6 +596,12 @@ static void usage(void)
|
||||
got_pass = 1;
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
lock_range = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'B':
|
||||
lock_base = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 's':
|
||||
seed = atoi(optarg);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user