1 /*
2  * Compat shims for use of 3rd party consumers of libxenctrl xc_gnt{tab,shr}
3  * functionality which has been split into separate libraries.
4  */
5 
6 #include <xengnttab.h>
7 
8 #define XC_WANT_COMPAT_GNTTAB_API
9 #include "xenctrl.h"
10 
xc_gnttab_open(xentoollog_logger * logger,unsigned open_flags)11 xc_gnttab *xc_gnttab_open(xentoollog_logger *logger,
12                           unsigned open_flags)
13 {
14     return xengnttab_open(logger, open_flags);
15 }
16 
xc_gnttab_close(xc_gnttab * xcg)17 int xc_gnttab_close(xc_gnttab *xcg)
18 {
19     return xengnttab_close(xcg);
20 }
21 
xc_gnttab_map_grant_ref(xc_gnttab * xcg,uint32_t domid,uint32_t ref,int prot)22 void *xc_gnttab_map_grant_ref(xc_gnttab *xcg,
23                               uint32_t domid,
24                               uint32_t ref,
25                               int prot)
26 {
27     return xengnttab_map_grant_ref(xcg, domid, ref, prot);
28 }
29 
xc_gnttab_map_grant_refs(xc_gnttab * xcg,uint32_t count,uint32_t * domids,uint32_t * refs,int prot)30 void *xc_gnttab_map_grant_refs(xc_gnttab *xcg,
31                                uint32_t count,
32                                uint32_t *domids,
33                                uint32_t *refs,
34                                int prot)
35 {
36     return xengnttab_map_grant_refs(xcg, count, domids, refs, prot);
37 }
38 
xc_gnttab_map_domain_grant_refs(xc_gnttab * xcg,uint32_t count,uint32_t domid,uint32_t * refs,int prot)39 void *xc_gnttab_map_domain_grant_refs(xc_gnttab *xcg,
40                                       uint32_t count,
41                                       uint32_t domid,
42                                       uint32_t *refs,
43                                       int prot)
44 {
45     return xengnttab_map_domain_grant_refs(xcg, count, domid, refs, prot);
46 }
47 
xc_gnttab_map_grant_ref_notify(xc_gnttab * xcg,uint32_t domid,uint32_t ref,int prot,uint32_t notify_offset,evtchn_port_t notify_port)48 void *xc_gnttab_map_grant_ref_notify(xc_gnttab *xcg,
49                                      uint32_t domid,
50                                      uint32_t ref,
51                                      int prot,
52                                      uint32_t notify_offset,
53                                      evtchn_port_t notify_port)
54 {
55     return xengnttab_map_grant_ref_notify(xcg, domid, ref, prot,
56                                           notify_offset, notify_port);
57 }
58 
xc_gnttab_munmap(xc_gnttab * xcg,void * start_address,uint32_t count)59 int xc_gnttab_munmap(xc_gnttab *xcg,
60                      void *start_address,
61                      uint32_t count)
62 {
63     return xengnttab_unmap(xcg, start_address, count);
64 }
65 
xc_gnttab_set_max_grants(xc_gnttab * xcg,uint32_t count)66 int xc_gnttab_set_max_grants(xc_gnttab *xcg,
67                              uint32_t count)
68 {
69     return xengnttab_set_max_grants(xcg, count);
70 }
71 
xc_gntshr_open(xentoollog_logger * logger,unsigned open_flags)72 xc_gntshr *xc_gntshr_open(xentoollog_logger *logger,
73                           unsigned open_flags)
74 {
75     return xengntshr_open(logger, open_flags);
76 }
77 
xc_gntshr_close(xc_gntshr * xcg)78 int xc_gntshr_close(xc_gntshr *xcg)
79 {
80     return xengntshr_close(xcg);
81 }
82 
xc_gntshr_share_pages(xc_gntshr * xcg,uint32_t domid,int count,uint32_t * refs,int writable)83 void *xc_gntshr_share_pages(xc_gntshr *xcg, uint32_t domid,
84                             int count, uint32_t *refs, int writable)
85 {
86     return xengntshr_share_pages(xcg, domid, count, refs, writable);
87 }
88 
xc_gntshr_share_page_notify(xc_gntshr * xcg,uint32_t domid,uint32_t * ref,int writable,uint32_t notify_offset,evtchn_port_t notify_port)89 void *xc_gntshr_share_page_notify(xc_gntshr *xcg, uint32_t domid,
90                                   uint32_t *ref, int writable,
91                                   uint32_t notify_offset,
92                                   evtchn_port_t notify_port)
93 {
94     return xengntshr_share_page_notify(xcg, domid, ref, writable,
95                                        notify_offset, notify_port);
96 }
97 
xc_gntshr_munmap(xc_gntshr * xcg,void * start_address,uint32_t count)98 int xc_gntshr_munmap(xc_gntshr *xcg, void *start_address, uint32_t count)
99 {
100     return xengntshr_unshare(xcg, start_address, count);
101 }
102 
103 /*
104  * Local variables:
105  * mode: C
106  * c-file-style: "BSD"
107  * c-basic-offset: 4
108  * tab-width: 4
109  * indent-tabs-mode: nil
110  * End:
111  */
112