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

Side by Side Diff: native_client_sdk/src/libraries/nacl_io/inode_pool.h

Issue 19717004: [NaCl SDK] Add nacl_io and sdk_util namespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix bad copyright in mount_mem Created 7 years, 5 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
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 #ifndef LIBRARIES_NACL_IO_INODE_POOL_H_ 6 #ifndef LIBRARIES_NACL_IO_INODE_POOL_H_
7 #define LIBRARIES_NACL_IO_INODE_POOL_H_ 7 #define LIBRARIES_NACL_IO_INODE_POOL_H_
8 8
9 #include <stdlib.h> 9 #include <stdlib.h>
10 #include <vector> 10 #include <vector>
11 11
12 #include "nacl_io/osstat.h" 12 #include "nacl_io/osstat.h"
13 #include "pthread.h" 13 #include "pthread.h"
14 #include "sdk_util/auto_lock.h" 14 #include "sdk_util/auto_lock.h"
15 15
16 namespace nacl_io {
16 17
17 class INodePool { 18 class INodePool {
18 public: 19 public:
19 INodePool() : max_nodes_(0), num_nodes_(0) {} 20 INodePool() : max_nodes_(0), num_nodes_(0) {}
20 21
21 ino_t Acquire() { 22 ino_t Acquire() {
22 AUTO_LOCK(lock_); 23 AUTO_LOCK(lock_);
23 const int INO_CNT = 8; 24 const int INO_CNT = 8;
24 25
25 // If we run out of INO numbers, then allocate 8 more 26 // If we run out of INO numbers, then allocate 8 more
(...skipping 19 matching lines...) Expand all
45 num_nodes_--; 46 num_nodes_--;
46 } 47 }
47 48
48 size_t size() const { return num_nodes_; } 49 size_t size() const { return num_nodes_; }
49 size_t capacity() const { return max_nodes_; } 50 size_t capacity() const { return max_nodes_; }
50 51
51 private: 52 private:
52 size_t num_nodes_; 53 size_t num_nodes_;
53 size_t max_nodes_; 54 size_t max_nodes_;
54 std::vector<ino_t> inos_; 55 std::vector<ino_t> inos_;
55 SimpleLock lock_; 56 sdk_util::SimpleLock lock_;
56 }; 57 };
57 58
59 } // namespace nacl_io
60
58 #endif // LIBRARIES_NACL_IO_INODE_POOL_H_ 61 #endif // LIBRARIES_NACL_IO_INODE_POOL_H_
OLDNEW
« no previous file with comments | « native_client_sdk/src/libraries/nacl_io/error.h ('k') | native_client_sdk/src/libraries/nacl_io/kernel_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698