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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
241 } // namespace | 241 } // namespace |
242 | 242 |
243 Error DevFs::OpenWithMode(const Path& path, int open_flags, | 243 Error DevFs::OpenWithMode(const Path& path, int open_flags, |
244 mode_t mode, ScopedNode* out_node) { | 244 mode_t mode, ScopedNode* out_node) { |
245 out_node->reset(NULL); | 245 out_node->reset(NULL); |
246 int error; | 246 int error; |
247 if (path.Part(1) == "fs") { | 247 if (path.Part(1) == "fs") { |
248 if (path.Size() == 3) { | 248 if (path.Size() == 3) { |
249 error = fs_dir_->FindChild(path.Part(2), out_node); | 249 error = fs_dir_->FindChild(path.Part(2), out_node); |
250 } else { | 250 } else { |
251 LOG_TRACE("Bad devfs path: %s", path.Join().c_str()); | 251 std::string path_str(path.Join()); |
khim
2015/04/17 21:20:05
Fly-by comment: why "std:sttring" here? Why not "c
binji
2015/04/20 22:35:28
Done.
| |
252 LOG_TRACE("Bad devfs path: %s", path_str.c_str()); | |
252 error = ENOENT; | 253 error = ENOENT; |
253 } | 254 } |
254 } else { | 255 } else { |
255 error = root_->FindChild(path.Join(), out_node); | 256 error = root_->FindChild(path.Join(), out_node); |
256 } | 257 } |
257 | 258 |
258 // Only return EACCES when trying to create a node that does not exist. | 259 // Only return EACCES when trying to create a node that does not exist. |
259 if ((error == ENOENT) && (open_flags & O_CREAT)) { | 260 if ((error == ENOENT) && (open_flags & O_CREAT)) { |
260 LOG_TRACE("Cannot create devfs node: %s", path.Join().c_str()); | 261 std::string path_str(path.Join()); |
262 LOG_TRACE("Cannot create devfs node: %s", path_str.c_str()); | |
261 return EACCES; | 263 return EACCES; |
262 } | 264 } |
263 | 265 |
264 return error; | 266 return error; |
265 } | 267 } |
266 | 268 |
267 Error DevFs::Unlink(const Path& path) { | 269 Error DevFs::Unlink(const Path& path) { |
268 LOG_ERROR("unlink not supported."); | 270 LOG_ERROR("unlink not supported."); |
269 return EPERM; | 271 return EPERM; |
270 } | 272 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
348 // Add a directory for "fs" nodes; they represent all currently-mounted | 350 // Add a directory for "fs" nodes; they represent all currently-mounted |
349 // filesystems. We can ioctl these nodes to make changes or provide input to | 351 // filesystems. We can ioctl these nodes to make changes or provide input to |
350 // a mounted filesystem. | 352 // a mounted filesystem. |
351 INITIALIZE_DEV_NODE_1("/fs", DirNode, S_IRALL | S_IWALL | S_IXALL); | 353 INITIALIZE_DEV_NODE_1("/fs", DirNode, S_IRALL | S_IWALL | S_IXALL); |
352 fs_dir_ = new_node; | 354 fs_dir_ = new_node; |
353 | 355 |
354 return 0; | 356 return 0; |
355 } | 357 } |
356 | 358 |
357 } // namespace nacl_io | 359 } // namespace nacl_io |
OLD | NEW |