| 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 #include "nacl_io/fusefs/fuse_fs.h" | 5 #include "nacl_io/fusefs/fuse_fs.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 } | 50 } |
| 51 | 51 |
| 52 return 0; | 52 return 0; |
| 53 } | 53 } |
| 54 | 54 |
| 55 void FuseFs::Destroy() { | 55 void FuseFs::Destroy() { |
| 56 if (fuse_ops_ && fuse_ops_->destroy) | 56 if (fuse_ops_ && fuse_ops_->destroy) |
| 57 fuse_ops_->destroy(fuse_user_data_); | 57 fuse_ops_->destroy(fuse_user_data_); |
| 58 } | 58 } |
| 59 | 59 |
| 60 Error FuseFs::Access(const Path& path, int a_mode) { | |
| 61 if (!fuse_ops_->access) { | |
| 62 LOG_TRACE("fuse_ops_->access is NULL."); | |
| 63 return ENOSYS; | |
| 64 } | |
| 65 | |
| 66 int result = fuse_ops_->access(path.Join().c_str(), a_mode); | |
| 67 if (result < 0) | |
| 68 return -result; | |
| 69 | |
| 70 return 0; | |
| 71 } | |
| 72 | |
| 73 Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { | 60 Error FuseFs::Open(const Path& path, int open_flags, ScopedNode* out_node) { |
| 74 std::string path_str = path.Join(); | 61 std::string path_str = path.Join(); |
| 75 const char* path_cstr = path_str.c_str(); | 62 const char* path_cstr = path_str.c_str(); |
| 76 int result = 0; | 63 int result = 0; |
| 77 | 64 |
| 78 struct fuse_file_info fi; | 65 struct fuse_file_info fi; |
| 79 memset(&fi, 0, sizeof(fi)); | 66 memset(&fi, 0, sizeof(fi)); |
| 80 fi.flags = open_flags; | 67 fi.flags = open_flags; |
| 81 | 68 |
| 82 if (open_flags & (O_CREAT | O_EXCL)) { | 69 if (open_flags & (O_CREAT | O_EXCL)) { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 } else { | 464 } else { |
| 478 fill_info->getdents->AddDirent(ino, name, strlen(name)); | 465 fill_info->getdents->AddDirent(ino, name, strlen(name)); |
| 479 fill_info->num_bytes -= sizeof(dirent); | 466 fill_info->num_bytes -= sizeof(dirent); |
| 480 // According to the docs, we can never return 1 (buffer full) when the | 467 // According to the docs, we can never return 1 (buffer full) when the |
| 481 // offset is zero (the user is probably ignoring the result anyway). | 468 // offset is zero (the user is probably ignoring the result anyway). |
| 482 return 0; | 469 return 0; |
| 483 } | 470 } |
| 484 } | 471 } |
| 485 | 472 |
| 486 } // namespace nacl_io | 473 } // namespace nacl_io |
| OLD | NEW |