2 * (c) 2008-2009 Alexander Warg <warg@os.inf.tu-dresden.de>
3 * economic rights: Technische Universität Dresden (Germany)
5 * This file is part of TUD:OS and distributed under the terms of the
6 * GNU General Public License 2.
7 * Please see the COPYING-GPL-2 file for details.
11 #include <l4/cxx/avl_tree>
12 #include <l4/cxx/std_ops>
13 #include <l4/cxx/ipc_server>
15 #include <l4/sys/capability>
16 #include <l4/re/util/name_space_svr>
18 #include "server_obj.h"
19 #include "slab_alloc.h"
20 #include <l4/cxx/string>
29 namespace Names { using namespace L4Re::Util::Names; }
31 class Entry : public Names::Entry
34 Entry(Names::Name const &n, Names::Obj const &o, bool dyn = false)
35 : Names::Entry(n, o, dyn) {}
37 void * operator new (size_t s) { return GC_MALLOC(s); }
38 void operator delete(void *) { /*free(b);*/ }
41 class Name_space : public Moe::Server_object,
42 public Names::Name_space
46 int dispatch(l4_umword_t obj, L4::Ipc_iostream &ios)
48 enum { Max_name = 2048 };
49 static char buffer[Max_name];
51 return Names::Name_space::dispatch(obj, ios, buffer, Max_name);
57 // server support ----------------------------------------
58 int get_capability(L4::Snd_fpage const &cap_fp, L4::Cap<void> *cap,
59 L4::Server_object **lo);
60 int save_capability(L4::Cap<void> *cap);
61 void free_capability(L4::Cap<void> cap);
62 Entry *alloc_dynamic_entry(Names::Name const &n, unsigned flags);
63 void free_dynamic_entry(Names::Entry *e);
65 // internally used to register bootfs files, name spaces...
66 int register_obj(Names::Name const &name, Names::Obj const &o,
69 Entry *n = new Entry(name, o, dyn);
80 void *operator new (size_t size) throw();
81 void operator delete (void *p, size_t size) throw();
86 Moe::Name_space *root_name_space();
89 L4::BasicOStream &operator << (L4::BasicOStream &s, L4Re::Util::Names::Name const &n)
91 for (int l = 0; l < n.len(); ++l)