summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:44:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:44:13 +0930
commit75d69ce4f7135fa82d1743fdb61e37ee0bbc1508 (patch)
treec5828c36d5719b42565bda509a88a45f656699cb
parentc16184f83b2fea59cd31ec968f0c6b7e06f9047b (diff)
downloadsamba-75d69ce4f7135fa82d1743fdb61e37ee0bbc1508.tar.gz
samba-75d69ce4f7135fa82d1743fdb61e37ee0bbc1508.tar.bz2
samba-75d69ce4f7135fa82d1743fdb61e37ee0bbc1508.zip
tdb2: remove double-open detection for TDB1 databases.
This is a percursor to unifying with tdb_open() from tdb2, which handles this itself. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 97224cbbe29e76522ec38d031c54b1cadce8ae03)
-rw-r--r--lib/tdb2/tdb1_open.c38
1 files changed, 0 insertions, 38 deletions
diff --git a/lib/tdb2/tdb1_open.c b/lib/tdb2/tdb1_open.c
index 74cc464539..5d0097b2a7 100644
--- a/lib/tdb2/tdb1_open.c
+++ b/lib/tdb2/tdb1_open.c
@@ -27,9 +27,6 @@
#include "tdb1_private.h"
-/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */
-static struct tdb_context *tdb1s = NULL;
-
/* We use two hashes to double-check they're using the right hash function. */
void tdb1_header_hash(struct tdb_context *tdb,
uint32_t *magic1_hash, uint32_t *magic2_hash)
@@ -100,20 +97,6 @@ static int tdb1_new_database(struct tdb_context *tdb, int hash_size)
-static int tdb1_already_open(dev_t device,
- ino_t ino)
-{
- struct tdb_context *i;
-
- for (i = tdb1s; i; i = i->next) {
- if (i->file->device == device && i->file->inode == ino) {
- return 1;
- }
- }
-
- return 0;
-}
-
/* open the database, creating it if necessary
The open_flags and mode are passed straight to the open call on the
@@ -337,16 +320,6 @@ struct tdb_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags
goto fail;
}
- /* Is it already in the open list? If so, fail. */
- if (tdb1_already_open(st.st_dev, st.st_ino)) {
- tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_USE_ERROR,
- "tdb1_open_ex: "
- "%s (%d,%d) is already open in this process",
- name, (int)st.st_dev, (int)st.st_ino);
- errno = EBUSY;
- goto fail;
- }
-
tdb->file->map_size = st.st_size;
tdb->file->device = st.st_dev;
tdb->file->inode = st.st_ino;
@@ -364,8 +337,6 @@ struct tdb_context *tdb1_open_ex(const char *name, int hash_size, int tdb1_flags
if (tdb1_nest_unlock(tdb, TDB1_OPEN_LOCK, F_WRLCK) == -1) {
goto fail;
}
- tdb->next = tdb1s;
- tdb1s = tdb;
return tdb;
fail:
@@ -411,7 +382,6 @@ void tdb1_set_max_dead(struct tdb_context *tdb, int max_dead)
**/
int tdb1_close(struct tdb_context *tdb)
{
- struct tdb_context **i;
int ret = 0;
if (tdb->tdb1.transaction) {
@@ -432,14 +402,6 @@ int tdb1_close(struct tdb_context *tdb)
SAFE_FREE(tdb->file->lockrecs);
SAFE_FREE(tdb->file);
- /* Remove from contexts list */
- for (i = &tdb1s; *i; i = &(*i)->next) {
- if (*i == tdb) {
- *i = tdb->next;
- break;
- }
- }
-
memset(tdb, 0, sizeof(*tdb));
SAFE_FREE(tdb);