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) : _env(env) {}
44 ssize_t readv(const struct iovec*, int) throw() { return -EISDIR; }
45 ssize_t writev(const struct iovec*, int) throw() { return -EISDIR; }
46 int fstat64(struct stat64 *) const throw() { return -EINVAL; }
47 int faccessat(const char *path, int mode, int flags) throw();
48 int get_entry(const char *path, int flags, mode_t mode,
49 Ref_ptr<L4Re::Vfs::File> *) throw();
55 int get_ds(const char *path, L4Re::Auto_cap<L4Re::Dataspace>::Cap *ds) throw();
57 L4Re::Env const *_env;
61 class Ns_dir : public Ns_base_dir
64 explicit Ns_dir(L4::Cap<L4Re::Namespace> ns) : _ns(ns) {}
66 ssize_t readv(const struct iovec*, int) throw() { return -EISDIR; }
67 ssize_t writev(const struct iovec*, int) throw() { return -EISDIR; }
68 int fstat64(struct stat64 *) const throw() { return -EINVAL; }
69 int faccessat(const char *path, int mode, int flags) throw();
70 int get_entry(const char *path, int flags, mode_t mode,
71 Ref_ptr<L4Re::Vfs::File> *) throw();
76 int get_ds(const char *path, L4Re::Auto_cap<L4Re::Dataspace>::Cap *ds) throw();
78 L4::Cap<L4Re::Namespace> _ns;