Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(925)

Side by Side Diff: libraries/nacl-mounts/dev/DevMount.h

Issue 10377102: Added simplest device mount implementation (includes NullDevice and RandomDevice) (Closed) Base URL: http://naclports.googlecode.com/svn/trunk/src/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 void Ref(ino_t inode);
24 void Unref(ino_t inode);
25
26 int Stat(ino_t node, struct stat *buf);
27 ssize_t Read(ino_t node, off_t offset, void *buf, size_t count);
28 ssize_t Write(ino_t node, off_t offset, const void *buf, size_t count);
29 int Isatty(ino_t node) { return 0; }
30 int Getdents(ino_t, off_t, dirent*, unsigned int);
31
32 private:
33 std::map<int, std::string> inode_to_path;
34 std::map<int, Device*> inode_to_dev;
35 std::map<int, int> inode_to_ref;
36 std::map<std::string, int> path_to_inode;
37 int max_inode;
38 void Attach(std::string path, Device* device);
39
40 DISALLOW_COPY_AND_ASSIGN(DevMount);
41 };
42
43 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_DEV_DEVMOUNT_H_
44
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698