diff mbox

[v2,1/2] tools/libxc: add interface for GNTTABOP_query_size

Message ID 1499038453-17050-1-git-send-email-dongli.zhang@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dongli Zhang July 2, 2017, 11:34 p.m. UTC
This patch adds new interface for GNTTABOP_query_size in libxc to help
query the current grant table frames and maximum grant table frames for a
specific domain.

Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
Changed since v1:
  * Change %d to %u in ERROR()

---
 tools/libxc/include/xenctrl.h |  1 +
 tools/libxc/xc_gnttab.c       | 12 ++++++++++++
 2 files changed, 13 insertions(+)

Comments

Wei Liu July 3, 2017, 4:26 p.m. UTC | #1
On Mon, Jul 03, 2017 at 07:34:12AM +0800, Dongli Zhang wrote:
> This patch adds new interface for GNTTABOP_query_size in libxc to help
> query the current grant table frames and maximum grant table frames for a
> specific domain.
> 
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>
diff mbox

Patch

diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 1629f41..155c69e 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -1597,6 +1597,7 @@  int xc_gnttab_op(xc_interface *xch, int cmd,
                  void * op, int op_size, int count);
 /* Logs iff hypercall bounce fails, otherwise doesn't. */
 
+int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query);
 int xc_gnttab_get_version(xc_interface *xch, int domid); /* Never logs */
 grant_entry_v1_t *xc_gnttab_map_table_v1(xc_interface *xch, int domid, int *gnt_num);
 grant_entry_v2_t *xc_gnttab_map_table_v2(xc_interface *xch, int domid, int *gnt_num);
diff --git a/tools/libxc/xc_gnttab.c b/tools/libxc/xc_gnttab.c
index af53fac..9e6f1fb 100644
--- a/tools/libxc/xc_gnttab.c
+++ b/tools/libxc/xc_gnttab.c
@@ -38,6 +38,18 @@  int xc_gnttab_op(xc_interface *xch, int cmd, void * op, int op_size, int count)
     return ret;
 }
 
+int xc_gnttab_query_size(xc_interface *xch, struct gnttab_query_size *query)
+{
+    int rc;
+
+    rc = xc_gnttab_op(xch, GNTTABOP_query_size, query, sizeof(*query), 1);
+
+    if ( rc || (query->status != GNTST_okay) )
+        ERROR("Could not query dom %u's grant size\n", query->dom);
+
+    return rc;
+}
+
 int xc_gnttab_get_version(xc_interface *xch, int domid)
 {
     struct gnttab_get_version query;