OLD | NEW |
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved. | 1 // Copyright (c) 2011 The LevelDB 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. See the AUTHORS file for names of contributors. | 3 // found in the LICENSE file. See the AUTHORS file for names of contributors. |
4 | 4 |
5 #include <errno.h> | 5 #include <errno.h> |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 if (parent_fd < 0) { | 530 if (parent_fd < 0) { |
531 int saved_errno = errno; | 531 int saved_errno = errno; |
532 return MakeIOError( | 532 return MakeIOError( |
533 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno); | 533 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno); |
534 } | 534 } |
535 if (HANDLE_EINTR(fsync(parent_fd)) != 0) { | 535 if (HANDLE_EINTR(fsync(parent_fd)) != 0) { |
536 int saved_errno = errno; | 536 int saved_errno = errno; |
537 s = MakeIOError( | 537 s = MakeIOError( |
538 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno); | 538 parent_dir_, strerror(saved_errno), kSyncParent, saved_errno); |
539 }; | 539 }; |
540 HANDLE_EINTR(close(parent_fd)); | 540 close(parent_fd); |
541 #endif | 541 #endif |
542 return s; | 542 return s; |
543 } | 543 } |
544 | 544 |
545 Status ChromiumWritableFile::Append(const Slice& data) { | 545 Status ChromiumWritableFile::Append(const Slice& data) { |
546 if (file_type_ == kManifest && tracker_->DoesDirNeedSync(filename_)) { | 546 if (file_type_ == kManifest && tracker_->DoesDirNeedSync(filename_)) { |
547 Status s = SyncParent(); | 547 Status s = SyncParent(); |
548 if (!s.ok()) | 548 if (!s.ok()) |
549 return s; | 549 return s; |
550 tracker_->DidSyncDir(filename_); | 550 tracker_->DidSyncDir(filename_); |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 Env* IDBEnv() { | 1203 Env* IDBEnv() { |
1204 return leveldb_env::idb_env.Pointer(); | 1204 return leveldb_env::idb_env.Pointer(); |
1205 } | 1205 } |
1206 | 1206 |
1207 Env* Env::Default() { | 1207 Env* Env::Default() { |
1208 return leveldb_env::default_env.Pointer(); | 1208 return leveldb_env::default_env.Pointer(); |
1209 } | 1209 } |
1210 | 1210 |
1211 } // namespace leveldb | 1211 } // namespace leveldb |
1212 | 1212 |
OLD | NEW |