ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / passthroughfs / passthrough_fs.cc
blobabee3894e866fab547d9b777c29ce0bbe3b8280e
1 // Copyright 2013 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.
5 #include "nacl_io/passthroughfs/passthrough_fs.h"
7 #include <errno.h>
9 #include "nacl_io/kernel_handle.h"
10 #include "nacl_io/kernel_wrap_real.h"
11 #include "nacl_io/passthroughfs/real_node.h"
13 namespace nacl_io {
15 PassthroughFs::PassthroughFs() {
18 Error PassthroughFs::Init(const FsInitArgs& args) {
19 return Filesystem::Init(args);
22 void PassthroughFs::Destroy() {
25 Error PassthroughFs::OpenWithMode(const Path& path, int open_flags,
26 mode_t mode, ScopedNode* out_node) {
27 out_node->reset(NULL);
28 int real_fd;
29 int error = _real_open(path.Join().c_str(), open_flags, mode, &real_fd);
30 if (error)
31 return error;
33 out_node->reset(new RealNode(this, real_fd, true));
34 return 0;
37 Error PassthroughFs::OpenResource(const Path& path, ScopedNode* out_node) {
38 int real_fd;
39 out_node->reset(NULL);
40 int error = _real_open_resource(path.Join().c_str(), &real_fd);
41 if (error)
42 return error;
44 out_node->reset(new RealNode(this, real_fd));
45 return 0;
48 Error PassthroughFs::Unlink(const Path& path) {
49 // Not implemented by NaCl.
50 return ENOSYS;
53 Error PassthroughFs::Mkdir(const Path& path, int perm) {
54 return _real_mkdir(path.Join().c_str(), perm);
57 Error PassthroughFs::Rmdir(const Path& path) {
58 return _real_rmdir(path.Join().c_str());
61 Error PassthroughFs::Remove(const Path& path) {
62 // Not implemented by NaCl.
63 return ENOSYS;
66 Error PassthroughFs::Rename(const Path& path, const Path& newpath) {
67 // Not implemented by NaCl.
68 return ENOSYS;
71 } // namespace nacl_io