Lines Matching refs:File
3 // found in the LICENSE file.
5 #include "base/files/file.h"
28 COMPILE_ASSERT(File::FROM_BEGIN == SEEK_SET &&
29 File::FROM_CURRENT == SEEK_CUR &&
30 File::FROM_END == SEEK_END, whence_matches_system);
47 // wrap them in order to minimize the number of #ifdef's in this file.
49 static bool IsOpenAppend(PlatformFile file) {
50 return (fcntl(file, F_GETFL) & O_APPEND) != 0;
53 static int CallFtruncate(PlatformFile file, int64 length) {
54 return HANDLE_EINTR(ftruncate(file, length));
57 static int CallFsync(PlatformFile file) {
58 return HANDLE_EINTR(fsync(file));
61 static int CallFutimes(PlatformFile file, const struct timeval times[2]) {
72 return futimens(file, ts_times);
74 return futimes(file, times);
78 static File::Error CallFctnlFlock(PlatformFile file, bool do_lock) {
83 lock.l_len = 0; // Lock entire file.
84 if (HANDLE_EINTR(fcntl(file, do_lock ? F_SETLK : F_UNLCK, &lock)) == -1)
85 return File::OSErrorToFileError(errno);
86 return File::FILE_OK;
90 static bool IsOpenAppend(PlatformFile file) {
92 // standard and always appends if the file is opened with O_APPEND, just
97 static int CallFtruncate(PlatformFile file, int64 length) {
102 static int CallFsync(PlatformFile file) {
107 static int CallFutimes(PlatformFile file, const struct timeval times[2]) {
112 static File::Error CallFctnlFlock(PlatformFile file, bool do_lock) {
114 return File::FILE_ERROR_INVALID_OPERATION;
120 void File::Info::FromStat(const stat_wrapper_t& stat_info) {
174 void File::InitializeUnsafe(const FilePath& name, uint32 flags) {
244 error_details_ = File::OSErrorToFileError(errno);
260 bool File::IsValid() const {
264 PlatformFile File::GetPlatformFile() const {
268 PlatformFile File::TakePlatformFile() {
272 void File::Close() {
280 int64 File::Seek(Whence whence, int64 offset) {
290 int File::Read(int64 offset, char* data, int size) {
310 int File::ReadAtCurrentPos(char* data, int size) {
329 int File::ReadNoBestEffort(int64 offset, char* data, int size) {
336 int File::ReadAtCurrentPosNoBestEffort(char* data, int size) {
345 int File::Write(int64 offset, const char* data, int size) {
369 int File::WriteAtCurrentPos(const char* data, int size) {
389 int File::WriteAtCurrentPosNoBestEffort(const char* data, int size) {
398 int64 File::GetLength() {
408 bool File::SetLength(int64 length) {
414 bool File::Flush() {
420 bool File::SetTimes(Time last_access_time, Time last_modified_time) {
431 bool File::GetInfo(Info* info) {
442 File::Error File::Lock() {
446 File::Error File::Unlock() {
451 File::Error File::OSErrorToFileError(int saved_errno) {
483 void File::SetPlatformFile(PlatformFile file) {
485 file_.reset(file);