[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 2/3] mem_event: Added new helper API to teardown mem event setup and unmap ring_page.
>tools/libxc/xc_mem_event.c: Added new generic API to teardown mem >event setup, >the API supports hvm params PAGING, ACCESS and SHARING and also >completes the >obvious job of unmapping ring_page. > >tools/libxc/xc_mem_access.c: Modified mem_event_disable to use the new >teardown API. > >tools/tests/xen-access/: Updated code to use the new API's. > >Signed-off-by: Dushyant Behl <myselfdushyantbehl@xxxxxxxxx> >--- > tools/libxc/xc_mem_access.c | 9 +++---- > tools/libxc/xc_mem_event.c | 53 >+++++++++++++++++++++++++++++++++++++ > tools/libxc/xc_private.h | 8 ++++++ > tools/libxc/xenctrl.h | 5 ++-- > tools/tests/xen-access/xen-access.c | 6 ++--- > 5 files changed, 69 insertions(+), 12 deletions(-) > >diff --git a/tools/libxc/xc_mem_access.c b/tools/libxc/xc_mem_access.c >index 89050be..29835c3 100644 >--- a/tools/libxc/xc_mem_access.c >+++ b/tools/libxc/xc_mem_access.c >@@ -33,12 +33,11 @@ int xc_mem_access_enable(xc_interface *xch, >domid_t domain_id, > port, ring_page, back_ring); > } > >-int xc_mem_access_disable(xc_interface *xch, domid_t domain_id) >+int xc_mem_access_disable(xc_interface *xch, domid_t domain_id, void >*ring_page) > { >- return xc_mem_event_control(xch, domain_id, >- XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE, >- XEN_DOMCTL_MEM_EVENT_OP_ACCESS, >- NULL); >+ return xc_mem_event_disable(xch, domain_id, >+ HVM_PARAM_ACCESS_RING_PFN, >+ ring_page); > } > > int xc_mem_access_resume(xc_interface *xch, domid_t domain_id) >diff --git a/tools/libxc/xc_mem_event.c b/tools/libxc/xc_mem_event.c >index cdbeca8..b6ae7d0 100644 >--- a/tools/libxc/xc_mem_event.c >+++ b/tools/libxc/xc_mem_event.c >@@ -200,3 +200,56 @@ int xc_mem_event_enable(xc_interface *xch, >domid_t domain_id, int param, > > return rc1; > } >+ >+/* >+ * Disable mem_event. >+ * Returns 0 on success, if failure returns -1 with errno properly set. >+ * param can be HVM_PARAM_PAGING/ACCESS/SHARING_RING_PFN >+ */ >+int xc_mem_event_disable(xc_interface *xch, domid_t domain_id, >+ int param, void *ring_page) >+{ >+ int rc; >+ unsigned int op, mode; >+ >+ switch ( param ) >+ { >+ case HVM_PARAM_PAGING_RING_PFN: >+ op = XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE; >+ mode = XEN_DOMCTL_MEM_EVENT_OP_PAGING; >+ break; >+ >+ case HVM_PARAM_ACCESS_RING_PFN: >+ op = XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE; >+ mode = XEN_DOMCTL_MEM_EVENT_OP_ACCESS; >+ break; >+ >+ case HVM_PARAM_SHARING_RING_PFN: >+ op = XEN_DOMCTL_MEM_EVENT_OP_SHARING_DISABLE; >+ mode = XEN_DOMCTL_MEM_EVENT_OP_SHARING; >+ break; >+ >+ /* >+ * This is for the outside chance that the HVM_PARAM is valid but is >invalid >+ * as far as mem_event goes. >+ */ >+ default: >+ errno = EINVAL; >+ rc = -1; >+ goto out; >+ } Sorry, I should have caught this in my previous review. I think the Xen coding style places the case statement with the same indent as the switch. Thanks, Aravindh _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |