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 // Creat() is successful if the path is "/dev/null", "/dev/random", | |
22 // or "/def/tty". Otherwise, Creat() fails. | |
Evgeniy Stepanov
2012/05/11 08:16:37
I'd skip this comment, or move it to .cc - it's go
vissi
2012/05/11 08:31:05
Done.
| |
23 int Creat(const std::string& path, mode_t mode, struct stat* st); | |
24 | |
25 // GetNode() is successful if the path is "/dev/null", "/dev/random", | |
26 // or "/def/tty". Otherwise, GetNode() fails. | |
27 int GetNode(const std::string& path, struct stat* st); | |
28 | |
29 int Stat(ino_t node, struct stat *buf); | |
30 ssize_t Read(ino_t node, off_t offset, void *buf, size_t count); | |
31 ssize_t Write(ino_t node, off_t offset, const void *buf, size_t count); | |
32 int Isatty(ino_t node) { return 0; } | |
33 | |
34 private: | |
35 std::map<int, std::string> inode_to_path; | |
36 std::map<int, Device*> inode_to_dev; | |
37 std::map<int, int> inode_to_ref; | |
38 std::map<std::string, int> path_to_inode; | |
39 void Attach(std::string path, Device* device); | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(DevMount); | |
42 }; | |
43 | |
44 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_DEV_DEVMOUNT_H_ | |
45 | |
OLD | NEW |