OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROMECAST_BASE_FILE_UTILS_H_ |
| 6 #define CHROMECAST_BASE_FILE_UTILS_H_ |
| 7 |
| 8 #include "base/files/file_path.h" |
| 9 |
| 10 namespace chromecast { |
| 11 |
| 12 // Lock a file (blocking request) with filepath |path|. Returns the file |
| 13 // descriptor on success, an invalid file descriptor (-1) on failure. Failure |
| 14 // indicates that |path| does not exist, or the locking procedure failed. |
| 15 // A true |write| value opens the file in RW mode, false opens in R-only. |
| 16 int OpenAndLockFile(const base::FilePath& path, bool write); |
| 17 |
| 18 // Unlock a file (blocking request) denoted by file descriptor |fd|. Returns |
| 19 // true on success, false on failure. |
| 20 bool UnlockAndCloseFile(const int fd); |
| 21 |
| 22 } // namespace chromecast |
| 23 |
| 24 #endif // CHROMECAST_BASE_FILE_UTILS_H_ |
OLD | NEW |