[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 2/4] xen/save: allow the usage of zeroextend and a fixup function
With the current compat implementation in the save/restore context handling, only one compat structure is allowed, and using _zeroextend prevents the fixup function from being called. In order to allow for the compat handling layer to be able to handle different compat versions allow calling the fixup function with hvm_load_entry_zeroextend. Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Cc: Jan Beulich <jbeulich@xxxxxxxx> Cc: Tim Deegan <tim@xxxxxxx> --- xen/include/xen/hvm/save.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/xen/include/xen/hvm/save.h b/xen/include/xen/hvm/save.h index a97694e..22bcdb9 100644 --- a/xen/include/xen/hvm/save.h +++ b/xen/include/xen/hvm/save.h @@ -58,19 +58,22 @@ void _hvm_read_entry(struct hvm_domain_context *h, * Unmarshalling: check, then copy. Evaluates to zero on success. This load * function requires the save entry to be the same size as the dest structure. */ -#define _hvm_load_entry(_x, _h, _dst, _strict) ({ \ - int r; \ - struct hvm_save_descriptor *d \ - = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur]; \ - if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ - HVM_SAVE_LENGTH(_x), (_strict))) == 0 ) \ - _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x)); \ - else if (HVM_SAVE_HAS_COMPAT(_x) \ - && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ - HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \ - _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x)); \ - r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length); \ - } \ +#define _hvm_load_entry(_x, _h, _dst, _strict) ({ \ + int r; \ + struct hvm_save_descriptor *d \ + = (struct hvm_save_descriptor *)&(_h)->data[(_h)->cur]; \ + if ( (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ + HVM_SAVE_LENGTH(_x), (_strict))) == 0 ) { \ + _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH(_x)); \ + if ( HVM_SAVE_HAS_COMPAT(_x) && d->length != HVM_SAVE_LENGTH(_x) ) \ + r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length); \ + } \ + else if (HVM_SAVE_HAS_COMPAT(_x) \ + && (r = _hvm_check_entry((_h), HVM_SAVE_CODE(_x), \ + HVM_SAVE_LENGTH_COMPAT(_x), (_strict))) == 0 ) { \ + _hvm_read_entry((_h), (_dst), HVM_SAVE_LENGTH_COMPAT(_x)); \ + r = HVM_SAVE_FIX_COMPAT(_x, (_dst), d->length); \ + } \ r; }) #define hvm_load_entry(_x, _h, _dst) \ -- 1.9.5 (Apple Git-50.3) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |