Hi,
On 02/09/2025 18:55, Mykola Kvach wrote:
--- a/xen/include/xen/domain.h
+++ b/xen/include/xen/domain.h
@@ -8,6 +8,10 @@
#include <public/xen.h>
+#if __has_include(<asm/suspend.h>)
+#include <asm/suspend.h>
+#endif
+
struct guest_area {
struct page_info *pg;
void *map;
@@ -109,6 +113,13 @@ int arch_domain_soft_reset(struct domain *d);
void arch_domain_creation_finished(struct domain *d);
+#if !__has_include(<asm/suspend.h>)
+static inline int arch_domain_resume(struct domain *d)
+{
+ return 0;
+}
+#endif /* !__has_include(<asm/suspend.h>) */
+
void arch_p2m_set_access_required(struct domain *d, bool access_required);
int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c);
Imo it would be preferable to have such in a single #if/#else. There's nothing
wrong with an #include not sitting at the very top.
I understand that includes can be placed near where something from the
header is used. However, I find it more natural to keep them together
in a single location.
It is not always possible to keep all includes together. I also have a
slight preference to Jan suggestion because we don't have multiple "#if
__has_include(<asm/suspend.h>)" which I find rather ugly but necessary.
(Another question is whether to put this in xen/domain.h at all. There could
be a xen/suspend.h having - for now at least - just this and nothing else.)
With this approach, I don’t need to move the include to the middle of
the file.
A new suspend.h file would also work for me.
Cheers,
--
Julien Grall