1 /******************************************************************************
2  *
3  * Copyright (c) 2009 Citrix Systems, Inc. (Grzegorz Milos)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef __MEMSHR_H__
19 #define __MEMSHR_H__
20 
21 #include <stdint.h>
22 #include <xen/xen.h>
23 #include <xen/grant_table.h>
24 
25 typedef uint64_t xen_mfn_t;
26 
27 typedef struct share_tuple
28 {
29     uint32_t domain;
30     uint64_t frame;
31     uint64_t handle;
32 } share_tuple_t;
33 
34 extern void memshr_set_domid(int domid);
35 extern void memshr_daemon_initialize(void);
36 extern void memshr_vbd_initialize(void);
37 extern uint16_t memshr_vbd_image_get(const char* file);
38 extern void memshr_vbd_image_put(uint16_t memshr_id);
39 extern int memshr_vbd_issue_ro_request(char *buf,
40                                        grant_ref_t gref,
41                                        uint16_t file_id,
42                                        uint64_t sec,
43                                        int secs,
44                                        share_tuple_t *hnd);
45 extern void memshr_vbd_complete_ro_request(
46                                        share_tuple_t hnd,
47                                        uint16_t file_id,
48                                        uint64_t sec,
49                                        int secs);
50 
51 #endif /* __MEMSHR_H__ */
52