| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file contains utility functions for dealing with the local | 5 // This file contains utility functions for dealing with the local |
| 6 // filesystem. | 6 // filesystem. |
| 7 | 7 |
| 8 #ifndef BASE_FILE_UTIL_H_ | 8 #ifndef BASE_FILE_UTIL_H_ |
| 9 #define BASE_FILE_UTIL_H_ | 9 #define BASE_FILE_UTIL_H_ |
| 10 | 10 |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 }; | 407 }; |
| 408 | 408 |
| 409 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE; | 409 typedef scoped_ptr_malloc<FILE, ScopedFILEClose> ScopedFILE; |
| 410 | 410 |
| 411 #if defined(OS_POSIX) | 411 #if defined(OS_POSIX) |
| 412 // A class to handle auto-closing of FDs. | 412 // A class to handle auto-closing of FDs. |
| 413 class ScopedFDClose { | 413 class ScopedFDClose { |
| 414 public: | 414 public: |
| 415 inline void operator()(int* x) const { | 415 inline void operator()(int* x) const { |
| 416 if (x && *x >= 0) { | 416 if (x && *x >= 0) { |
| 417 if (HANDLE_EINTR(close(*x)) < 0) | 417 if (IGNORE_EINTR(close(*x)) < 0) |
| 418 DPLOG(ERROR) << "close"; | 418 DPLOG(ERROR) << "close"; |
| 419 } | 419 } |
| 420 } | 420 } |
| 421 }; | 421 }; |
| 422 | 422 |
| 423 typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD; | 423 typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD; |
| 424 #endif // OS_POSIX | 424 #endif // OS_POSIX |
| 425 | 425 |
| 426 #if defined(OS_LINUX) | 426 #if defined(OS_LINUX) |
| 427 // Broad categories of file systems as returned by statfs() on Linux. | 427 // Broad categories of file systems as returned by statfs() on Linux. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 // This function simulates Move(), but unlike Move() it works across volumes. | 467 // This function simulates Move(), but unlike Move() it works across volumes. |
| 468 // This function is not transactional. | 468 // This function is not transactional. |
| 469 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, | 469 BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path, |
| 470 const FilePath& to_path); | 470 const FilePath& to_path); |
| 471 #endif // defined(OS_WIN) | 471 #endif // defined(OS_WIN) |
| 472 | 472 |
| 473 } // namespace internal | 473 } // namespace internal |
| 474 } // namespace base | 474 } // namespace base |
| 475 | 475 |
| 476 #endif // BASE_FILE_UTIL_H_ | 476 #endif // BASE_FILE_UTIL_H_ |
| OLD | NEW |