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

Unified Diff: native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc

Issue 414993002: [NaCl SDK] nacl_io: Remove duplication between passthroughfs and devfs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
diff --git a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
index efe805525cc5669a58f3b87d43a529e07a264a60..6dd764241948aaf37c80a2d62305f44d91e86e64 100644
--- a/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
+++ b/native_client_sdk/src/libraries/nacl_io/devfs/dev_fs.cc
@@ -20,6 +20,7 @@
#include "nacl_io/kernel_wrap_real.h"
#include "nacl_io/node.h"
#include "nacl_io/osunistd.h"
+#include "nacl_io/passthroughfs/real_node.h"
#include "nacl_io/pepper_interface.h"
#include "sdk_util/auto_lock.h"
@@ -33,24 +34,6 @@ namespace nacl_io {
namespace {
-class RealNode : public Node {
- public:
- RealNode(Filesystem* filesystem, int fd);
-
- virtual Error Read(const HandleAttr& attr,
- void* buf,
- size_t count,
- int* out_bytes);
- virtual Error Write(const HandleAttr& attr,
- const void* buf,
- size_t count,
- int* out_bytes);
- virtual Error GetStat(struct stat* stat);
-
- protected:
- int fd_;
-};
-
class NullNode : public CharNode {
public:
explicit NullNode(Filesystem* filesystem) : CharNode(filesystem) {}
@@ -125,44 +108,6 @@ class FsNode : public Node {
Filesystem* other_fs_;
};
-RealNode::RealNode(Filesystem* filesystem, int fd) : Node(filesystem), fd_(fd) {
- SetType(S_IFCHR);
-}
-
-Error RealNode::Read(const HandleAttr& attr,
- void* buf,
- size_t count,
- int* out_bytes) {
- *out_bytes = 0;
-
- size_t readcnt;
- int err = _real_read(fd_, buf, count, &readcnt);
- if (err)
- return err;
-
- *out_bytes = static_cast<int>(readcnt);
- return 0;
-}
-
-Error RealNode::Write(const HandleAttr& attr,
- const void* buf,
- size_t count,
- int* out_bytes) {
- *out_bytes = 0;
-
- size_t writecnt;
- int err = _real_write(fd_, buf, count, &writecnt);
- if (err)
- return err;
-
- *out_bytes = static_cast<int>(writecnt);
- return 0;
-}
-
-Error RealNode::GetStat(struct stat* stat) {
- return _real_fstat(fd_, stat);
-}
-
Error NullNode::Read(const HandleAttr& attr,
void* buf,
size_t count,

Powered by Google App Engine
This is Rietveld 408576698