summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-04-29 01:09:31 +0000
committerJeremy Allison <jra@samba.org>2000-04-29 01:09:31 +0000
commit74ac259e071db2a5bec716c6508e4ce232b9b1e2 (patch)
tree6690184f4098ba4beb7c46c7d00f38a4d4cd27c3 /source3
parent46d66938e7e683586746b18583ce1670f0ad3544 (diff)
downloadsamba-74ac259e071db2a5bec716c6508e4ce232b9b1e2.tar.gz
samba-74ac259e071db2a5bec716c6508e4ce232b9b1e2.tar.bz2
samba-74ac259e071db2a5bec716c6508e4ce232b9b1e2.zip
Removed tdb locking calls (picky Andrew...:-)
(This used to be commit 6bded3b74e974b97d54acf9289f4cf812e2b1af7)
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/posix.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/source3/locking/posix.c b/source3/locking/posix.c
index 0fcba3432d..1117bed8da 100644
--- a/source3/locking/posix.c
+++ b/source3/locking/posix.c
@@ -100,13 +100,11 @@ static BOOL add_fd_to_close_entry(files_struct *fsp)
dbuf.dptr = NULL;
- tdb_lockchain(posix_pending_close_tdb, kbuf);
dbuf = tdb_fetch(posix_pending_close_tdb, kbuf);
dbuf.dptr = Realloc(dbuf.dptr, dbuf.dsize + sizeof(int));
if (!dbuf.dptr) {
DEBUG(0,("add_fd_to_close_entry: Realloc fail !\n"));
- tdb_unlockchain(posix_pending_close_tdb, kbuf);
return False;
}
memcpy(dbuf.dptr + dbuf.dsize, &fsp->fd, sizeof(int));
@@ -117,7 +115,6 @@ static BOOL add_fd_to_close_entry(files_struct *fsp)
}
free(dbuf.dptr);
- tdb_unlockchain(posix_pending_close_tdb, kbuf);
return True;
}
@@ -129,10 +126,8 @@ static void delete_close_entries(files_struct *fsp)
{
TDB_DATA kbuf = locking_key_fsp(fsp);
- tdb_lockchain(posix_pending_close_tdb, kbuf);
if (tdb_delete(posix_pending_close_tdb, kbuf) == -1)
DEBUG(0,("delete_close_entries: tdb_delete fail !\n"));
- tdb_unlockchain(posix_pending_close_tdb, kbuf);
}
/****************************************************************************
@@ -149,19 +144,15 @@ static size_t get_posix_pending_close_entries(files_struct *fsp, int **entries)
*entries = NULL;
dbuf.dptr = NULL;
- tdb_lockchain(posix_pending_close_tdb, kbuf);
dbuf = tdb_fetch(posix_pending_close_tdb, kbuf);
if (!dbuf.dptr) {
- tdb_unlockchain(posix_pending_close_tdb, kbuf);
return 0;
}
*entries = (int *)dbuf.dptr;
count = (size_t)(dbuf.dsize / sizeof(int));
- tdb_unlockchain(posix_pending_close_tdb, kbuf);
-
return count;
}
@@ -180,19 +171,15 @@ static size_t get_posix_lock_entries(files_struct *fsp, struct posix_lock **entr
dbuf.dptr = NULL;
- tdb_lockchain(posix_lock_tdb, kbuf);
dbuf = tdb_fetch(posix_lock_tdb, kbuf);
if (!dbuf.dptr) {
- tdb_unlockchain(posix_lock_tdb, kbuf);
return 0;
}
*entries = (struct posix_lock *)dbuf.dptr;
count = (size_t)(dbuf.dsize / sizeof(struct posix_lock));
- tdb_unlockchain(posix_lock_tdb, kbuf);
-
return count;
}
@@ -319,7 +306,6 @@ static BOOL add_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_T s
dbuf.dptr = NULL;
- tdb_lockchain(posix_lock_tdb, kbuf);
dbuf = tdb_fetch(posix_lock_tdb, kbuf);
dbuf.dptr = Realloc(dbuf.dptr, dbuf.dsize + sizeof(pl));
@@ -337,7 +323,6 @@ static BOOL add_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_T s
}
free(dbuf.dptr);
- tdb_unlockchain(posix_lock_tdb, kbuf);
DEBUG(10,("add_posix_lock: File %s: type = %s: start=%.0f size=%.0f:dev=%.0f inode=%.0f\n",
fsp->fsp_name, posix_lock_type_name(lock_type), (double)start, (double)size,
@@ -348,7 +333,6 @@ static BOOL add_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_T s
fail:
if (dbuf.dptr)
free(dbuf.dptr);
- tdb_unlockchain(posix_lock_tdb, kbuf);
return False;
}
@@ -365,7 +349,6 @@ static BOOL delete_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_
dbuf.dptr = NULL;
- tdb_lockchain(posix_lock_tdb, kbuf);
dbuf = tdb_fetch(posix_lock_tdb, kbuf);
if (!dbuf.dptr) {
@@ -395,7 +378,6 @@ static BOOL delete_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_
}
free(dbuf.dptr);
- tdb_unlockchain(posix_lock_tdb, kbuf);
return True;
}
}
@@ -405,7 +387,6 @@ static BOOL delete_posix_lock_entry(files_struct *fsp, SMB_OFF_T start, SMB_OFF_
fail:
if (dbuf.dptr)
free(dbuf.dptr);
- tdb_unlockchain(posix_lock_tdb, kbuf);
return False;
}
@@ -730,11 +711,9 @@ static struct unlock_list *posix_unlock_list(TALLOC_CTX *ctx, struct unlock_list
dbuf.dptr = NULL;
- tdb_lockchain(posix_lock_tdb, kbuf);
dbuf = tdb_fetch(posix_lock_tdb, kbuf);
if (!dbuf.dptr) {
- tdb_unlockchain(posix_lock_tdb, kbuf);
return ulhead;
}
@@ -924,8 +903,6 @@ new: start=%.0f,size=%.0f\n", (double)ul_curr->start, (double)ul_curr->size,
} /* end for ( ul_curr = ulhead; ul_curr;) */
} /* end for (i=0; i<num_locks && ul_head; i++) */
- tdb_unlockchain(posix_lock_tdb, kbuf);
-
if (dbuf.dptr)
free(dbuf.dptr);
@@ -1035,10 +1012,18 @@ static void delete_posix_lock_entries(files_struct *fsp)
{
TDB_DATA kbuf = locking_key_fsp(fsp);
- tdb_lockchain(posix_lock_tdb, kbuf);
if (tdb_delete(posix_lock_tdb, kbuf) == -1)
DEBUG(0,("delete_close_entries: tdb_delete fail !\n"));
- tdb_unlockchain(posix_lock_tdb, kbuf);
+}
+
+/****************************************************************************
+ Debug function.
+****************************************************************************/
+
+void dump_entry(struct posix_lock *pl)
+{
+ DEBUG(10,("entry: start=%.0f, size=%.0f, type=%d, fd=%i\n",
+ (double)pl->start, (double)pl->size, (int)pl->lock_type, pl->fd ));
}
/****************************************************************************
@@ -1068,6 +1053,8 @@ void posix_locking_close_file(files_struct *fsp)
for (i = 0; i < count; i++) {
if (entries[i].fd != fsp->fd )
break;
+
+ dump_entry(&entries[i]);
}
if (i == count) {