summaryrefslogtreecommitdiffstats
path: root/base/platform_file_posix.cc
diff options
context:
space:
mode:
authorrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-15 18:56:45 +0000
committerrvargas@chromium.org <rvargas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-15 18:56:45 +0000
commit55c27fe14f688d44fa3f85568847e5b839e7eae3 (patch)
tree6fcf29ec974c607fed2d0c54b0584ab356b1d73a /base/platform_file_posix.cc
parent099f9c7d29ad787ed2e5990eb9981b72cdb04463 (diff)
downloadchromium_src-55c27fe14f688d44fa3f85568847e5b839e7eae3.zip
chromium_src-55c27fe14f688d44fa3f85568847e5b839e7eae3.tar.gz
chromium_src-55c27fe14f688d44fa3f85568847e5b839e7eae3.tar.bz2
Remove CreatePlatformFile
BUG=322664 Review URL: https://codereview.chromium.org/227603007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/platform_file_posix.cc')
-rw-r--r--base/platform_file_posix.cc95
1 files changed, 0 insertions, 95 deletions
diff --git a/base/platform_file_posix.cc b/base/platform_file_posix.cc
index 3ecb0aa..ff92b90 100644
--- a/base/platform_file_posix.cc
+++ b/base/platform_file_posix.cc
@@ -119,101 +119,6 @@ static PlatformFileError CallFctnlFlock(PlatformFile file, bool do_lock) {
// NaCl doesn't implement system calls to open files directly.
#if !defined(OS_NACL)
-// TODO(erikkay): does it make sense to support PLATFORM_FILE_EXCLUSIVE_* here?
-PlatformFile CreatePlatformFileUnsafe(const FilePath& name,
- int flags,
- bool* created,
- PlatformFileError* error) {
- base::ThreadRestrictions::AssertIOAllowed();
-
- int open_flags = 0;
- if (flags & PLATFORM_FILE_CREATE)
- open_flags = O_CREAT | O_EXCL;
-
- if (created)
- *created = false;
-
- if (flags & PLATFORM_FILE_CREATE_ALWAYS) {
- DCHECK(!open_flags);
- open_flags = O_CREAT | O_TRUNC;
- }
-
- if (flags & PLATFORM_FILE_OPEN_TRUNCATED) {
- DCHECK(!open_flags);
- DCHECK(flags & PLATFORM_FILE_WRITE);
- open_flags = O_TRUNC;
- }
-
- if (!open_flags && !(flags & PLATFORM_FILE_OPEN) &&
- !(flags & PLATFORM_FILE_OPEN_ALWAYS)) {
- NOTREACHED();
- errno = EOPNOTSUPP;
- if (error)
- *error = PLATFORM_FILE_ERROR_FAILED;
- return kInvalidPlatformFileValue;
- }
-
- if (flags & PLATFORM_FILE_WRITE && flags & PLATFORM_FILE_READ) {
- open_flags |= O_RDWR;
- } else if (flags & PLATFORM_FILE_WRITE) {
- open_flags |= O_WRONLY;
- } else if (!(flags & PLATFORM_FILE_READ) &&
- !(flags & PLATFORM_FILE_WRITE_ATTRIBUTES) &&
- !(flags & PLATFORM_FILE_APPEND) &&
- !(flags & PLATFORM_FILE_OPEN_ALWAYS)) {
- NOTREACHED();
- }
-
- if (flags & PLATFORM_FILE_TERMINAL_DEVICE)
- open_flags |= O_NOCTTY | O_NDELAY;
-
- if (flags & PLATFORM_FILE_APPEND && flags & PLATFORM_FILE_READ)
- open_flags |= O_APPEND | O_RDWR;
- else if (flags & PLATFORM_FILE_APPEND)
- open_flags |= O_APPEND | O_WRONLY;
-
- COMPILE_ASSERT(O_RDONLY == 0, O_RDONLY_must_equal_zero);
-
- int mode = S_IRUSR | S_IWUSR;
-#if defined(OS_CHROMEOS)
- mode |= S_IRGRP | S_IROTH;
-#endif
-
- int descriptor =
- HANDLE_EINTR(open(name.value().c_str(), open_flags, mode));
-
- if (flags & PLATFORM_FILE_OPEN_ALWAYS) {
- if (descriptor < 0) {
- open_flags |= O_CREAT;
- if (flags & PLATFORM_FILE_EXCLUSIVE_READ ||
- flags & PLATFORM_FILE_EXCLUSIVE_WRITE) {
- open_flags |= O_EXCL; // together with O_CREAT implies O_NOFOLLOW
- }
- descriptor = HANDLE_EINTR(
- open(name.value().c_str(), open_flags, mode));
- if (created && descriptor >= 0)
- *created = true;
- }
- }
-
- if (created && (descriptor >= 0) &&
- (flags & (PLATFORM_FILE_CREATE_ALWAYS | PLATFORM_FILE_CREATE)))
- *created = true;
-
- if ((descriptor >= 0) && (flags & PLATFORM_FILE_DELETE_ON_CLOSE)) {
- unlink(name.value().c_str());
- }
-
- if (error) {
- if (descriptor >= 0)
- *error = PLATFORM_FILE_OK;
- else
- *error = ErrnoToPlatformFileError(errno);
- }
-
- return descriptor;
-}
-
FILE* FdopenPlatformFile(PlatformFile file, const char* mode) {
return fdopen(file, mode);
}