diff options
-rw-r--r-- | source4/include/includes.h | 6 | ||||
-rw-r--r-- | source4/lib/tdb/common/spinlock.c (renamed from source4/lib/tdb/spinlock.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/common/tdb.c (renamed from source4/lib/tdb/tdb.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/common/tdbutil.c (renamed from source4/lib/tdb/tdbutil.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/config.mk | 6 | ||||
-rw-r--r-- | source4/lib/tdb/docs/README (renamed from source4/lib/tdb/README) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/docs/tdb.magic (renamed from source4/lib/tdb/tdb.magic) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/include/spinlock.h (renamed from source4/lib/tdb/spinlock.h) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/include/tdb.h (renamed from source4/lib/tdb/tdb.h) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/include/tdbutil.h (renamed from source4/lib/tdb/tdbutil.h) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/Makefile (renamed from source4/utils/tdb/Makefile) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbbackup.c (renamed from source4/utils/tdb/tdbbackup.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbdump.c (renamed from source4/utils/tdb/tdbdump.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbtest.c (renamed from source4/utils/tdb/tdbtest.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbtool.c (renamed from source4/utils/tdb/tdbtool.c) | 0 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbtorture.c (renamed from source4/utils/tdb/tdbtorture.c) | 0 | ||||
-rw-r--r-- | source4/utils/tdb/README | 167 | ||||
-rw-r--r-- | source4/utils/tdb/tdb.magic | 10 |
18 files changed, 6 insertions, 183 deletions
diff --git a/source4/include/includes.h b/source4/include/includes.h index 89509255e8..f9598845c3 100644 --- a/source4/include/includes.h +++ b/source4/include/includes.h @@ -681,9 +681,9 @@ extern int errno; #include "xfile.h" #include "dlinklist.h" #include "lib/ldb/include/ldb.h" -#include "lib/tdb/tdb.h" -#include "lib/tdb/spinlock.h" -#include "lib/tdb/tdbutil.h" +#include "lib/tdb/include/tdb.h" +#include "lib/tdb/include/spinlock.h" +#include "lib/tdb/include/tdbutil.h" #include "talloc.h" #include "nt_status.h" #include "interfaces.h" diff --git a/source4/lib/tdb/spinlock.c b/source4/lib/tdb/common/spinlock.c index 1b789d4daa..1b789d4daa 100644 --- a/source4/lib/tdb/spinlock.c +++ b/source4/lib/tdb/common/spinlock.c diff --git a/source4/lib/tdb/tdb.c b/source4/lib/tdb/common/tdb.c index c8ac7babad..c8ac7babad 100644 --- a/source4/lib/tdb/tdb.c +++ b/source4/lib/tdb/common/tdb.c diff --git a/source4/lib/tdb/tdbutil.c b/source4/lib/tdb/common/tdbutil.c index 62841ddfc2..62841ddfc2 100644 --- a/source4/lib/tdb/tdbutil.c +++ b/source4/lib/tdb/common/tdbutil.c diff --git a/source4/lib/tdb/config.mk b/source4/lib/tdb/config.mk index 797c793ce3..96641f8da7 100644 --- a/source4/lib/tdb/config.mk +++ b/source4/lib/tdb/config.mk @@ -2,10 +2,10 @@ # Start SUBSYSTEM LIBTDB [SUBSYSTEM::LIBTDB] INIT_OBJ_FILES = \ - lib/tdb/tdb.o + lib/tdb/common/tdb.o ADD_OBJ_FILES = \ - lib/tdb/tdbutil.o \ - lib/tdb/spinlock.o + lib/tdb/common/tdbutil.o \ + lib/tdb/common/spinlock.o # # End SUBSYSTEM LIBLDB ################################################ diff --git a/source4/lib/tdb/README b/source4/lib/tdb/docs/README index fac3eacb4d..fac3eacb4d 100644 --- a/source4/lib/tdb/README +++ b/source4/lib/tdb/docs/README diff --git a/source4/lib/tdb/tdb.magic b/source4/lib/tdb/docs/tdb.magic index f5619e7327..f5619e7327 100644 --- a/source4/lib/tdb/tdb.magic +++ b/source4/lib/tdb/docs/tdb.magic diff --git a/source4/lib/tdb/spinlock.h b/source4/lib/tdb/include/spinlock.h index 967fe37457..967fe37457 100644 --- a/source4/lib/tdb/spinlock.h +++ b/source4/lib/tdb/include/spinlock.h diff --git a/source4/lib/tdb/tdb.h b/source4/lib/tdb/include/tdb.h index 73a0ea8f83..73a0ea8f83 100644 --- a/source4/lib/tdb/tdb.h +++ b/source4/lib/tdb/include/tdb.h diff --git a/source4/lib/tdb/tdbutil.h b/source4/lib/tdb/include/tdbutil.h index 01473446a1..01473446a1 100644 --- a/source4/lib/tdb/tdbutil.h +++ b/source4/lib/tdb/include/tdbutil.h diff --git a/source4/utils/tdb/Makefile b/source4/lib/tdb/tools/Makefile index 59fbb079bd..59fbb079bd 100644 --- a/source4/utils/tdb/Makefile +++ b/source4/lib/tdb/tools/Makefile diff --git a/source4/utils/tdb/tdbbackup.c b/source4/lib/tdb/tools/tdbbackup.c index 1a0e1c1588..1a0e1c1588 100644 --- a/source4/utils/tdb/tdbbackup.c +++ b/source4/lib/tdb/tools/tdbbackup.c diff --git a/source4/utils/tdb/tdbdump.c b/source4/lib/tdb/tools/tdbdump.c index 9c1dc2761b..9c1dc2761b 100644 --- a/source4/utils/tdb/tdbdump.c +++ b/source4/lib/tdb/tools/tdbdump.c diff --git a/source4/utils/tdb/tdbtest.c b/source4/lib/tdb/tools/tdbtest.c index 89295a3291..89295a3291 100644 --- a/source4/utils/tdb/tdbtest.c +++ b/source4/lib/tdb/tools/tdbtest.c diff --git a/source4/utils/tdb/tdbtool.c b/source4/lib/tdb/tools/tdbtool.c index 92009dcef4..92009dcef4 100644 --- a/source4/utils/tdb/tdbtool.c +++ b/source4/lib/tdb/tools/tdbtool.c diff --git a/source4/utils/tdb/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c index 3f704e537e..3f704e537e 100644 --- a/source4/utils/tdb/tdbtorture.c +++ b/source4/lib/tdb/tools/tdbtorture.c diff --git a/source4/utils/tdb/README b/source4/utils/tdb/README deleted file mode 100644 index fac3eacb4d..0000000000 --- a/source4/utils/tdb/README +++ /dev/null @@ -1,167 +0,0 @@ -tdb - a trivial database system -tridge@linuxcare.com December 1999 -================================== - -This is a simple database API. It was inspired by the realisation that -in Samba we have several ad-hoc bits of code that essentially -implement small databases for sharing structures between parts of -Samba. As I was about to add another I realised that a generic -database module was called for to replace all the ad-hoc bits. - -I based the interface on gdbm. I couldn't use gdbm as we need to be -able to have multiple writers to the databases at one time. - -Compilation ------------ - -add HAVE_MMAP=1 to use mmap instead of read/write -add TDB_DEBUG=1 for verbose debug info -add NOLOCK=1 to disable locking code - -Testing -------- - -Compile tdbtest.c and link with gdbm for testing. tdbtest will perform -identical operations via tdb and gdbm then make sure the result is the -same - -Also included is tdbtool, which allows simple database manipulation -on the commandline. - -tdbtest and tdbtool are not built as part of Samba, but are included -for completeness. - -Interface ---------- - -The interface is very similar to gdbm except for the following: - -- different open interface. The tdb_open call is more similar to a - traditional open() -- no tdbm_reorganise() function -- no tdbm_sync() function. No operations are cached in the library anyway -- added a tdb_traverse() function for traversing the whole database - -A general rule for using tdb is that the caller frees any returned -TDB_DATA structures. Just call free(p.dptr) to free a TDB_DATA -return value called p. This is the same as gdbm. - -here is a full list of tdb functions with brief descriptions. - - ----------------------------------------------------------------------- -TDB_CONTEXT *tdb_open(char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) - - open the database, creating it if necessary - - The open_flags and mode are passed straight to the open call on the database - file. A flags value of O_WRONLY is invalid - - The hash size is advisory, use zero for a default value. - - return is NULL on error - - possible tdb_flags are: - TDB_CLEAR_IF_FIRST - clear database if we are the only one with it open - TDB_INTERNAL - don't use a file, instaed store the data in - memory. The filename is ignored in this case. - TDB_NOLOCK - don't do any locking - TDB_NOMMAP - don't use mmap - ----------------------------------------------------------------------- -char *tdb_error(TDB_CONTEXT *tdb); - - return a error string for the last tdb error - ----------------------------------------------------------------------- -int tdb_close(TDB_CONTEXT *tdb); - - close a database - ----------------------------------------------------------------------- -int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf); - - update an entry in place - this only works if the new data size - is <= the old data size and the key exists. - on failure return -1 - ----------------------------------------------------------------------- -TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); - - fetch an entry in the database given a key - if the return value has a null dptr then a error occurred - - caller must free the resulting data - ----------------------------------------------------------------------- -int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); - - check if an entry in the database exists - - note that 1 is returned if the key is found and 0 is returned if not found - this doesn't match the conventions in the rest of this module, but is - compatible with gdbm - ----------------------------------------------------------------------- -int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, - TDB_DATA key, TDB_DATA dbuf, void *state), void *state); - - traverse the entire database - calling fn(tdb, key, data, state) on each - element. - - return -1 on error or the record count traversed - - if fn is NULL then it is not called - - a non-zero return value from fn() indicates that the traversal should stop - ----------------------------------------------------------------------- -TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); - - find the first entry in the database and return its key - - the caller must free the returned data - ----------------------------------------------------------------------- -TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); - - find the next entry in the database, returning its key - - the caller must free the returned data - ----------------------------------------------------------------------- -int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key); - - delete an entry in the database given a key - ----------------------------------------------------------------------- -int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); - - store an element in the database, replacing any existing element - with the same key - - If flag==TDB_INSERT then don't overwrite an existing entry - If flag==TDB_MODIFY then don't create a new entry - - return 0 on success, -1 on failure - ----------------------------------------------------------------------- -int tdb_writelock(TDB_CONTEXT *tdb); - - lock the database. If we already have it locked then don't do anything - ----------------------------------------------------------------------- -int tdb_writeunlock(TDB_CONTEXT *tdb); - unlock the database - ----------------------------------------------------------------------- -int tdb_lockchain(TDB_CONTEXT *tdb, TDB_DATA key); - - lock one hash chain. This is meant to be used to reduce locking - contention - it cannot guarantee how many records will be locked - ----------------------------------------------------------------------- -int tdb_unlockchain(TDB_CONTEXT *tdb, TDB_DATA key); - - unlock one hash chain diff --git a/source4/utils/tdb/tdb.magic b/source4/utils/tdb/tdb.magic deleted file mode 100644 index f5619e7327..0000000000 --- a/source4/utils/tdb/tdb.magic +++ /dev/null @@ -1,10 +0,0 @@ -# Magic file(1) information about tdb files. -# -# Install this into /etc/magic or the corresponding location for your -# system, or pass as a -m argument to file(1). - -# You may use and redistribute this file without restriction. - -0 string TDB\ file TDB database ->32 lelong =0x2601196D version 6, little-endian ->>36 lelong x hash size %d bytes |