| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(WIN32) | 5 #if defined(WIN32) |
| 6 #define _CRT_RAND_S | 6 #define _CRT_RAND_S |
| 7 #endif | 7 #endif |
| 8 | 8 |
| 9 #include "nacl_io/devfs/dev_fs.h" | 9 #include "nacl_io/devfs/dev_fs.h" |
| 10 | 10 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 FsNode::FsNode(Filesystem* filesystem, Filesystem* other_fs) | 233 FsNode::FsNode(Filesystem* filesystem, Filesystem* other_fs) |
| 234 : Node(filesystem), other_fs_(other_fs) { | 234 : Node(filesystem), other_fs_(other_fs) { |
| 235 } | 235 } |
| 236 | 236 |
| 237 Error FsNode::VIoctl(int request, va_list args) { | 237 Error FsNode::VIoctl(int request, va_list args) { |
| 238 return other_fs_->Filesystem_VIoctl(request, args); | 238 return other_fs_->Filesystem_VIoctl(request, args); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace | 241 } // namespace |
| 242 | 242 |
| 243 Error DevFs::Access(const Path& path, int a_mode) { | |
| 244 ScopedNode node; | |
| 245 int error = root_->FindChild(path.Join(), &node); | |
| 246 if (error) | |
| 247 return error; | |
| 248 | |
| 249 // Don't allow execute access. | |
| 250 if (a_mode & X_OK) { | |
| 251 LOG_TRACE("Executing devfs nodes is not allowed."); | |
| 252 return EACCES; | |
| 253 } | |
| 254 | |
| 255 return 0; | |
| 256 } | |
| 257 | |
| 258 Error DevFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { | 243 Error DevFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
| 259 out_node->reset(NULL); | 244 out_node->reset(NULL); |
| 260 int error; | 245 int error; |
| 261 if (path.Part(1) == "fs") { | 246 if (path.Part(1) == "fs") { |
| 262 if (path.Size() == 3) { | 247 if (path.Size() == 3) { |
| 263 error = fs_dir_->FindChild(path.Part(2), out_node); | 248 error = fs_dir_->FindChild(path.Part(2), out_node); |
| 264 } else { | 249 } else { |
| 265 LOG_TRACE("Bad devfs path: %s", path.Join().c_str()); | 250 LOG_TRACE("Bad devfs path: %s", path.Join().c_str()); |
| 266 error = ENOENT; | 251 error = ENOENT; |
| 267 } | 252 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 // Add a directory for "fs" nodes; they represent all currently-mounted | 347 // Add a directory for "fs" nodes; they represent all currently-mounted |
| 363 // filesystems. We can ioctl these nodes to make changes or provide input to | 348 // filesystems. We can ioctl these nodes to make changes or provide input to |
| 364 // a mounted filesystem. | 349 // a mounted filesystem. |
| 365 INITIALIZE_DEV_NODE("/fs", DirNode); | 350 INITIALIZE_DEV_NODE("/fs", DirNode); |
| 366 fs_dir_ = new_node; | 351 fs_dir_ = new_node; |
| 367 | 352 |
| 368 return 0; | 353 return 0; |
| 369 } | 354 } |
| 370 | 355 |
| 371 } // namespace nacl_io | 356 } // namespace nacl_io |
| OLD | NEW |