2 * (c) 2010 Technische Universität Dresden
3 * This file is part of TUD:OS and distributed under the terms of the
4 * GNU General Public License 2.
5 * Please see the COPYING-GPL-2 file for details.
7 * As a special exception, you may use this file as part of a free software
8 * library without restriction. Specifically, if other files instantiate
9 * templates or use macros or inline functions from this file, or you compile
10 * this file and link it with other files to produce an executable, this
11 * file does not by itself cause the resulting executable to be covered by
12 * the GNU General Public License. This exception does not however
13 * invalidate any other reasons why the executable file might be covered by
14 * the GNU General Public License.
18 #include <l4/l4re_vfs/backend>
19 #include <l4/sys/capability>
20 #include <l4/re/namespace>
21 #include "simple_store.h"
23 namespace L4Re { namespace Core {
27 class Ns_base_dir : public L4Re::Vfs::Be_file
30 enum { Size = sizeof(L4Re::Vfs::Be_file) + sizeof(l4_addr_t) };
32 void *operator new(size_t s) throw();
33 void operator delete(void *b) throw();
36 static Simple_store_sz<Size> store;
39 class Env_dir : public Ns_base_dir
42 explicit Env_dir(L4Re::Env const *env)
43 : _env(env), _current_cap_entry(env->initial_caps()) {}
45 ssize_t readv(const struct iovec*, int) throw() { return -EISDIR; }
46 ssize_t writev(const struct iovec*, int) throw() { return -EISDIR; }
47 int fstat64(struct stat64 *) const throw();
48 int faccessat(const char *path, int mode, int flags) throw();
49 int get_entry(const char *path, int flags, mode_t mode,
50 Ref_ptr<L4Re::Vfs::File> *) throw();
51 ssize_t getdents(char *, size_t) throw();
57 int get_ds(const char *path, L4Re::Auto_cap<L4Re::Dataspace>::Cap *ds) throw();
59 L4Re::Env const *_env;
60 Env::Cap_entry const *_current_cap_entry;
63 class Ns_dir : public Ns_base_dir
66 explicit Ns_dir(L4::Cap<L4Re::Namespace> ns) : _ns(ns) {}
68 ssize_t readv(const struct iovec*, int) throw() { return -EISDIR; }
69 ssize_t writev(const struct iovec*, int) throw() { return -EISDIR; }
70 int fstat64(struct stat64 *) const throw();
71 int faccessat(const char *path, int mode, int flags) throw();
72 int get_entry(const char *path, int flags, mode_t mode,
73 Ref_ptr<L4Re::Vfs::File> *) throw();
78 int get_ds(const char *path, L4Re::Auto_cap<L4Re::Dataspace>::Cap *ds) throw();
80 L4::Cap<L4Re::Namespace> _ns;