# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1175896105 -3600
# Node ID b0aaa113a60f236639f8b7f353459fcd9977d3be
# Parent aeb9a84e46d9ddcbd155a6b28f825588473f8eb0
libxc: Clarify xc_mmu interface and make it private.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
tools/libxc/xc_domain_restore.c | 14 ++++++++------
tools/libxc/xc_private.c | 12 ++++++------
tools/libxc/xc_private.h | 12 ++++++++++++
tools/libxc/xenctrl.h | 15 ---------------
4 files changed, 26 insertions(+), 27 deletions(-)
diff -r aeb9a84e46d9 -r b0aaa113a60f tools/libxc/xc_domain_restore.c
--- a/tools/libxc/xc_domain_restore.c Fri Apr 06 22:32:57 2007 +0100
+++ b/tools/libxc/xc_domain_restore.c Fri Apr 06 22:48:25 2007 +0100
@@ -284,7 +284,7 @@ int xc_domain_restore(int xc_handle, int
/* Our mapping of the current region (batch) */
char *region_base;
- xc_mmu_t *mmu = NULL;
+ struct xc_mmu *mmu = NULL;
/* used by debug verify code */
unsigned long buf[PAGE_SIZE/sizeof(unsigned long)];
@@ -386,7 +386,9 @@ int xc_domain_restore(int xc_handle, int
for ( pfn = 0; pfn < p2m_size; pfn++ )
p2m[pfn] = INVALID_P2M_ENTRY;
- if(!(mmu = xc_init_mmu_updates(xc_handle, dom))) {
+ mmu = xc_alloc_mmu_updates(xc_handle, dom);
+ if ( mmu == NULL )
+ {
ERROR("Could not initialise for MMU updates");
goto out;
}
@@ -629,8 +631,8 @@ int xc_domain_restore(int xc_handle, int
* Ensure we flush all machphys updates before potential PAE-specific
* reallocations below.
*/
- if (!hvm && xc_finish_mmu_updates(xc_handle, mmu)) {
- ERROR("Error doing finish_mmu_updates()");
+ if (!hvm && xc_flush_mmu_updates(xc_handle, mmu)) {
+ ERROR("Error doing flush_mmu_updates()");
goto out;
}
@@ -810,8 +812,8 @@ int xc_domain_restore(int xc_handle, int
}
}
- if (xc_finish_mmu_updates(xc_handle, mmu)) {
- ERROR("Error doing finish_mmu_updates()");
+ if (xc_flush_mmu_updates(xc_handle, mmu)) {
+ ERROR("Error doing xc_flush_mmu_updates()");
goto out;
}
}
diff -r aeb9a84e46d9 -r b0aaa113a60f tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Fri Apr 06 22:32:57 2007 +0100
+++ b/tools/libxc/xc_private.c Fri Apr 06 22:48:25 2007 +0100
@@ -145,7 +145,7 @@ int xc_mmuext_op(
return ret;
}
-static int flush_mmu_updates(int xc_handle, xc_mmu_t *mmu)
+static int flush_mmu_updates(int xc_handle, struct xc_mmu *mmu)
{
int err = 0;
DECLARE_HYPERCALL;
@@ -180,9 +180,9 @@ static int flush_mmu_updates(int xc_hand
return err;
}
-xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom)
-{
- xc_mmu_t *mmu = malloc(sizeof(xc_mmu_t));
+struct xc_mmu *xc_alloc_mmu_updates(int xc_handle, domid_t dom)
+{
+ struct xc_mmu *mmu = malloc(sizeof(*mmu));
if ( mmu == NULL )
return mmu;
mmu->idx = 0;
@@ -190,7 +190,7 @@ xc_mmu_t *xc_init_mmu_updates(int xc_han
return mmu;
}
-int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
+int xc_add_mmu_update(int xc_handle, struct xc_mmu *mmu,
unsigned long long ptr, unsigned long long val)
{
mmu->updates[mmu->idx].ptr = ptr;
@@ -202,7 +202,7 @@ int xc_add_mmu_update(int xc_handle, xc_
return 0;
}
-int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu)
+int xc_flush_mmu_updates(int xc_handle, struct xc_mmu *mmu)
{
return flush_mmu_updates(xc_handle, mmu);
}
diff -r aeb9a84e46d9 -r b0aaa113a60f tools/libxc/xc_private.h
--- a/tools/libxc/xc_private.h Fri Apr 06 22:32:57 2007 +0100
+++ b/tools/libxc/xc_private.h Fri Apr 06 22:48:25 2007 +0100
@@ -168,4 +168,16 @@ void bitmap_byte_to_64(uint64_t *lp, con
/* Optionally flush file to disk and discard page cache */
void discard_file_cache(int fd, int flush);
+#define MAX_MMU_UPDATES 1024
+struct xc_mmu {
+ mmu_update_t updates[MAX_MMU_UPDATES];
+ int idx;
+ domid_t subject;
+};
+/* Structure returned by xc_alloc_mmu_updates must be free()'ed by caller. */
+struct xc_mmu *xc_alloc_mmu_updates(int xc_handle, domid_t dom);
+int xc_add_mmu_update(int xc_handle, struct xc_mmu *mmu,
+ unsigned long long ptr, unsigned long long val);
+int xc_flush_mmu_updates(int xc_handle, struct xc_mmu *mmu);
+
#endif /* __XC_PRIVATE_H__ */
diff -r aeb9a84e46d9 -r b0aaa113a60f tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Fri Apr 06 22:32:57 2007 +0100
+++ b/tools/libxc/xenctrl.h Fri Apr 06 22:48:25 2007 +0100
@@ -666,21 +666,6 @@ int xc_sysctl(int xc_handle, struct xen_
int xc_version(int xc_handle, int cmd, void *arg);
-/*
- * MMU updates.
- */
-#define MAX_MMU_UPDATES 1024
-struct xc_mmu {
- mmu_update_t updates[MAX_MMU_UPDATES];
- int idx;
- domid_t subject;
-};
-typedef struct xc_mmu xc_mmu_t;
-xc_mmu_t *xc_init_mmu_updates(int xc_handle, domid_t dom);
-int xc_add_mmu_update(int xc_handle, xc_mmu_t *mmu,
- unsigned long long ptr, unsigned long long val);
-int xc_finish_mmu_updates(int xc_handle, xc_mmu_t *mmu);
-
int xc_acm_op(int xc_handle, int cmd, void *arg, unsigned long arg_size);
/*
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|