summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/common/lock.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-03 06:40:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:45 -0500
commitd3fee429aee87e9c05a4a606fbf0b60b16dac782 (patch)
tree792984356cd682124de421c8d9852cfb7ddc8bff /source4/lib/tdb/common/lock.c
parentfcce0991c29338a63e3e1e50815eb981a2fa113c (diff)
downloadsamba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.tar.gz
samba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.tar.bz2
samba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.zip
r16774: This patch modifies the tdb API to allow the logging function to be used
as part of ldb. This allows tdb failures to be passed all the way up to Samba's DEBUG system, which allowed easier debugging. Unfortunately I had to extend the tdb API, as the logging function didn't have a context pointer. I've worked over the 'debug levels' in TDB. Most of them were 0, which didn't seem right, as some were trace-like messages. We didn't see any of these previously, except when accessing TDB directly. Andrew Bartlett (This used to be commit 58898092c1ce043f6d698db5065f372b79109e22)
Diffstat (limited to 'source4/lib/tdb/common/lock.c')
-rw-r--r--source4/lib/tdb/common/lock.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source4/lib/tdb/common/lock.c b/source4/lib/tdb/common/lock.c
index 976cf2cfa0..821fd35186 100644
--- a/source4/lib/tdb/common/lock.c
+++ b/source4/lib/tdb/common/lock.c
@@ -68,7 +68,7 @@ int tdb_brlock_len(struct tdb_context *tdb, tdb_off_t offset,
if (!probe && lck_type != F_SETLK) {
/* Ensure error code is set for log fun to examine. */
tdb->ecode = TDB_ERR_LOCK;
- TDB_LOG((tdb, 5,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d len=%d\n",
+ TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d len=%d\n",
tdb->fd, offset, rw_type, lck_type, len));
}
return TDB_ERRCODE(TDB_ERR_LOCK, -1);
@@ -99,7 +99,7 @@ int tdb_brlock_upgrade(struct tdb_context *tdb, tdb_off_t offset, size_t len)
tv.tv_usec = 1;
select(0, NULL, NULL, NULL, &tv);
}
- TDB_LOG((tdb, 5,"tdb_brlock_upgrade failed at offset %d\n", offset));
+ TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_brlock_upgrade failed at offset %d\n", offset));
return -1;
}
@@ -119,7 +119,7 @@ int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset,
int tdb_lock(struct tdb_context *tdb, int list, int ltype)
{
if (list < -1 || list >= (int)tdb->header.hash_size) {
- TDB_LOG((tdb, 0,"tdb_lock: invalid list %d for ltype=%d\n",
+ TDB_LOG((tdb, TDB_DEBUG_ERROR,"tdb_lock: invalid list %d for ltype=%d\n",
list, ltype));
return -1;
}
@@ -130,7 +130,7 @@ int tdb_lock(struct tdb_context *tdb, int list, int ltype)
and simply bump the count for future ones */
if (tdb->locked[list+1].count == 0) {
if (tdb->methods->tdb_brlock(tdb,FREELIST_TOP+4*list,ltype,F_SETLKW, 0)) {
- TDB_LOG((tdb, 0,"tdb_lock failed on list %d ltype=%d (%s)\n",
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_lock failed on list %d ltype=%d (%s)\n",
list, ltype, strerror(errno)));
return -1;
}
@@ -153,12 +153,12 @@ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
/* Sanity checks */
if (list < -1 || list >= (int)tdb->header.hash_size) {
- TDB_LOG((tdb, 0, "tdb_unlock: list %d invalid (%d)\n", list, tdb->header.hash_size));
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: list %d invalid (%d)\n", list, tdb->header.hash_size));
return ret;
}
if (tdb->locked[list+1].count==0) {
- TDB_LOG((tdb, 0, "tdb_unlock: count is 0\n"));
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: count is 0\n"));
return ret;
}
@@ -172,7 +172,7 @@ int tdb_unlock(struct tdb_context *tdb, int list, int ltype)
tdb->locked[list+1].count--;
if (ret)
- TDB_LOG((tdb, 0,"tdb_unlock: An error occurred unlocking!\n"));
+ TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_unlock: An error occurred unlocking!\n"));
return ret;
}