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_gntshr_open(xengntshr_handle *xgs); 39 int osdep_gntshr_close(xengntshr_handle *xgs); 40 41 void *osdep_gntshr_share_pages(xengntshr_handle *xgs, 42 uint32_t domid, int count, 43 uint32_t *refs, int writable, 44 uint32_t notify_offset, 45 evtchn_port_t notify_port); 46 int osdep_gntshr_unshare(xengntshr_handle *xgs, 47 void *start_address, uint32_t count); 48 49 #endif 50 51 /* 52 * Local variables: 53 * mode: C 54 * c-file-style: "BSD" 55 * c-basic-offset: 4 56 * tab-width: 4 57 * indent-tabs-mode: nil 58 * End: 59 */ 60