1/*
2 * Copyright (c) 2012, ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef LIBMDB_TYPES_H
11#define LIBMDB_TYPES_H
12
13struct cte;
14
15typedef uint8_t mdb_root_t;
16typedef uint8_t mdb_level_t;
17
18/**
19 * \brief A mapping database node.
20 */
21struct mdbnode {
22    struct cte *left, *right;
23    genpaddr_t end;
24    mdb_root_t end_root;
25    mdb_level_t level;
26    bool remote_copies:1, remote_ancs:1, remote_descs:1;
27    bool locked:1, in_delete:1;
28    coreid_t owner;
29};
30
31#ifndef IN_KERNEL
32// XXX: When compiling for userland, the cte definition in
33// kernel/include/capabilities.h is not available, so we define a substitute
34// cte type here.
35#include <barrelfish/barrelfish.h>
36struct cte {
37    struct capability cap;
38    struct mdbnode mdbnode;
39    char padding[(1<<OBJBITS_CTE)-sizeof(struct capability)-sizeof(struct mdbnode)];
40};
41#endif
42
43#endif // LIBMDB_TYPES_H
44