summaryrefslogtreecommitdiff
path: root/lib/tdb2/test/run-tdb1-open-during-transaction.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:35:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:35:13 +0930
commit9b98acbba304f2c1c1fba5bda672e1005151e526 (patch)
tree64dfb0b094bd57aa403a96be95097b6db9732553 /lib/tdb2/test/run-tdb1-open-during-transaction.c
parent61b1bd1dca145a0417907793579352c66b016c23 (diff)
downloadsamba-9b98acbba304f2c1c1fba5bda672e1005151e526.tar.gz
samba-9b98acbba304f2c1c1fba5bda672e1005151e526.tar.bz2
samba-9b98acbba304f2c1c1fba5bda672e1005151e526.zip
tdb2: Make TDB1 code use TDB2's open flags.
This means getting rid of TDB_VOLATILE (perhaps we should use an attribute for that?), TDB_INCOMPATIBLE_HASH (use the tdb_attribute_hash for that) and TDB_CLEAR_IF_FIRST (use the tdb_attribute_openhook for that). We also get rid of TDB_DISALLOW_NESTING: that's the default for TDB2. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 22d0e0dc59fc9d7e0046fec6971ef478c2d604fd)
Diffstat (limited to 'lib/tdb2/test/run-tdb1-open-during-transaction.c')
-rw-r--r--lib/tdb2/test/run-tdb1-open-during-transaction.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/lib/tdb2/test/run-tdb1-open-during-transaction.c b/lib/tdb2/test/run-tdb1-open-during-transaction.c
index ad6c6d6074..875fc3ca9e 100644
--- a/lib/tdb2/test/run-tdb1-open-during-transaction.c
+++ b/lib/tdb2/test/run-tdb1-open-during-transaction.c
@@ -23,7 +23,6 @@ static int ftruncate_check(int fd, off_t length);
static struct agent *agent;
static bool opened;
static int errors = 0;
-static bool clear_if_first;
#define TEST_DBNAME "run-open-during-transaction.tdb"
#undef write
@@ -70,10 +69,7 @@ static void check_file_intact(int fd)
}
/* Ask agent to open file. */
- ret = external_agent_operation1(agent, clear_if_first ?
- OPEN_WITH_CLEAR_IF_FIRST :
- OPEN,
- TEST_DBNAME);
+ ret = external_agent_operation1(agent, OPEN, TEST_DBNAME);
/* It's OK to open it, but it must not have changed! */
if (!compare_file(fd, contents, st.st_size)) {
@@ -132,25 +128,22 @@ static int ftruncate_check(int fd, off_t length)
int main(int argc, char *argv[])
{
- const int flags[] = { TDB1_DEFAULT,
- TDB1_CLEAR_IF_FIRST,
- TDB1_NOMMAP,
- TDB1_CLEAR_IF_FIRST | TDB1_NOMMAP };
+ const int flags[] = { TDB_DEFAULT,
+ TDB_NOMMAP };
int i;
struct tdb1_context *tdb;
TDB_DATA key, data;
- plan_tests(20);
+ plan_tests(10);
agent = prepare_external_agent1();
if (!agent)
err(1, "preparing agent");
unlock_callback1 = after_unlock;
for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
- clear_if_first = (flags[i] & TDB1_CLEAR_IF_FIRST);
diag("Test with %s and %s\n",
- clear_if_first ? "CLEAR" : "DEFAULT",
- (flags[i] & TDB1_NOMMAP) ? "no mmap" : "mmap");
+ "DEFAULT",
+ (flags[i] & TDB_NOMMAP) ? "no mmap" : "mmap");
unlink(TEST_DBNAME);
tdb = tdb1_open_ex(TEST_DBNAME, 1024, flags[i],
O_CREAT|O_TRUNC|O_RDWR, 0600,