OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2011 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ | 6 #ifndef PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ |
7 #define PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ | 7 #define PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ |
8 | 8 |
9 #include <assert.h> | 9 #include <assert.h> |
10 #include <errno.h> | 10 #include <errno.h> |
11 #include <fcntl.h> | 11 #include <fcntl.h> |
12 #include <pthread.h> | 12 #include <pthread.h> |
13 #include <stdarg.h> | 13 #include <stdarg.h> |
14 #include <stdint.h> | 14 #include <stdint.h> |
15 #include <stdio.h> | 15 #include <stdio.h> |
16 #include <string.h> | 16 #include <string.h> |
17 #include <map> | 17 #include <map> |
18 #include <string> | 18 #include <string> |
19 #include <utility> | 19 #include <utility> |
20 #include <vector> | 20 #include <vector> |
21 #include "BaseMount.h" | 21 #include "BaseMount.h" |
22 #include "../util/Path.h" | 22 #include "../util/Path.h" |
23 #include "../util/SimpleAutoLock.h" | 23 #include "../util/PthreadHelpers.h" |
24 | 24 |
25 class Mount; | 25 class Mount; |
26 | 26 |
27 // MountManager serves as an indirection layer for POSIX calls. Different | 27 // MountManager serves as an indirection layer for POSIX calls. Different |
28 // mount types can be added to the mount manager so that different system call | 28 // mount types can be added to the mount manager so that different system call |
29 // implementations can be used at different locations in the file system. | 29 // implementations can be used at different locations in the file system. |
30 // This allows for the use of different backend storage devices to be used | 30 // This allows for the use of different backend storage devices to be used |
31 // by one native client executable. | 31 // by one native client executable. |
32 class MountManager { | 32 class MountManager { |
33 public: | 33 public: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // path. If it exists, a mount that is rooted at path or a subdirectory of | 70 // path. If it exists, a mount that is rooted at path or a subdirectory of |
71 // path is returned. Otherwise, NULL is returned. | 71 // path is returned. Otherwise, NULL is returned. |
72 Mount *InMountRootPath(const std::string& path); | 72 Mount *InMountRootPath(const std::string& path); |
73 | 73 |
74 private: | 74 private: |
75 std::map<std::string, Mount*> mount_map_; | 75 std::map<std::string, Mount*> mount_map_; |
76 pthread_mutex_t mm_lock_; | 76 pthread_mutex_t mm_lock_; |
77 }; | 77 }; |
78 | 78 |
79 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ | 79 #endif // PACKAGES_LIBRARIES_NACL_MOUNTS_BASE_MOUNTMANAGER_H_ |
OLD | NEW |