1/*
2 * Copyright 2016, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(D61_BSD)
11 */
12
13#ifndef _FILE_SERVER_STATE_H_
14#define _FILE_SERVER_STATE_H_
15
16#include <stdio.h>
17#include <stdlib.h>
18#include <assert.h>
19#include <sel4/sel4.h>
20#include <cpio/cpio.h>
21
22#include <refos/refos.h>
23#include <refos-util/cspace.h>
24#include <refos-util/walloc.h>
25#include <refos-rpc/proc_client.h>
26#include <refos-rpc/proc_client_helper.h>
27#include <refos-rpc/data_client_helper.h>
28#include <cpio/cpio.h>
29#include <refos-util/serv_connect.h>
30#include <refos-util/serv_common.h>
31
32#include "dataspace.h"
33#include "pager.h"
34
35 /*! @file
36     @brief CPIO Fileserver global state & helper functions. */
37
38/* Debug printing. */
39#include <refos-util/dprintf.h>
40
41#define FILESERVER_MAX_PAGE_FRAMES 128
42#define FILESERVER_NOTIFICATION_BUFFER_SIZE 0x2000 /* 2 Frames. */
43#define FILESERVER_MOUNTPOINT "fileserv"
44#define FS_CLIENT_MAGIC 0x3FA3EF6E
45
46/*! @brief Global CPIO file server state structure. */
47struct fs_state {
48    srv_common_t commonState;
49
50    /* Main file server data structures. */
51    struct fs_frame_block pageFrameBlock;
52    struct fs_dataspace_table dspaceTable;
53};
54
55/*! @brief Global CPIO file server state. */
56extern struct fs_state fileServ;
57
58/*! @brief Weak pointer to CPIO file server common state. */
59extern srv_common_t *fileServCommon;
60
61/*! @brief Initialise the file server state. */
62void fileserv_init(void);
63
64#endif /* _FILE_SERVER_STATE_H_ */
65