diff options
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r-- | source4/lib/tdb/swig/Tdb.py | 6 | ||||
-rw-r--r-- | source4/lib/tdb/swig/tdb.i | 45 | ||||
-rw-r--r-- | source4/lib/tdb/tools/tdbtorture.c | 2 |
3 files changed, 21 insertions, 32 deletions
diff --git a/source4/lib/tdb/swig/Tdb.py b/source4/lib/tdb/swig/Tdb.py index 529d0753d1..d1a506e69c 100644 --- a/source4/lib/tdb/swig/Tdb.py +++ b/source4/lib/tdb/swig/Tdb.py @@ -69,7 +69,7 @@ class Tdb: tdb_delete(self.tdb, key) def has_key(self, key): - return tdb_exists(self.tdb, key) + return tdb_exists(self.tdb, key) != 0 # Tdb iterator @@ -113,3 +113,7 @@ class Tdb: def clear(self): for k in iter(self): del(self[k]) + + # TODO: iterkeys, itervalues, iteritems + + # TODO: any other missing methods for container types diff --git a/source4/lib/tdb/swig/tdb.i b/source4/lib/tdb/swig/tdb.i index fbb0f29dec..1ff21f53b5 100644 --- a/source4/lib/tdb/swig/tdb.i +++ b/source4/lib/tdb/swig/tdb.i @@ -102,7 +102,21 @@ typedef int mode_t; #define TDB_CONVERT 16 /* convert endian (internal use) */ #define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ -/* Throw an IOError exception if tdb_open() or tdb_open_ex() returns NULL */ +enum TDB_ERROR { + TDB_SUCCESS=0, + TDB_ERR_CORRUPT, + TDB_ERR_IO, + TDB_ERR_LOCK, + TDB_ERR_OOM, + TDB_ERR_EXISTS, + TDB_ERR_NOLOCK, + TDB_ERR_LOCK_TIMEOUT, + TDB_ERR_NOEXIST, + TDB_ERR_EINVAL, + TDB_ERR_RDONLY +}; + +/* Throw an IOError exception from errno if tdb_open() returns NULL */ %exception { $action @@ -115,19 +129,8 @@ typedef int mode_t; TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, int open_flags, mode_t mode); -TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - tdb_log_func log_fn, - tdb_hash_func hash_fn); - %exception; -int tdb_reopen(TDB_CONTEXT *tdb); - -int tdb_reopen_all(int parent_longlived); - -void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func); - enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb); const char *tdb_errorstr(TDB_CONTEXT *tdb); @@ -146,22 +149,4 @@ TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state); - int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); - -int tdb_lockall(TDB_CONTEXT *tdb); - -void tdb_unlockall(TDB_CONTEXT *tdb); - -/* Low level locking functions: use with care */ - -int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key); - -int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key); - -/* Debug functions. Not used in production. */ - -void tdb_dump_all(TDB_CONTEXT *tdb); - -int tdb_printfreelist(TDB_CONTEXT *tdb); diff --git a/source4/lib/tdb/tools/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c index 14a2b48cdc..ca71c736ad 100644 --- a/source4/lib/tdb/tools/tdbtorture.c +++ b/source4/lib/tdb/tools/tdbtorture.c @@ -238,7 +238,7 @@ static void usage(void) unlink("torture.tdb"); - pids = calloc(sizeof(pid_t), num_procs); + pids = (pid_t *)calloc(sizeof(pid_t), num_procs); pids[0] = getpid(); for (i=0;i<num_procs-1;i++) { |