L4Re - L4 Runtime Environment
vfs_api_impl.h
1 /*
2  * (c) 2010 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  * Alexander Warg <warg@os.inf.tu-dresden.de>
4  * economic rights: Technische Universit├Ąt Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  *
10  * As a special exception, you may use this file as part of a free software
11  * library without restriction. Specifically, if other files instantiate
12  * templates or use macros or inline functions from this file, or you compile
13  * this file and link it with other files to produce an executable, this
14  * file does not by itself cause the resulting executable to be covered by
15  * the GNU General Public License. This exception does not however
16  * invalidate any other reasons why the executable file might be covered by
17  * the GNU General Public License.
18  */
19 #include "vfs_api.h"
20 #include <stddef.h>
21 
22 namespace L4Re { namespace Core {
23 
24 namespace {
25 class Default_cap_alloc : public L4Re::Cap_alloc
26 {
27 public:
28  virtual L4::Cap<void> alloc() throw()
29  { return Vfs_config::cap_alloc.alloc<void>(); }
30 
31  virtual void free(L4::Cap<void> cap) throw()
32  { Vfs_config::cap_alloc.free(cap); }
33 
34  virtual L4::Cap<void> next_allocated(l4_umword_t *refs, L4::Cap<void> pivot = L4::Cap<void>::Invalid) throw()
35  {
36  (void)refs;
37  return pivot;
38  }
39 
40  virtual ~Default_cap_alloc() {}
41 
42  void operator delete (void *) throw() {}
43 };
44 
45 }
46 
48 {
49  static Default_cap_alloc default_cap_alloc;
50  return &default_cap_alloc;
51 }
52 
53 }}
Capability allocator interface.
Definition: cap_alloc:40
L4Re C++ Interfaces.
Definition: cmd_control:15
bool free(L4::Cap< void > cap, l4_cap_idx_t task=L4_INVALID_CAP, unsigned unmap_flags=L4_FP_ALL_SPACES)
Free the capability.
_Cap_alloc & cap_alloc
Capability allocator.
unsigned long l4_umword_t
Unsigned machine word.
Definition: l4int.h:52
L4::Cap< void > alloc()
Allocate a new capability slot.
C++ interface for capabilities.
Definition: capability.h:13