Chromium Code Reviews| Index: chromecast/base/file_utils.h |
| diff --git a/chromecast/base/file_utils.h b/chromecast/base/file_utils.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a4a3ada7e317b1ea318572e8f2d33bf53c5b244f |
| --- /dev/null |
| +++ b/chromecast/base/file_utils.h |
| @@ -0,0 +1,23 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_BASE_FILE_UTILS_H_ |
| +#define CHROMECAST_BASE_FILE_UTILS_H_ |
| + |
| +#include "base/files/file_path.h" |
| + |
| +namespace chromecast { |
| + |
| +// Lock a file (blocking request) with filepath |path|. Returns the file |
| +// descriptor on success, an invalid file descriptor (-1) on failure. Failure |
| +// indicates that |path| does not exist, or the locking procedure failed. |
| +int OpenAndLockFile(const base::FilePath& path); |
|
slan
2016/08/08 16:37:10
What is the expectation if the file does not exist
ameyak
2016/08/08 18:00:43
Returns invalid file descriptor (-1)
slan
2016/08/08 18:32:19
Oh, it's right there in the comment.
https://i.yt
|
| + |
| +// Unlock a file (blocking request) denoted by file descriptor |fd|. Returns |
| +// true on success, false on failure. |
| +bool UnlockAndCloseFile(const int fd); |
| + |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_BASE_FILE_UTILS_H_ |