diff options
author | Ronnie sahlberg <ronniesahlberg@gmail.com> | 2007-04-17 09:37:13 +1000 |
---|---|---|
committer | Ronnie sahlberg <ronniesahlberg@gmail.com> | 2007-04-17 09:37:13 +1000 |
commit | c6fe6d592b31096e3334116e7c36aed1ea7eb921 (patch) | |
tree | 8f04e127da9546f130a77026ec7424b141697002 /ctdb/lib/tdb/common/open.c | |
parent | 995e017b3f6b061ecba240731b3d82915b3e1f86 (diff) | |
parent | 71bf837a1939f765419359a6bca5996d54fc662a (diff) | |
download | samba-c6fe6d592b31096e3334116e7c36aed1ea7eb921.tar.gz samba-c6fe6d592b31096e3334116e7c36aed1ea7eb921.tar.xz samba-c6fe6d592b31096e3334116e7c36aed1ea7eb921.zip |
merge from tridge
(This used to be ctdb commit 1000ea33025b625e23e7065f95efad447c380c8c)
Diffstat (limited to 'ctdb/lib/tdb/common/open.c')
-rw-r--r-- | ctdb/lib/tdb/common/open.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ctdb/lib/tdb/common/open.c b/ctdb/lib/tdb/common/open.c index e1f21aa856..c7fd3f6656 100644 --- a/ctdb/lib/tdb/common/open.c +++ b/ctdb/lib/tdb/common/open.c @@ -263,15 +263,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->locked = (struct tdb_lock_type *)calloc(tdb->header.hash_size+1, - sizeof(tdb->locked[0])); - if (!tdb->locked) { - TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: " - "failed to allocate lock structure for %s\n", - name)); - errno = ENOMEM; - goto fail; - } + tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { @@ -324,13 +316,21 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, if (tdb->fd != -1) if (close(tdb->fd) != 0) TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to close tdb->fd on error!\n")); - SAFE_FREE(tdb->locked); SAFE_FREE(tdb); errno = save_errno; return NULL; } } +/* + * Set the maximum number of dead records per hash chain + */ + +void tdb_set_max_dead(struct tdb_context *tdb, int max_dead) +{ + tdb->max_dead_records = max_dead; +} + /** * Close a database. * @@ -354,7 +354,7 @@ int tdb_close(struct tdb_context *tdb) SAFE_FREE(tdb->name); if (tdb->fd != -1) ret = close(tdb->fd); - SAFE_FREE(tdb->locked); + SAFE_FREE(tdb->lockrecs); /* Remove from contexts list */ for (i = &tdbs; *i; i = &(*i)->next) { @@ -372,9 +372,9 @@ int tdb_close(struct tdb_context *tdb) /* register a loging function */ void tdb_set_logging_function(struct tdb_context *tdb, - const struct tdb_logging_context *log) + const struct tdb_logging_context *log_ctx) { - tdb->log = *log; + tdb->log = *log_ctx; } void *tdb_get_logging_private(struct tdb_context *tdb) |