Skip to contentSkip to conversation

fs/cifs: Correcting error-prone boolean-statement

PATCH In review Richard Knutsson 1 participant 1 message Aug 31, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 fs/cifs: Correcting error-prone boolean-statement

From: Richard Knutsson <[email protected]>

Converting error-prone statement:
"if (var == FALSE)" into "if (!var)"
"if (var == TRUE)" into "if (var)"

---

Compile-tested
Please Cc: since I'm not on [email protected]

cifssmb.c |   10 +++++-----
connect.c |    4 ++--
dir.c     |    4 ++--
file.c    |    6 +++---
readdir.c |    2 +-
5 files changed, 13 insertions(+), 13 deletions(-)
fs/cifs/cifssmb.c +0 -0
diff -Narup a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
@@ -135,7 +135,7 @@ small_smb_init(int smb_command, int wct,
					(tcon->ses->server->tcpStatus == CifsGood), 10 * HZ);
				if(tcon->ses->server->tcpStatus == CifsNeedReconnect) {
					/* on "soft" mounts we wait once */
-					if((tcon->retry == FALSE) || +					if(!(tcon->retry) || 
					   (tcon->ses->status == CifsExiting)) {
						cFYI(1,("gave up waiting on reconnect in smb_init"));
						return -EHOSTDOWN;
@@ -272,7 +272,7 @@ smb_init(int smb_command, int wct, struc
				if(tcon->ses->server->tcpStatus == 
						CifsNeedReconnect) {
					/* on "soft" mounts we wait once */
-					if((tcon->retry == FALSE) || +					if(!(tcon->retry) || 
					   (tcon->ses->status == CifsExiting)) {
						cFYI(1,("gave up waiting on reconnect in smb_init"));
						return -EHOSTDOWN;

@@ -582,7 +582,7 @@ CIFSSMBNegotiate(unsigned int xid, struc #ifdef CONFIG_CIFS_WEAK_PW_HASH
signing_check:
#endif

-	if(sign_CIFS_PDUs == FALSE) {        +	if(!sign_CIFS_PDUs) {        
		if(server->secMode & SECMODE_SIGN_REQUIRED)
			cERROR(1,("Server requires "
				 "/proc/fs/cifs/PacketSigningEnabled to be on"));
@@ -1432,7 +1432,7 @@ CIFSSMBLock(const int xid, struct cifsTc
	if(lockType == LOCKING_ANDX_OPLOCK_RELEASE) {
		timeout = -1; /* no response expected */
		pSMB->Timeout = 0;
-	} else if (waitFlag == TRUE) {
+	} else if (waitFlag) {
		timeout = 3;  /* blocking operation, no timeout */
		pSMB->Timeout = cpu_to_le32(-1);/* blocking - do not time out */
	} else {

@@ -3310,7 +3310,7 @@ int CIFSFindNext(const int xid, struct c

	cFYI(1, ("In FindNext"));

- if(psrch_inf->endOfSearch == TRUE)
+ if(psrch_inf->endOfSearch)

		return -ENOENT;

	rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
fs/cifs/connect.c +0 -0
diff -Narup a/fs/cifs/connect.c b/fs/cifs/connect.c
@@ -631,8 +631,8 @@ multi_t2_fnd:
					smallbuf = NULL;
			}
			wake_up_process(task_to_wake);
-		} else if ((is_valid_oplock_break(smb_buffer, server) == FALSE)
-		    && (isMultiRsp == FALSE)) {                          +		} else if (!is_valid_oplock_break(smb_buffer, server)
+		    && !isMultiRsp) {                          
			cERROR(1, ("No task to wake, unknown frame rcvd! NumMids %d", midCount.counter));
			cifs_dump_mem("Received Data is: ",(char *)smb_buffer,
				      sizeof(struct smb_hdr));
fs/cifs/dir.c +0 -0
diff -Narup a/fs/cifs/dir.c b/fs/cifs/dir.c
@@ -252,7 +252,7 @@ cifs_create(struct inode *inode, struct 
				direntry->d_op = &cifs_dentry_ops;
			d_instantiate(direntry, newinode);
		}
-		if((nd->flags & LOOKUP_OPEN) == FALSE) {
+		if(!(nd->flags & LOOKUP_OPEN)) {
			/* mknod case - do not leave file open */
			CIFSSMBClose(xid, pTcon, fileHandle);
		} else if(newinode) {
@@ -278,7 +278,7 @@ cifs_create(struct inode *inode, struct 
			pCifsInode = CIFS_I(newinode);
			if(pCifsInode) {
				/* if readable file instance put first in list*/
-				if (write_only == TRUE) {
+				if (write_only) {
                                       	list_add_tail(&pCifsFile->flist,
						&pCifsInode->openFileList);
				} else {
fs/cifs/file.c +0 -0
diff -Narup a/fs/cifs/file.c b/fs/cifs/file.c
@@ -361,7 +361,7 @@ static int cifs_reopen_file(struct inode
 
	xid = GetXid();
	down(&pCifsFile->fh_sem);
-	if (pCifsFile->invalidHandle == FALSE) {
+	if (!(pCifsFile->invalidHandle)) {
		up(&pCifsFile->fh_sem);
		FreeXid(xid);
		return 0;
@@ -553,8 +553,8 @@ int cifs_closedir(struct inode *inode, s
		pTcon = cifs_sb->tcon;

		cFYI(1, ("Freeing private data in close dir"));
-		if ((pCFileStruct->srch_inf.endOfSearch == FALSE) &&
-		   (pCFileStruct->invalidHandle == FALSE)) {
+		if (!(pCFileStruct->srch_inf.endOfSearch) &&
+		    !(pCFileStruct->invalidHandle)) {
			pCFileStruct->invalidHandle = TRUE;
			rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid);
			cFYI(1, ("Closing uncompleted readdir with rc %d",
fs/cifs/readdir.c +0 -0
diff -Narup a/fs/cifs/readdir.c b/fs/cifs/readdir.c
@@ -671,7 +671,7 @@ static int find_cifs_entry(const int xid
	}

	while((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && 
-	      (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)){
+	      (rc == 0) && !(cifsFile->srch_inf.endOfSearch)){
	 	cFYI(1,("calling findnext2"));
		rc = CIFSFindNext(xid,pTcon,cifsFile->netfid, 
				  &cifsFile->srch_inf);