OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_DEV_DEVMOUNT_H_ |
| 7 #define PACKAGES_LIBRARIES_NACL_MOUNTS_DEV_DEVMOUNT_H_ |
| 8 |
| 9 #include <map> |
| 10 #include <string> |
| 11 #include "../base/BaseMount.h" |
| 12 #include "../dev/Device.h" |
| 13 #include "../util/macros.h" |
| 14 |
| 15 // DevMount |
| 16 class DevMount: public BaseMount { |
| 17 public: |
| 18 DevMount() {} |
| 19 virtual ~DevMount() {} |
| 20 |
| 21 int Creat(const std::string& path, mode_t mode, struct stat* st); |
| 22 int GetNode(const std::string& path, struct stat* st); |
| 23 |
| 24 int Stat(ino_t node, struct stat *buf); |
| 25 ssize_t Read(ino_t node, off_t offset, void *buf, size_t count); |
| 26 ssize_t Write(ino_t node, off_t offset, const void *buf, size_t count); |
| 27 int Isatty(ino_t node) { return 0; } |
| 28 |
| 29 private: |
| 30 std::map<int, std::string> inode_to_path; |
| 31 std::map<int, Device*> inode_to_dev; |
| 32 std::map<int, int> inode_to_ref; |
| 33 std::map<std::string, int> path_to_inode; |
| 34 int max_inode; |
| 35 void Attach(std::string path, Device* device); |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(DevMount); |
| 38 }; |
| 39 |
| 40 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_DEV_DEVMOUNT_H_ |
| 41 |
OLD | NEW |