svn commit: samba r8166 - in trunk/source/smbd: .

vlendec at samba.org vlendec at samba.org
Tue Jul 5 11:32:04 GMT 2005


Author: vlendec
Date: 2005-07-05 11:32:04 +0000 (Tue, 05 Jul 2005)
New Revision: 8166

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

Log:
More micro-refactoring not changing functionality.

Volker

Modified:
   trunk/source/smbd/oplock.c


Changeset:
Modified: trunk/source/smbd/oplock.c
===================================================================
--- trunk/source/smbd/oplock.c	2005-07-05 11:21:15 UTC (rev 8165)
+++ trunk/source/smbd/oplock.c	2005-07-05 11:32:04 UTC (rev 8166)
@@ -343,6 +343,7 @@
 	SMB_INO_T inode;
 	unsigned long file_id;
 	uint16 break_cmd_type;
+	struct sockaddr_in toaddr;
 
 	msg_len = IVAL(buffer,OPBRK_CMD_LEN_OFFSET);
 	from_port = SVAL(buffer,OPBRK_CMD_PORT_OFFSET);
@@ -450,50 +451,54 @@
 	 * Now actually process the break request.
 	 */
 
-	if((exclusive_oplocks_open + level_II_oplocks_open) != 0) {
-		if (oplock_break(dev, inode, file_id, False) == False) {
-			DEBUG(0,("process_local_message: oplock break failed.\n"));
-			return False;
-		}
-	} else {
+	if ((exclusive_oplocks_open == 0) &&
+	    (level_II_oplocks_open == 0)) {
 		/*
 		 * If we have no record of any currently open oplocks,
 		 * it's not an error, as a close command may have
 		 * just been issued on the file that was oplocked.
 		 * Just log a message and return success in this case.
 		 */
-		DEBUG(3,("process_local_message: oplock break requested with no outstanding \
-oplocks. Returning success.\n"));
+		DEBUG(3,("process_local_message: oplock break requested with "
+			 "no outstanding oplocks. Returning success.\n"));
 		return True;
 	}
 
+	if (!oplock_break(dev, inode, file_id, False)) {
+		DEBUG(0,("process_local_message: oplock break failed.\n"));
+		return False;
+	}
+
 	/* 
-	 * Do the appropriate reply - none in the kernel or async level II case.
+	 * Do the appropriate reply - none in the kernel or async level II
+	 * case.
 	 */
 
-	if(break_cmd_type == OPLOCK_BREAK_CMD || break_cmd_type == LEVEL_II_OPLOCK_BREAK_CMD) {
-		struct sockaddr_in toaddr;
+	if (!((break_cmd_type == OPLOCK_BREAK_CMD) ||
+	      (break_cmd_type == LEVEL_II_OPLOCK_BREAK_CMD))) {
+		return True;
+	}
 
-		/* Send the message back after OR'ing in the 'REPLY' bit. */
-		SSVAL(msg_start,OPBRK_MESSAGE_CMD_OFFSET,break_cmd_type | CMD_REPLY);
+	/* Send the message back after OR'ing in the 'REPLY' bit. */
+	SSVAL(msg_start,OPBRK_MESSAGE_CMD_OFFSET,break_cmd_type | CMD_REPLY);
 
-		memset((char *)&toaddr,'\0',sizeof(toaddr));
-		toaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-		toaddr.sin_port = htons(from_port);
-		toaddr.sin_family = AF_INET;
+	memset((char *)&toaddr,'\0',sizeof(toaddr));
+	toaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+	toaddr.sin_port = htons(from_port);
+	toaddr.sin_family = AF_INET;
 
-		if(sys_sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0,
-				(struct sockaddr *)&toaddr, sizeof(toaddr)) < 0) {
-			DEBUG(0,("process_local_message: sendto process %d failed. Errno was %s\n",
-				(int)remotepid, strerror(errno)));
-			return False;
-		}
-
-		DEBUG(5,("process_local_message: oplock break reply sent to \
-pid %d, port %d, for file dev = %x, inode = %.0f, file_id = %lu\n",
-			(int)remotepid, from_port, (unsigned int)dev, (double)inode, file_id));
+	if(sys_sendto( oplock_sock, msg_start, OPLOCK_BREAK_MSG_LEN, 0,
+		       (struct sockaddr *)&toaddr, sizeof(toaddr)) < 0) {
+		DEBUG(0,("process_local_message: sendto process %d failed. "
+			 "Errno was %s\n", (int)remotepid, strerror(errno)));
+		return False;
 	}
 
+	DEBUG(5,("process_local_message: oplock break reply sent to pid %d, "
+		 "port %d, for file dev = %x, inode = %.0f, file_id = %lu\n",
+		 (int)remotepid, from_port, (unsigned int)dev,
+		 (double)inode, file_id));
+
 	return True;
 }
 



More information about the samba-cvs mailing list