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

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
« no previous file with comments | « libraries/nacl-mounts/console/terminal_stubs.c ('k') | libraries/nacl-mounts/dev/DevMount.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GetNode(const std::string& path, struct stat* st);
22
23 int Stat(ino_t node, struct stat *buf);
24 int Mkdir(const std::string& path, mode_t mode, struct stat *st);
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 int Getdents(ino_t, off_t, dirent*, unsigned int);
29
30 private:
31 std::map<int, std::string> inode_to_path;
32 std::map<int, Device*> inode_to_dev;
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
OLDNEW
« no previous file with comments | « libraries/nacl-mounts/console/terminal_stubs.c ('k') | libraries/nacl-mounts/dev/DevMount.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698