|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH RFC v2 05/23] libxc/xc_sr_restore: introduce generic 'pages' records
From: Joshua Otto <jtotto@xxxxxxxxxxxx>
The PAGE_DATA migration record type is specified as an array of
uint64_ts encoding pfns and their types, followed by an array of page
contents. Postcopy live migration specifies a number of records with
similar or the same format, and it would be convenient to be able to
re-use the code that validates and unpacks such records for each type.
To facilitate this, introduce the generic 'pages' name for such records
and rename the PAGE_DATA stream format struct and pfn encoding masks
accordingly.
No functional change.
Signed-off-by: Joshua Otto <jtotto@xxxxxxxxxxxx>
---
tools/libxc/xc_sr_common.c | 2 +-
tools/libxc/xc_sr_restore.c | 6 +++---
tools/libxc/xc_sr_save.c | 2 +-
tools/libxc/xc_sr_stream_format.h | 6 +++---
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/libxc/xc_sr_common.c b/tools/libxc/xc_sr_common.c
index c1babf6..08abe9a 100644
--- a/tools/libxc/xc_sr_common.c
+++ b/tools/libxc/xc_sr_common.c
@@ -146,7 +146,7 @@ static void __attribute__((unused)) build_assertions(void)
BUILD_BUG_ON(sizeof(struct xc_sr_dhdr) != 16);
BUILD_BUG_ON(sizeof(struct xc_sr_rhdr) != 8);
- BUILD_BUG_ON(sizeof(struct xc_sr_rec_page_data_header) != 8);
+ BUILD_BUG_ON(sizeof(struct xc_sr_rec_pages_header) != 8);
BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_info) != 8);
BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_p2m_frames) != 8);
BUILD_BUG_ON(sizeof(struct xc_sr_rec_x86_pv_vcpu_hdr) != 8);
diff --git a/tools/libxc/xc_sr_restore.c b/tools/libxc/xc_sr_restore.c
index 2f35f4d..fc47a25 100644
--- a/tools/libxc/xc_sr_restore.c
+++ b/tools/libxc/xc_sr_restore.c
@@ -332,7 +332,7 @@ static int process_page_data(struct xc_sr_context *ctx,
unsigned count,
static int handle_page_data(struct xc_sr_context *ctx, struct xc_sr_record
*rec)
{
xc_interface *xch = ctx->xch;
- struct xc_sr_rec_page_data_header *pages = rec->data;
+ struct xc_sr_rec_pages_header *pages = rec->data;
unsigned i, pages_of_data = 0;
int rc = -1;
@@ -368,14 +368,14 @@ static int handle_page_data(struct xc_sr_context *ctx,
struct xc_sr_record *rec)
for ( i = 0; i < pages->count; ++i )
{
- pfn = pages->pfn[i] & PAGE_DATA_PFN_MASK;
+ pfn = pages->pfn[i] & REC_PFINFO_PFN_MASK;
if ( !ctx->restore.ops.pfn_is_valid(ctx, pfn) )
{
ERROR("pfn %#"PRIpfn" (index %u) outside domain maximum", pfn, i);
goto err;
}
- type = (pages->pfn[i] & PAGE_DATA_TYPE_MASK) >> 32;
+ type = (pages->pfn[i] & REC_PFINFO_TYPE_MASK) >> 32;
if ( ((type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT) >= 5) &&
((type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT) <= 8) )
{
diff --git a/tools/libxc/xc_sr_save.c b/tools/libxc/xc_sr_save.c
index e93d8fd..b1a24b7 100644
--- a/tools/libxc/xc_sr_save.c
+++ b/tools/libxc/xc_sr_save.c
@@ -89,7 +89,7 @@ static int write_batch(struct xc_sr_context *ctx)
void *page, *orig_page;
uint64_t *rec_pfns = NULL;
struct iovec *iov = NULL; int iovcnt = 0;
- struct xc_sr_rec_page_data_header hdr = { 0 };
+ struct xc_sr_rec_pages_header hdr = { 0 };
struct xc_sr_record rec =
{
.type = REC_TYPE_PAGE_DATA,
diff --git a/tools/libxc/xc_sr_stream_format.h
b/tools/libxc/xc_sr_stream_format.h
index 3291b25..32400b2 100644
--- a/tools/libxc/xc_sr_stream_format.h
+++ b/tools/libxc/xc_sr_stream_format.h
@@ -80,15 +80,15 @@ struct xc_sr_rhdr
#define REC_TYPE_OPTIONAL 0x80000000U
/* PAGE_DATA */
-struct xc_sr_rec_page_data_header
+struct xc_sr_rec_pages_header
{
uint32_t count;
uint32_t _res1;
uint64_t pfn[0];
};
-#define PAGE_DATA_PFN_MASK 0x000fffffffffffffULL
-#define PAGE_DATA_TYPE_MASK 0xf000000000000000ULL
+#define REC_PFINFO_PFN_MASK 0x000fffffffffffffULL
+#define REC_PFINFO_TYPE_MASK 0xf000000000000000ULL
/* X86_PV_INFO */
struct xc_sr_rec_x86_pv_info
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |