On 01.06.21 18:10, Olaf Hering wrote:
Introduce a helper which decides if a given pfn type has data for the migration stream.No change in behavior intended. Signed-off-by: Olaf Hering <[email protected]> --- tools/libs/saverestore/common.h | 17 ++++++++++++++++ tools/libs/saverestore/restore.c | 34 +++++--------------------------- tools/libs/saverestore/save.c | 14 ++----------- 3 files changed, 24 insertions(+), 41 deletions(-) diff --git a/tools/libs/saverestore/common.h b/tools/libs/saverestore/common.h index 36946e5d48..50a8479d39 100644 --- a/tools/libs/saverestore/common.h +++ b/tools/libs/saverestore/common.h @@ -467,6 +467,23 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count, /* Handle a STATIC_DATA_END record. */ int handle_static_data_end(struct xc_sr_context *ctx);+static inline bool page_type_has_stream_data(uint32_t type)+{ + bool ret; + + switch (type) + { + case XEN_DOMCTL_PFINFO_XTAB: + case XEN_DOMCTL_PFINFO_XALLOC: + case XEN_DOMCTL_PFINFO_BROKEN: + ret = false; + break; + default: + ret = true; + break; + } + return ret; +} #endif /* * Local variables: diff --git a/tools/libs/saverestore/restore.c b/tools/libs/saverestore/restore.c index cccb0dcb71..700f9e74b5 100644 --- a/tools/libs/saverestore/restore.c +++ b/tools/libs/saverestore/restore.c @@ -152,9 +152,8 @@ int populate_pfns(struct xc_sr_context *ctx, unsigned int count,for ( i = 0; i < count; ++i ){ - if ( (!types || (types && - (types[i] != XEN_DOMCTL_PFINFO_XTAB && - types[i] != XEN_DOMCTL_PFINFO_BROKEN))) && + if ( (!types || + (types && page_type_has_stream_data(types[i]) == true)) &&
What about XEN_DOMCTL_PFINFO_XALLOC? Is this case impossible here, or are you changing behavior? Juergen
OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
