diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-18 22:30:26 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-19 05:38:06 +0200 |
commit | 16cc345d4f84367e70e133200f7aa335c2aae8c6 (patch) | |
tree | 955a33c25c19f3127e24ba6b0e108da6b1f7f804 /lib/tdb2/test/run-remap-in-read_traverse.c | |
parent | 76758b9767fad45ff144bbfef3ab84bca5d4650e (diff) | |
download | samba-16cc345d4f84367e70e133200f7aa335c2aae8c6.tar.gz samba-16cc345d4f84367e70e133200f7aa335c2aae8c6.tar.bz2 samba-16cc345d4f84367e70e133200f7aa335c2aae8c6.zip |
TDB2: Goodbye TDB2, Hello NTDB.
This renames everything from tdb2 to ntdb: importantly, we no longer
use the tdb_ namespace, so you can link against both ntdb and tdb if
you want to.
This also enables building of standalone ntdb by the autobuild script.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb2/test/run-remap-in-read_traverse.c')
-rw-r--r-- | lib/tdb2/test/run-remap-in-read_traverse.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/lib/tdb2/test/run-remap-in-read_traverse.c b/lib/tdb2/test/run-remap-in-read_traverse.c deleted file mode 100644 index 16a1baab46..0000000000 --- a/lib/tdb2/test/run-remap-in-read_traverse.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "tdb2-source.h" -/* We had a bug where we marked the tdb read-only for a tdb_traverse_read. - * If we then expanded the tdb, we would remap read-only, and later SEGV. */ -#include "tap-interface.h" -#include "external-agent.h" -#include "logging.h" - -static bool file_larger(int fd, tdb_len_t size) -{ - struct stat st; - - fstat(fd, &st); - return st.st_size != size; -} - -static unsigned add_records_to_grow(struct agent *agent, int fd, tdb_len_t size) -{ - unsigned int i; - - for (i = 0; !file_larger(fd, size); i++) { - char data[20]; - sprintf(data, "%i", i); - if (external_agent_operation(agent, STORE, data) != SUCCESS) - return 0; - } - diag("Added %u records to grow file", i); - return i; -} - -int main(int argc, char *argv[]) -{ - unsigned int i; - struct agent *agent; - struct tdb_context *tdb; - struct tdb_data d = tdb_mkdata("hello", 5); - const char filename[] = "run-remap-in-read_traverse.tdb"; - - plan_tests(4); - - agent = prepare_external_agent(); - - tdb = tdb_open(filename, TDB_DEFAULT, - O_RDWR|O_CREAT|O_TRUNC, 0600, &tap_log_attr); - - ok1(external_agent_operation(agent, OPEN, filename) == SUCCESS); - i = add_records_to_grow(agent, tdb->file->fd, tdb->file->map_size); - - /* Do a traverse. */ - ok1(tdb_traverse(tdb, NULL, NULL) == i); - - /* Now store something! */ - ok1(tdb_store(tdb, d, d, TDB_INSERT) == 0); - ok1(tap_log_messages == 0); - tdb_close(tdb); - free_external_agent(agent); - return exit_status(); -} |