Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 986B0C4727F for ; Fri, 25 Sep 2020 04:59:50 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2ED012176B for ; Fri, 25 Sep 2020 04:59:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="pW2PW2oK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2ED012176B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kLfpH-0006Yv-HP; Fri, 25 Sep 2020 04:59:19 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kLfpG-0006Yq-PW for xen-devel@lists.xenproject.org; Fri, 25 Sep 2020 04:59:18 +0000 X-Inumbo-ID: ef250099-b52e-4c4f-a3da-2fe66a3c0d19 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ef250099-b52e-4c4f-a3da-2fe66a3c0d19; Fri, 25 Sep 2020 04:59:17 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601009956; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0v/WMlgkfi9TYVGlZa1tHEnF9uCEChA3owDrpuVw0jM=; b=pW2PW2oKpdAw+Wh0NONQyrm0N/VLM6lRIaIswITgaK3+CzNmKF5ulKBULbmoY+4pGZqC05 JLb76gsc/VAQYA45KeeFj7mqwoudhL9tYspT6b+DIyBgl5Ah+4NBmCoJnU45QViRo4DCN1 idA70Jo3eAkujrnQh8CSQ4khlfWtVQo= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7333AAB0E; Fri, 25 Sep 2020 04:59:16 +0000 (UTC) Subject: Re: [PATCH] tools/libs/guest: fix out of tree builds of libxenguest users To: Andrew Cooper , xen-devel@lists.xenproject.org Cc: Ian Jackson , Wei Liu References: <20200923052401.24917-1-jgross@suse.com> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: <1a17f926-c08b-97db-e5a4-bdfcc36bca03@suse.com> Date: Fri, 25 Sep 2020 06:59:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 24.09.20 22:23, Andrew Cooper wrote: > On 23/09/2020 06:24, Juergen Gross wrote: >> xenguest.h includes xenctrl_dom.h, which is including the Xen internal >> xen/libelf/libelf.h. This results in build failures for components >> using libxenguest when being built outside the Xen build environment. >> >> Fix that by guarding the include of xenctrl_dom.h with >> "#ifdef __XEN_TOOLS_". >> >> Fixes: 7e0165c19387 ("tools/libxc: untangle libxenctrl from libxenguest") >> Reported-by: Andrew Cooper >> Signed-off-by: Juergen Gross >> --- >> tools/libs/guest/include/xenguest.h | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/tools/libs/guest/include/xenguest.h b/tools/libs/guest/include/xenguest.h >> index 4643384790..5cd502f644 100644 >> --- a/tools/libs/guest/include/xenguest.h >> +++ b/tools/libs/guest/include/xenguest.h >> @@ -22,7 +22,9 @@ >> #ifndef XENGUEST_H >> #define XENGUEST_H >> >> +#ifdef __XEN_TOOLS__ >> #include >> +#endif > > I have to admit that this doesn't feel right to put into a public header. > > Can't we split xenctrl_dom in half and merge the relevant subsets into > xen{ctrl,guest}.h ? Yes, but the xenctrl.h half will be empty :-) (see my patch from Sep 9th). The #ifdef will remain, though. Another solution would be to make xenctrl_dom.h an internal header again which has to be included by every user needing the domain loader stuff. Question then is why all of this is part of libxenguest. Or we could remove the prototype of xc_dom_register_loader() and the definition of struct xc_dom_loader from the header and make it private to libxenguest, and modify struct xc_dom_image to hold an opaque pointer to struct elf_dom_parms instead of having it as a sub-structure. This would remove the need to include xen/libelf/libelf.h from xenctrl_dom.h. The question would then be how usable the whole stuff is for someone not having the layout of struct elf_dom_parms. And finally we could split libxenguest and have a libxendomload which will be usable Xen internal only. Any preference? Juergen