Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Unified Diff: services/files/c/lib/mojio_unistd.cc

Issue 1133933002: Move //services/files/c -> //mojo/services/files/public/c. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: remove data dep Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/files/c/lib/mojio_sys_stat.cc ('k') | services/files/c/lib/real_errno_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/files/c/lib/mojio_unistd.cc
diff --git a/services/files/c/lib/mojio_unistd.cc b/services/files/c/lib/mojio_unistd.cc
deleted file mode 100644
index f31897a29d5cafdd6065739babec27193037606c..0000000000000000000000000000000000000000
--- a/services/files/c/lib/mojio_unistd.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2015 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.
-
-#include "services/files/c/mojio_unistd.h"
-
-#include <memory>
-#include <utility>
-
-#include "services/files/c/lib/directory_wrapper.h"
-#include "services/files/c/lib/fd_impl.h"
-#include "services/files/c/lib/fd_table.h"
-#include "services/files/c/lib/singletons.h"
-
-namespace mojio {
-namespace {
-
-int ChdirImpl(const char* path) {
- DirectoryWrapper* cwd = singletons::GetCurrentWorkingDirectory();
- if (!cwd)
- return -1;
-
- return cwd->Chdir(path) ? 0 : -1;
-}
-
-int CloseImpl(int fd) {
- std::unique_ptr<FDImpl> fd_impl(singletons::GetFDTable()->Remove(fd));
- if (!fd_impl)
- return -1;
-
- return fd_impl->Close() ? 0 : -1;
-}
-
-int DupImpl(int fd) {
- FDImpl* fd_impl = singletons::GetFDTable()->Get(fd);
- if (!fd_impl)
- return -1;
-
- std::unique_ptr<FDImpl> new_fd_impl(fd_impl->Dup());
- if (!new_fd_impl)
- return -1;
-
- return singletons::GetFDTable()->Add(std::move(new_fd_impl));
-}
-
-int FtruncateImpl(int fd, mojio_off_t length) {
- FDImpl* fd_impl = singletons::GetFDTable()->Get(fd);
- if (!fd_impl)
- return -1;
-
- return fd_impl->Ftruncate(length) ? 0 : -1;
-}
-
-mojio_off_t LseekImpl(int fd, mojio_off_t offset, int whence) {
- FDImpl* fd_impl = singletons::GetFDTable()->Get(fd);
- if (!fd_impl)
- return -1;
-
- return fd_impl->Lseek(offset, whence);
-}
-
-mojio_ssize_t ReadImpl(int fd, void* buf, size_t count) {
- FDImpl* fd_impl = singletons::GetFDTable()->Get(fd);
- if (!fd_impl)
- return -1;
-
- return fd_impl->Read(buf, count);
-}
-
-mojio_ssize_t WriteImpl(int fd, const void* buf, size_t count) {
- FDImpl* fd_impl = singletons::GetFDTable()->Get(fd);
- if (!fd_impl)
- return -1;
-
- return fd_impl->Write(buf, count);
-}
-
-} // namespace
-} // namespace mojio
-
-extern "C" {
-
-int mojio_chdir(const char* path) {
- return mojio::ChdirImpl(path);
-}
-
-int mojio_close(int fd) {
- return mojio::CloseImpl(fd);
-}
-
-int mojio_dup(int fd) {
- return mojio::DupImpl(fd);
-}
-
-int mojio_ftruncate(int fd, mojio_off_t length) {
- return mojio::FtruncateImpl(fd, length);
-}
-
-mojio_off_t mojio_lseek(int fd, mojio_off_t offset, int whence) {
- return mojio::LseekImpl(fd, offset, whence);
-}
-
-mojio_ssize_t mojio_read(int fd, void* buf, size_t count) {
- return mojio::ReadImpl(fd, buf, count);
-}
-
-mojio_ssize_t mojio_write(int fd, const void* buf, size_t count) {
- return mojio::WriteImpl(fd, buf, count);
-}
-
-} // extern "C"
« no previous file with comments | « services/files/c/lib/mojio_sys_stat.cc ('k') | services/files/c/lib/real_errno_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698