svn commit: samba r17046 - in branches/SAMBA_3_0/source/locking: .

jra at samba.org jra at samba.org
Sat Jul 15 00:34:09 GMT 2006


Author: jra
Date: 2006-07-15 00:34:08 +0000 (Sat, 15 Jul 2006)
New Revision: 17046

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17046

Log:
Ensure we're using the right pointers ...
Jeremy.

Modified:
   branches/SAMBA_3_0/source/locking/brlock.c


Changeset:
Modified: branches/SAMBA_3_0/source/locking/brlock.c
===================================================================
--- branches/SAMBA_3_0/source/locking/brlock.c	2006-07-15 00:31:48 UTC (rev 17045)
+++ branches/SAMBA_3_0/source/locking/brlock.c	2006-07-15 00:34:08 UTC (rev 17046)
@@ -723,7 +723,7 @@
  Check if an unlock overlaps a pending lock.
 ****************************************************************************/
 
-static BOOL brl_pending_overlap(struct lock_struct *lock, struct lock_struct *pend_lock)
+static BOOL brl_pending_overlap(const struct lock_struct *lock, const struct lock_struct *pend_lock)
 {
 	if ((lock->start <= pend_lock->start) && (lock->start + lock->size > pend_lock->start))
 		return True;
@@ -739,7 +739,6 @@
 static BOOL brl_unlock_windows(struct byte_range_lock *br_lck, const struct lock_struct *plock)
 {
 	unsigned int i, j;
-	struct lock_struct *lock = NULL;
 	struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
 	enum brl_type deleted_lock_type = READ_LOCK; /* shut the compiler up.... */
 
@@ -748,7 +747,7 @@
 	   is sorted in the zero zero case. */
 
 	for (i = 0; i < br_lck->num_locks; i++) {
-		lock = &locks[i];
+		struct lock_struct *lock = &locks[i];
 
 		if (lock->lock_type == WRITE_LOCK &&
 		    brl_same_context(&lock->context, &plock->context) &&
@@ -770,7 +769,7 @@
 #endif
 
 	for (i = 0; i < br_lck->num_locks; i++) {
-		lock = &locks[i];
+		struct lock_struct *lock = &locks[i];
 
 		/* Only remove our own locks that match in start, size, and flavour. */
 		if (brl_same_context(&lock->context, &plock->context) &&
@@ -822,7 +821,7 @@
 		}
 
 		/* We could send specific lock info here... */
-		if (brl_pending_overlap(lock, pend_lock)) {
+		if (brl_pending_overlap(plock, pend_lock)) {
 			DEBUG(10,("brl_unlock: sending unlock message to pid %s\n",
 				procid_str_static(&pend_lock->context.pid )));
 
@@ -844,7 +843,6 @@
 static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_struct *plock)
 {
 	unsigned int i, j, count;
-	struct lock_struct *lock = NULL;
 	struct lock_struct *tp;
 	struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
 	BOOL overlap_found = False;
@@ -873,12 +871,11 @@
 
 	count = 0;
 	for (i = 0; i < br_lck->num_locks; i++) {
+		struct lock_struct *lock = &locks[i];
 		struct lock_struct tmp_lock[3];
 		BOOL lock_was_added = False;
 		unsigned int tmp_count;
 
-		lock = &locks[i];
-
 		/* Only remove our own locks - ignore fnum. */
 		if (lock->lock_type == PENDING_LOCK ||
 				!brl_same_context(&lock->context, &plock->context)) {
@@ -979,11 +976,10 @@
 
 	br_lck->num_locks = count;
 	SAFE_FREE(br_lck->lock_data);
-	br_lck->lock_data = (void *)tp;
+	locks = br_lck->lock_data = (void *)tp;
 	br_lck->modified = True;
 
 	/* Send unlock messages to any pending waiters that overlap. */
-	locks = tp;
 
 	for (j=0; j < br_lck->num_locks; j++) {
 		struct lock_struct *pend_lock = &locks[j];
@@ -994,7 +990,7 @@
 		}
 
 		/* We could send specific lock info here... */
-		if (brl_pending_overlap(lock, pend_lock)) {
+		if (brl_pending_overlap(plock, pend_lock)) {
 			DEBUG(10,("brl_unlock: sending unlock message to pid %s\n",
 				procid_str_static(&pend_lock->context.pid )));
 



More information about the samba-cvs mailing list