1 #ifndef XENGNTTAB_PRIVATE_H 2 #define XENGNTTAB_PRIVATE_H 3 4 #include <xentoollog.h> 5 #include <xentoolcore_internal.h> 6 #include <xengnttab.h> 7 8 /* Set of macros/defines used by both Linux and FreeBSD */ 9 #define ROUNDUP(_x,_w) (((unsigned long)(_x)+(1UL<<(_w))-1) & ~((1UL<<(_w))-1)) 10 11 #define GTERROR(_l, _f...) xtl_log(_l, XTL_ERROR, errno, "gnttab", _f) 12 #define GSERROR(_l, _f...) xtl_log(_l, XTL_ERROR, errno, "gntshr", _f) 13 14 struct xengntdev_handle { 15 xentoollog_logger *logger, *logger_tofree; 16 int fd; 17 Xentoolcore__Active_Handle tc_ah; 18 }; 19 20 int osdep_gnttab_open(xengnttab_handle *xgt); 21 int osdep_gnttab_close(xengnttab_handle *xgt); 22 23 int osdep_gnttab_set_max_grants(xengnttab_handle *xgt, uint32_t count); 24 25 #define XENGNTTAB_GRANT_MAP_SINGLE_DOMAIN 0x1 26 void *osdep_gnttab_grant_map(xengnttab_handle *xgt, 27 uint32_t count, int flags, int prot, 28 uint32_t *domids, uint32_t *refs, 29 uint32_t notify_offset, 30 evtchn_port_t notify_port); 31 int osdep_gnttab_unmap(xengnttab_handle *xgt, 32 void *start_address, 33 uint32_t count); 34 int osdep_gnttab_grant_copy(xengnttab_handle *xgt, 35 uint32_t count, 36 xengnttab_grant_copy_segment_t *segs); 37 38 int osdep_gnttab_dmabuf_exp_from_refs(xengnttab_handle *xgt, uint32_t domid, 39 uint32_t flags, uint32_t count, 40 const uint32_t *refs, uint32_t *fd); 41 42 int osdep_gnttab_dmabuf_exp_wait_released(xengnttab_handle *xgt, 43 uint32_t fd, uint32_t wait_to_ms); 44 45 int osdep_gnttab_dmabuf_imp_to_refs(xengnttab_handle *xgt, uint32_t domid, 46 uint32_t fd, uint32_t count, 47 uint32_t *refs); 48 49 int osdep_gnttab_dmabuf_imp_release(xengnttab_handle *xgt, uint32_t fd); 50 51 int osdep_gntshr_open(xengntshr_handle *xgs); 52 int osdep_gntshr_close(xengntshr_handle *xgs); 53 54 void *osdep_gntshr_share_pages(xengntshr_handle *xgs, 55 uint32_t domid, int count, 56 uint32_t *refs, int writable, 57 uint32_t notify_offset, 58 evtchn_port_t notify_port); 59 int osdep_gntshr_unshare(xengntshr_handle *xgs, 60 void *start_address, uint32_t count); 61 62 #endif 63 64 /* 65 * Local variables: 66 * mode: C 67 * c-file-style: "BSD" 68 * c-basic-offset: 4 69 * tab-width: 4 70 * indent-tabs-mode: nil 71 * End: 72 */ 73