diff options
author | Steve French <sfrench@us.ibm.com> | 2008-04-28 20:06:05 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-04-28 20:06:05 -0400 |
commit | 4b18f2a9c3964f7612b7403dddc1d1ba5443ae24 (patch) | |
tree | 6deaca1844706e70e235be6fe502269e4f15355f /fs/cifs/file.c | |
parent | e9f20d6f03e8df393b001dab6dc5226c2a5daf57 (diff) |
[CIFS] convert usage of implicit booleans to bool
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r-- | fs/cifs/file.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 40b690073fc1..31a0a33b9d95 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -51,8 +51,8 @@ static inline struct cifsFileInfo *cifs_init_private( | |||
51 | INIT_LIST_HEAD(&private_data->llist); | 51 | INIT_LIST_HEAD(&private_data->llist); |
52 | private_data->pfile = file; /* needed for writepage */ | 52 | private_data->pfile = file; /* needed for writepage */ |
53 | private_data->pInode = inode; | 53 | private_data->pInode = inode; |
54 | private_data->invalidHandle = FALSE; | 54 | private_data->invalidHandle = false; |
55 | private_data->closePend = FALSE; | 55 | private_data->closePend = false; |
56 | /* we have to track num writers to the inode, since writepages | 56 | /* we have to track num writers to the inode, since writepages |
57 | does not tell us which handle the write is for so there can | 57 | does not tell us which handle the write is for so there can |
58 | be a close (overlapping with write) of the filehandle that | 58 | be a close (overlapping with write) of the filehandle that |
@@ -148,12 +148,12 @@ client_can_cache: | |||
148 | full_path, buf, inode->i_sb, xid, NULL); | 148 | full_path, buf, inode->i_sb, xid, NULL); |
149 | 149 | ||
150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 150 | if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
151 | pCifsInode->clientCanCacheAll = TRUE; | 151 | pCifsInode->clientCanCacheAll = true; |
152 | pCifsInode->clientCanCacheRead = TRUE; | 152 | pCifsInode->clientCanCacheRead = true; |
153 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 153 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
154 | file->f_path.dentry->d_inode)); | 154 | file->f_path.dentry->d_inode)); |
155 | } else if ((*oplock & 0xF) == OPLOCK_READ) | 155 | } else if ((*oplock & 0xF) == OPLOCK_READ) |
156 | pCifsInode->clientCanCacheRead = TRUE; | 156 | pCifsInode->clientCanCacheRead = true; |
157 | 157 | ||
158 | return rc; | 158 | return rc; |
159 | } | 159 | } |
@@ -247,7 +247,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
247 | if (oplockEnabled) | 247 | if (oplockEnabled) |
248 | oplock = REQ_OPLOCK; | 248 | oplock = REQ_OPLOCK; |
249 | else | 249 | else |
250 | oplock = FALSE; | 250 | oplock = 0; |
251 | 251 | ||
252 | /* BB pass O_SYNC flag through on file attributes .. BB */ | 252 | /* BB pass O_SYNC flag through on file attributes .. BB */ |
253 | 253 | ||
@@ -339,7 +339,7 @@ static int cifs_relock_file(struct cifsFileInfo *cifsFile) | |||
339 | return rc; | 339 | return rc; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int cifs_reopen_file(struct file *file, int can_flush) | 342 | static int cifs_reopen_file(struct file *file, bool can_flush) |
343 | { | 343 | { |
344 | int rc = -EACCES; | 344 | int rc = -EACCES; |
345 | int xid, oplock; | 345 | int xid, oplock; |
@@ -360,7 +360,7 @@ static int cifs_reopen_file(struct file *file, int can_flush) | |||
360 | 360 | ||
361 | xid = GetXid(); | 361 | xid = GetXid(); |
362 | down(&pCifsFile->fh_sem); | 362 | down(&pCifsFile->fh_sem); |
363 | if (pCifsFile->invalidHandle == FALSE) { | 363 | if (!pCifsFile->invalidHandle) { |
364 | up(&pCifsFile->fh_sem); | 364 | up(&pCifsFile->fh_sem); |
365 | FreeXid(xid); | 365 | FreeXid(xid); |
366 | return 0; | 366 | return 0; |
@@ -404,7 +404,7 @@ reopen_error_exit: | |||
404 | if (oplockEnabled) | 404 | if (oplockEnabled) |
405 | oplock = REQ_OPLOCK; | 405 | oplock = REQ_OPLOCK; |
406 | else | 406 | else |
407 | oplock = FALSE; | 407 | oplock = 0; |
408 | 408 | ||
409 | /* Can not refresh inode by passing in file_info buf to be returned | 409 | /* Can not refresh inode by passing in file_info buf to be returned |
410 | by SMBOpen and then calling get_inode_info with returned buf | 410 | by SMBOpen and then calling get_inode_info with returned buf |
@@ -422,7 +422,7 @@ reopen_error_exit: | |||
422 | cFYI(1, ("oplock: %d", oplock)); | 422 | cFYI(1, ("oplock: %d", oplock)); |
423 | } else { | 423 | } else { |
424 | pCifsFile->netfid = netfid; | 424 | pCifsFile->netfid = netfid; |
425 | pCifsFile->invalidHandle = FALSE; | 425 | pCifsFile->invalidHandle = false; |
426 | up(&pCifsFile->fh_sem); | 426 | up(&pCifsFile->fh_sem); |
427 | pCifsInode = CIFS_I(inode); | 427 | pCifsInode = CIFS_I(inode); |
428 | if (pCifsInode) { | 428 | if (pCifsInode) { |
@@ -432,8 +432,8 @@ reopen_error_exit: | |||
432 | CIFS_I(inode)->write_behind_rc = rc; | 432 | CIFS_I(inode)->write_behind_rc = rc; |
433 | /* temporarily disable caching while we | 433 | /* temporarily disable caching while we |
434 | go to server to get inode info */ | 434 | go to server to get inode info */ |
435 | pCifsInode->clientCanCacheAll = FALSE; | 435 | pCifsInode->clientCanCacheAll = false; |
436 | pCifsInode->clientCanCacheRead = FALSE; | 436 | pCifsInode->clientCanCacheRead = false; |
437 | if (pTcon->unix_ext) | 437 | if (pTcon->unix_ext) |
438 | rc = cifs_get_inode_info_unix(&inode, | 438 | rc = cifs_get_inode_info_unix(&inode, |
439 | full_path, inode->i_sb, xid); | 439 | full_path, inode->i_sb, xid); |
@@ -448,16 +448,16 @@ reopen_error_exit: | |||
448 | we can not go to the server to get the new inod | 448 | we can not go to the server to get the new inod |
449 | info */ | 449 | info */ |
450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { | 450 | if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) { |
451 | pCifsInode->clientCanCacheAll = TRUE; | 451 | pCifsInode->clientCanCacheAll = true; |
452 | pCifsInode->clientCanCacheRead = TRUE; | 452 | pCifsInode->clientCanCacheRead = true; |
453 | cFYI(1, ("Exclusive Oplock granted on inode %p", | 453 | cFYI(1, ("Exclusive Oplock granted on inode %p", |
454 | file->f_path.dentry->d_inode)); | 454 | file->f_path.dentry->d_inode)); |
455 | } else if ((oplock & 0xF) == OPLOCK_READ) { | 455 | } else if ((oplock & 0xF) == OPLOCK_READ) { |
456 | pCifsInode->clientCanCacheRead = TRUE; | 456 | pCifsInode->clientCanCacheRead = true; |
457 | pCifsInode->clientCanCacheAll = FALSE; | 457 | pCifsInode->clientCanCacheAll = false; |
458 | } else { | 458 | } else { |
459 | pCifsInode->clientCanCacheRead = FALSE; | 459 | pCifsInode->clientCanCacheRead = false; |
460 | pCifsInode->clientCanCacheAll = FALSE; | 460 | pCifsInode->clientCanCacheAll = false; |
461 | } | 461 | } |
462 | cifs_relock_file(pCifsFile); | 462 | cifs_relock_file(pCifsFile); |
463 | } | 463 | } |
@@ -484,7 +484,7 @@ int cifs_close(struct inode *inode, struct file *file) | |||
484 | if (pSMBFile) { | 484 | if (pSMBFile) { |
485 | struct cifsLockInfo *li, *tmp; | 485 | struct cifsLockInfo *li, *tmp; |
486 | 486 | ||
487 | pSMBFile->closePend = TRUE; | 487 | pSMBFile->closePend = true; |
488 | if (pTcon) { | 488 | if (pTcon) { |
489 | /* no sense reconnecting to close a file that is | 489 | /* no sense reconnecting to close a file that is |
490 | already closed */ | 490 | already closed */ |
@@ -553,8 +553,8 @@ int cifs_close(struct inode *inode, struct file *file) | |||
553 | cFYI(1, ("closing last open instance for inode %p", inode)); | 553 | cFYI(1, ("closing last open instance for inode %p", inode)); |
554 | /* if the file is not open we do not know if we can cache info | 554 | /* if the file is not open we do not know if we can cache info |
555 | on this inode, much less write behind and read ahead */ | 555 | on this inode, much less write behind and read ahead */ |
556 | CIFS_I(inode)->clientCanCacheRead = FALSE; | 556 | CIFS_I(inode)->clientCanCacheRead = false; |
557 | CIFS_I(inode)->clientCanCacheAll = FALSE; | 557 | CIFS_I(inode)->clientCanCacheAll = false; |
558 | } | 558 | } |
559 | read_unlock(&GlobalSMBSeslock); | 559 | read_unlock(&GlobalSMBSeslock); |
560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) | 560 | if ((rc == 0) && CIFS_I(inode)->write_behind_rc) |
@@ -583,9 +583,9 @@ int cifs_closedir(struct inode *inode, struct file *file) | |||
583 | pTcon = cifs_sb->tcon; | 583 | pTcon = cifs_sb->tcon; |
584 | 584 | ||
585 | cFYI(1, ("Freeing private data in close dir")); | 585 | cFYI(1, ("Freeing private data in close dir")); |
586 | if ((pCFileStruct->srch_inf.endOfSearch == FALSE) && | 586 | if (!pCFileStruct->srch_inf.endOfSearch && |
587 | (pCFileStruct->invalidHandle == FALSE)) { | 587 | !pCFileStruct->invalidHandle) { |
588 | pCFileStruct->invalidHandle = TRUE; | 588 | pCFileStruct->invalidHandle = true; |
589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); | 589 | rc = CIFSFindClose(xid, pTcon, pCFileStruct->netfid); |
590 | cFYI(1, ("Closing uncompleted readdir with rc %d", | 590 | cFYI(1, ("Closing uncompleted readdir with rc %d", |
591 | rc)); | 591 | rc)); |
@@ -637,12 +637,12 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
637 | __u32 numLock = 0; | 637 | __u32 numLock = 0; |
638 | __u32 numUnlock = 0; | 638 | __u32 numUnlock = 0; |
639 | __u64 length; | 639 | __u64 length; |
640 | int wait_flag = FALSE; | 640 | bool wait_flag = false; |
641 | struct cifs_sb_info *cifs_sb; | 641 | struct cifs_sb_info *cifs_sb; |
642 | struct cifsTconInfo *pTcon; | 642 | struct cifsTconInfo *pTcon; |
643 | __u16 netfid; | 643 | __u16 netfid; |
644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; | 644 | __u8 lockType = LOCKING_ANDX_LARGE_FILES; |
645 | int posix_locking; | 645 | bool posix_locking; |
646 | 646 | ||
647 | length = 1 + pfLock->fl_end - pfLock->fl_start; | 647 | length = 1 + pfLock->fl_end - pfLock->fl_start; |
648 | rc = -EACCES; | 648 | rc = -EACCES; |
@@ -659,7 +659,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
659 | cFYI(1, ("Flock")); | 659 | cFYI(1, ("Flock")); |
660 | if (pfLock->fl_flags & FL_SLEEP) { | 660 | if (pfLock->fl_flags & FL_SLEEP) { |
661 | cFYI(1, ("Blocking lock")); | 661 | cFYI(1, ("Blocking lock")); |
662 | wait_flag = TRUE; | 662 | wait_flag = true; |
663 | } | 663 | } |
664 | if (pfLock->fl_flags & FL_ACCESS) | 664 | if (pfLock->fl_flags & FL_ACCESS) |
665 | cFYI(1, ("Process suspended by mandatory locking - " | 665 | cFYI(1, ("Process suspended by mandatory locking - " |
@@ -794,7 +794,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) | |||
794 | stored_rc = CIFSSMBLock(xid, pTcon, | 794 | stored_rc = CIFSSMBLock(xid, pTcon, |
795 | netfid, | 795 | netfid, |
796 | li->length, li->offset, | 796 | li->length, li->offset, |
797 | 1, 0, li->type, FALSE); | 797 | 1, 0, li->type, false); |
798 | if (stored_rc) | 798 | if (stored_rc) |
799 | rc = stored_rc; | 799 | rc = stored_rc; |
800 | 800 | ||
@@ -866,7 +866,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data, | |||
866 | filemap_fdatawait from here so tell | 866 | filemap_fdatawait from here so tell |
867 | reopen_file not to flush data to server | 867 | reopen_file not to flush data to server |
868 | now */ | 868 | now */ |
869 | rc = cifs_reopen_file(file, FALSE); | 869 | rc = cifs_reopen_file(file, false); |
870 | if (rc != 0) | 870 | if (rc != 0) |
871 | break; | 871 | break; |
872 | } | 872 | } |
@@ -966,7 +966,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data, | |||
966 | filemap_fdatawait from here so tell | 966 | filemap_fdatawait from here so tell |
967 | reopen_file not to flush data to | 967 | reopen_file not to flush data to |
968 | server now */ | 968 | server now */ |
969 | rc = cifs_reopen_file(file, FALSE); | 969 | rc = cifs_reopen_file(file, false); |
970 | if (rc != 0) | 970 | if (rc != 0) |
971 | break; | 971 | break; |
972 | } | 972 | } |
@@ -1093,7 +1093,7 @@ refind_writable: | |||
1093 | 1093 | ||
1094 | read_unlock(&GlobalSMBSeslock); | 1094 | read_unlock(&GlobalSMBSeslock); |
1095 | /* Had to unlock since following call can block */ | 1095 | /* Had to unlock since following call can block */ |
1096 | rc = cifs_reopen_file(open_file->pfile, FALSE); | 1096 | rc = cifs_reopen_file(open_file->pfile, false); |
1097 | if (!rc) { | 1097 | if (!rc) { |
1098 | if (!open_file->closePend) | 1098 | if (!open_file->closePend) |
1099 | return open_file; | 1099 | return open_file; |
@@ -1608,7 +1608,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1608 | int buf_type = CIFS_NO_BUFFER; | 1608 | int buf_type = CIFS_NO_BUFFER; |
1609 | if ((open_file->invalidHandle) && | 1609 | if ((open_file->invalidHandle) && |
1610 | (!open_file->closePend)) { | 1610 | (!open_file->closePend)) { |
1611 | rc = cifs_reopen_file(file, TRUE); | 1611 | rc = cifs_reopen_file(file, true); |
1612 | if (rc != 0) | 1612 | if (rc != 0) |
1613 | break; | 1613 | break; |
1614 | } | 1614 | } |
@@ -1693,7 +1693,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size, | |||
1693 | while (rc == -EAGAIN) { | 1693 | while (rc == -EAGAIN) { |
1694 | if ((open_file->invalidHandle) && | 1694 | if ((open_file->invalidHandle) && |
1695 | (!open_file->closePend)) { | 1695 | (!open_file->closePend)) { |
1696 | rc = cifs_reopen_file(file, TRUE); | 1696 | rc = cifs_reopen_file(file, true); |
1697 | if (rc != 0) | 1697 | if (rc != 0) |
1698 | break; | 1698 | break; |
1699 | } | 1699 | } |
@@ -1850,7 +1850,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping, | |||
1850 | while (rc == -EAGAIN) { | 1850 | while (rc == -EAGAIN) { |
1851 | if ((open_file->invalidHandle) && | 1851 | if ((open_file->invalidHandle) && |
1852 | (!open_file->closePend)) { | 1852 | (!open_file->closePend)) { |
1853 | rc = cifs_reopen_file(file, TRUE); | 1853 | rc = cifs_reopen_file(file, true); |
1854 | if (rc != 0) | 1854 | if (rc != 0) |
1855 | break; | 1855 | break; |
1856 | } | 1856 | } |
@@ -2009,10 +2009,10 @@ static int is_inode_writable(struct cifsInodeInfo *cifs_inode) | |||
2009 | refreshing the inode only on increases in the file size | 2009 | refreshing the inode only on increases in the file size |
2010 | but this is tricky to do without racing with writebehind | 2010 | but this is tricky to do without racing with writebehind |
2011 | page caching in the current Linux kernel design */ | 2011 | page caching in the current Linux kernel design */ |
2012 | int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | 2012 | bool is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) |
2013 | { | 2013 | { |
2014 | if (!cifsInode) | 2014 | if (!cifsInode) |
2015 | return 1; | 2015 | return true; |
2016 | 2016 | ||
2017 | if (is_inode_writable(cifsInode)) { | 2017 | if (is_inode_writable(cifsInode)) { |
2018 | /* This inode is open for write at least once */ | 2018 | /* This inode is open for write at least once */ |
@@ -2022,15 +2022,15 @@ int is_size_safe_to_change(struct cifsInodeInfo *cifsInode, __u64 end_of_file) | |||
2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 2022 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
2023 | /* since no page cache to corrupt on directio | 2023 | /* since no page cache to corrupt on directio |
2024 | we can change size safely */ | 2024 | we can change size safely */ |
2025 | return 1; | 2025 | return true; |
2026 | } | 2026 | } |
2027 | 2027 | ||
2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) | 2028 | if (i_size_read(&cifsInode->vfs_inode) < end_of_file) |
2029 | return 1; | 2029 | return true; |
2030 | 2030 | ||
2031 | return 0; | 2031 | return false; |
2032 | } else | 2032 | } else |
2033 | return 1; | 2033 | return true; |
2034 | } | 2034 | } |
2035 | 2035 | ||
2036 | static int cifs_prepare_write(struct file *file, struct page *page, | 2036 | static int cifs_prepare_write(struct file *file, struct page *page, |