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 #pragma once | 10 #pragma once |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 size_t length_; | 610 size_t length_; |
611 | 611 |
612 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile); | 612 DISALLOW_COPY_AND_ASSIGN(MemoryMappedFile); |
613 }; | 613 }; |
614 | 614 |
615 // Returns whether the file has been modified since a particular date. | 615 // Returns whether the file has been modified since a particular date. |
616 BASE_EXPORT bool HasFileBeenModifiedSince( | 616 BASE_EXPORT bool HasFileBeenModifiedSince( |
617 const FileEnumerator::FindInfo& find_info, | 617 const FileEnumerator::FindInfo& find_info, |
618 const base::Time& cutoff_time); | 618 const base::Time& cutoff_time); |
619 | 619 |
620 #if defined(OS_WIN) | |
621 // Loads the file passed in as an image section and touches pages to avoid | |
622 // subsequent hard page faults during LoadLibrary. The size to be pre read | |
623 // is passed in. If it is 0 then the whole file is paged in. The step size | |
624 // which indicates the number of bytes to skip after every page touched is | |
625 // also passed in. | |
626 bool BASE_EXPORT PreReadImage(const wchar_t* file_path, size_t size_to_read, | |
627 size_t step_size); | |
628 #endif // OS_WIN | |
629 | |
630 #if defined(OS_LINUX) | 620 #if defined(OS_LINUX) |
631 // Broad categories of file systems as returned by statfs() on Linux. | 621 // Broad categories of file systems as returned by statfs() on Linux. |
632 enum FileSystemType { | 622 enum FileSystemType { |
633 FILE_SYSTEM_UNKNOWN, // statfs failed. | 623 FILE_SYSTEM_UNKNOWN, // statfs failed. |
634 FILE_SYSTEM_0, // statfs.f_type == 0 means unknown, may indicate AFS. | 624 FILE_SYSTEM_0, // statfs.f_type == 0 means unknown, may indicate AFS. |
635 FILE_SYSTEM_ORDINARY, // on-disk filesystem like ext2 | 625 FILE_SYSTEM_ORDINARY, // on-disk filesystem like ext2 |
636 FILE_SYSTEM_NFS, | 626 FILE_SYSTEM_NFS, |
637 FILE_SYSTEM_SMB, | 627 FILE_SYSTEM_SMB, |
638 FILE_SYSTEM_CODA, | 628 FILE_SYSTEM_CODA, |
639 FILE_SYSTEM_MEMORY, // in-memory file system | 629 FILE_SYSTEM_MEMORY, // in-memory file system |
640 FILE_SYSTEM_CGROUP, // cgroup control. | 630 FILE_SYSTEM_CGROUP, // cgroup control. |
641 FILE_SYSTEM_OTHER, // any other value. | 631 FILE_SYSTEM_OTHER, // any other value. |
642 FILE_SYSTEM_TYPE_COUNT | 632 FILE_SYSTEM_TYPE_COUNT |
643 }; | 633 }; |
644 | 634 |
645 // Attempts determine the FileSystemType for |path|. | 635 // Attempts determine the FileSystemType for |path|. |
646 // Returns false if |path| doesn't exist. | 636 // Returns false if |path| doesn't exist. |
647 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); | 637 BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type); |
648 #endif | 638 #endif |
649 | 639 |
650 } // namespace file_util | 640 } // namespace file_util |
651 | 641 |
652 // Deprecated functions have been moved to this separate header file, | 642 // Deprecated functions have been moved to this separate header file, |
653 // which must be included last after all the above definitions. | 643 // which must be included last after all the above definitions. |
654 #include "base/file_util_deprecated.h" | 644 #include "base/file_util_deprecated.h" |
655 | 645 |
656 #endif // BASE_FILE_UTIL_H_ | 646 #endif // BASE_FILE_UTIL_H_ |
OLD | NEW |