On 24/02/2020 17:32, Ian Jackson wrote: > Andrew Cooper writes ("[PATCH v2 07/17] libxc/restore: STATIC_DATA_END > inference for v2 compatibility"): >> A v3 stream can compatibly read a v2 stream by inferring the position of the >> STATIC_DATA_END record. >> >> v2 compatibility is only needed for x86. No other architectures exist yet, >> but they will have a minimum of v3 when introduced. >> >> The x86 HVM compatibility point being in handle_page_data() (which is common >> code) is a bit awkward. However, as the two compatibility points are subtly >> different, and it is (intentionally) not possible to call into arch specific >> code from common code (except via the ops hooks), use some #ifdef-ary and >> opencode the check, rather than make handle_page_data() a per-arch helper. > ... >> +#if defined(__i386__) || defined(__x86_64__) >> + /* v2 compat. Infer the position of STATIC_DATA_END. */ >> + if ( ctx->restore.format_version < 3 && >> !ctx->restore.seen_static_data_end ) >> + { >> + rc = handle_static_data_end(ctx); >> + if ( rc ) > These 17 lines appears twice, in basically identical form. Could it > be refactored ?
Not really, no. The error handling (i.e. half of those 17 lines) is different, making it somewhat awkward to fit into a static inline. More importantly however, by design, common code can't call arch-specific code without a restore_ops hook. Deduping these would require breaking the restriction which is currently doing a decent job of keeping x86-isms out of common code. ~Andrew _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel