From nobody Sun Feb 8 18:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1655806341; cv=none; d=zohomail.com; s=zohoarc; b=Js57iHs+J9DX4QmXNDPuPetp0TKq+J+Wop0OneVI4juwI9CtDO5+w4b/7jyPqt0+9HFs0ygEJ4fpuXK9LbP8dBd8y+fdcQYUvuQF9GYI8NPYukkGCOalFUQODGdXmzd4X82i8mlHjM5T6R0u9jJJ/bvWVPxGTMPHZpLXJ1VzX4I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655806341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=33uc4xRYYc+TMDeNCezCgP6ud2MmtvxNVPYEz1khdfU=; b=BOdXyBa9Lf5YD8yBZVqxxFdXCoSHS0Bp2o5QL7pUTpwaVCHYF0EwJ7BeuzvUx/md6nCtuh5aksPzur5zGYly/IxeCXAvFi32FaYy9/3KKUF5Wri4oxQtbt3K58SHIhTGixCAVy2JnhcS6VmAiCL5Z9kPCYABbPgPvMHhVwqRRNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655806341699359.4105280394472; Tue, 21 Jun 2022 03:12:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.353158.580064 (Exim 4.92) (envelope-from ) id 1o3arV-0001dt-0M; Tue, 21 Jun 2022 10:11:57 +0000 Received: by outflank-mailman (output) from mailman id 353158.580064; Tue, 21 Jun 2022 10:11:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o3arU-0001dm-T0; Tue, 21 Jun 2022 10:11:56 +0000 Received: by outflank-mailman (input) for mailman id 353158; Tue, 21 Jun 2022 10:11:55 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o3arT-0001dg-8N for xen-devel@lists.xenproject.org; Tue, 21 Jun 2022 10:11:55 +0000 Received: from esa3.hc3370-68.iphmx.com (esa3.hc3370-68.iphmx.com [216.71.145.155]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9158e4a7-f14a-11ec-bd2d-47488cf2e6aa; Tue, 21 Jun 2022 12:11:52 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9158e4a7-f14a-11ec-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1655806312; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7MDJa/m5qjvzvr9hb3TI3e/TXp0vIhk0EimgAI5h7z8=; b=ETp6PaeArAqyl4x2MnlgpnGyN5b1a0Kf5RfwETpd2wyMNwY/esh2DsLR MYSxyqIixRX7e5LVPzBIA0XcdF1SzsQB6HbMMzWCC9YnR++TNGH+mNnEN 6Q5MZP0y+22F6c/uCR6ZU+5zJoGm+p8TVQ7iKZ5By57X+2YUEzOYrSw0w 0=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 74055919 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:y0fO/6mIC9K4DnBqOedlZcHo5gyTJkRdPkR7XQ2eYbSJt1+Wr1Gzt xIcWTqCPPuCNmvwfYt+Pt63/R4PvMXVzYQwTFM5/ylnQiMWpZLJC+rCIxarNUt+DCFioGGLT Sk6QoOdRCzhZiaE/n9BCpC48T8kk/vgqoPUUIYoAAgoLeNfYHpn2EgLd9IR2NYy24DnWVrV4 LsenuWEULOb828sWo4rw/rrRCNH5JwebxtB4zTSzdgS1LPvvyF94KA3fMldHFOhKmVgJcaoR v6r8V2M1jixEyHBqD+Suu2TnkUiGtY+NOUV45Zcc/DKbhNq/kTe3kunXRa1hIg+ZzihxrhMJ NtxWZOYWV4rZv3+gv8haj4bITBEG/BA4I2bCC3q2SCT5xWun3rExvxvCAc9PJEC+/YxCmZLn RAaAGlTNFbZ3bvwme/lDLk37iggBJCD0Ic3s3d8zTbfHLA+TIrKWani7t5ExjYgwMtJGJ4yY uJGNWIyMUWZMnWjPH8uN5URh+2OtkW4fhJ7twiVmq8czTXcmVkZPL/Fb4OOJ43iqd9utkSFo mPL+UzpDxdcM8aQoRKe6W6ljOLLmSL9WaoRGae++/osh0ecrkQMDDUGWF39puO24mauVtQaJ 0EK9y4Gqakp6FftXtT7Rwe/onOPolgbQdU4O8c38h2Xw6zYpSOQHHEZTyVpYcYj8sQxQFQC1 FWEgtfoDjxHq6CORDSW8bL8kN+pEXFLdylYP3ZCFFZbpYm4yG0usv7RZsY6EvblvMfuJQjXg AKblg5jga0h0edegs1X4mv7byKQSonhF1Bou1qIAzL7sWuVd6b+OdX2tAGzAeJoad/AEwLf5 CVsd922trhmMH2bqMCarAzh9pmN7u3NDjDTiEUH83IJp2X0oC7LkWy9DVhDyKZV3iUsI2aBj Lf741852XOqFCLCgVVLS4ywEd826qPrCM7oUPvZBvIXPMUsK1LfpH40PB/Pt4wIrKTLufhnU ap3jO72VSpKYUiZ5GHeqxghPU8DmXllmDK7qWHTxBW7y7uODEOopUM+GALWNIgRtfrcyC2Mq oY3H5bbkH13DbyhChQ7BKZOdDjm21BgXcCowyGWH8beSjdb9JYJUaSOmul+IdI7wsy4VI7gp xmAZ6OR83Kn7VWvFOlAQioLhG/HNXqnkU8GAA== IronPort-HdrOrdr: A9a23:sXKYbK7YFtBS4KbPawPXwPDXdLJyesId70hD6qhwISY6TiX+rb HJoB17726NtN9/YhEdcLy7VJVoBEmskKKdgrNhWotKPjOW21dARbsKheCJrgEIWReOktK1vZ 0QCpSWY+eQMbEVt6nHCXGDYrQd/OU= X-IronPort-AV: E=Sophos;i="5.92,209,1650945600"; d="scan'208";a="74055919" From: Anthony PERARD To: CC: Anthony PERARD , Bertrand Marquis , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v2.1 1/4] build,include: rework shell script for headers++.chk Date: Tue, 21 Jun 2022 11:11:28 +0100 Message-ID: <20220621101128.50543-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220614162248.40278-1-anthony.perard@citrix.com> References: <20220614162248.40278-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1655806343997100001 Content-Type: text/plain; charset="utf-8" The command line generated for headers++.chk by make is quite long, and in some environment it is too long. This issue have been seen in Yocto build environment. Error messages: make[9]: execvp: /bin/sh: Argument list too long make[9]: *** [include/Makefile:181: include/headers++.chk] Error 127 Rework so that we do the foreach loop in shell rather that make to reduce the command line size by a lot. We also need a way to get headers prerequisite for some public headers so we use a switch "case" in shell to be able to do some simple pattern matching. Variables alone in POSIX shell don't allow to work with associative array or variables with "/". Also rework headers99.chk as it has a similar implementation, even if with only two headers to check the command line isn't too long at the moment. Reported-by: Bertrand Marquis Fixes: 28e13c7f43 ("build: xen/include: use if_changed") Signed-off-by: Anthony PERARD Reviewed-by: Bertrand Marquis Acked-by: Jan Beulich Reviewed-by: Michal Orzel Tested-by: Michal Orzel --- Notes: v3: - add one more pattern to avoid a possible empty body for "case" - use $() instead of `` to execute get_prereq() - also convert headers99_chk - convert some 'tab' to 'space', have only 1 tab at start of line =20 v2: - fix typo in commit message - fix out-of-tree build =20 v1: - was sent as a reply to v1 of the series xen/include/Makefile | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 617599df7e..510f65c92a 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -141,13 +141,24 @@ cmd_header_chk =3D \ quiet_cmd_headers99_chk =3D CHK $@ define cmd_headers99_chk rm -f $@.new; \ - $(foreach i, $(filter %.h,$^), \ - echo "#include "\"$(i)\" \ + get_prereq() { \ + case $$1 in \ + $(foreach i, $(filter %.h,$^), \ + $(if $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + $(i)$(close) \ + echo "$(foreach j, $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + -include $(j).h)";;)) \ + *) ;; \ + esac; \ + }; \ + for i in $(filter %.h,$^); do \ + echo "#include "\"$$i\" \ | $(CC) -x c -std=3Dc99 -Wall -Werror \ -include stdint.h \ - $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include $(j)= .h) \ + $$(get_prereq $$i) \ -S -o /dev/null - \ - || exit $$?; echo $(i) >> $@.new;) \ + || exit $$?; echo $$i >> $@.new; \ + done; \ mv $@.new $@ endef =20 @@ -158,13 +169,23 @@ define cmd_headerscxx_chk touch $@.new; \ exit 0; \ fi; \ - $(foreach i, $(filter %.h,$^), \ - echo "#include "\"$(i)\" \ + get_prereq() { \ + case $$1 in \ + $(foreach i, $(filter %.h,$^), \ + $(if $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + $(i)$(close) \ + echo "$(foreach j, $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + -include c$(j))";;)) \ + *) ;; \ + esac; \ + }; \ + for i in $(filter %.h,$^); do \ + echo "#include "\"$$i\" \ | $(CXX) -x c++ -std=3Dgnu++98 -Wall -Werror -D__XEN_TOOLS__ \ -include stdint.h -include $(srcdir)/public/xen.h \ - $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include c$(j= )) \ + $$(get_prereq $$i) \ -S -o /dev/null - \ - || exit $$?; echo $(i) >> $@.new;) \ + || exit $$?; echo $$i >> $@.new; done; \ mv $@.new $@ endef =20 --=20 Anthony PERARD From nobody Sun Feb 8 18:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1655223813; cv=none; d=zohomail.com; s=zohoarc; b=UQ29XrLwvfkSIxZ0X9QmTouOoJj8LJ5eAiCoorTGUp+6uPjhAMjadON21JaUtOn5ae3ZdwcF9kt6xGH3/TfQVkhrhWMn9y2BB/hoflworh9RaL185zRd+RnrgmXEdNFHqv3lYDviHFhi9LCGgPNyskr6BukhaM2l62E1v74h1vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655223813; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=UZ4ei7LTKyFPvVKKZSmJoNZD46PHLN0EV05oxcd/e+M=; b=XDRacON1O7ffOi0VjP8F3F1W071l7hOg+jb37S4qe5sioSCn+B/7gJKugOakRbdGn/y7aOKJ1rSO9jhG6phRiIwIIaLNBeA7w8pumfr+aH63RCL0XyDfM30FGGwt5GPc8EOGfkTS/72fXqxWgvLjxVRSD30oqoePRbcFKD/OQd0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655223813958790.3379885934178; Tue, 14 Jun 2022 09:23:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.349230.575424 (Exim 4.92) (envelope-from ) id 1o19Jx-0002mq-0d; Tue, 14 Jun 2022 16:23:13 +0000 Received: by outflank-mailman (output) from mailman id 349230.575424; Tue, 14 Jun 2022 16:23:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jw-0002mj-Tw; Tue, 14 Jun 2022 16:23:12 +0000 Received: by outflank-mailman (input) for mailman id 349230; Tue, 14 Jun 2022 16:23:12 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jv-0002Ro-Ue for xen-devel@lists.xenproject.org; Tue, 14 Jun 2022 16:23:12 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 474bd579-ebfe-11ec-a26a-b96bd03d9e80; Tue, 14 Jun 2022 18:23:10 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 474bd579-ebfe-11ec-a26a-b96bd03d9e80 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1655223790; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=TqPwIHKluWSn+BpKllnZiPLlU5cGc7TXXVi/MIH8tIg=; b=VELFbLG4CJwQcX/iSrn2eH242SE52ZrNVfGX1O3rOKBFeiT1Psljw/zP a+A9TmubKE9tF5KPTcoDEYIbrMv+dFF4BCOQ9qreuagx8d+qnFzFYdIRk PqdGIhaNzvm5AeNJ0b7PmDU4rpa4XmoaV7rVayt+RV+hGML6mH/eSFu49 k=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 76142775 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:INnBtaqiHdWsiaV2QScEX9XrRT9eBmILZRIvgKrLsJaIsI4StFCzt garIBmGb67YZWXye9kka9y3ph4H68fVz4c1SAZl+XsyQShE+JuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlVEliefQAOCU5NfsYkidfyc9IMsaoU8lyrdRbrJA24DjWVvT4 I+q+aUzBXf+s9JKGjNMg068gEsHUMTa4Fv0aXRnOJinFHeH/5UkJMp3yZOZdhMUcaENdgKOf M7RzanRw4/s10xF5uVJMFrMWhZirrb6ZWBig5fNMkSoqkAqSicais7XOBeAAKv+Zvrgc91Zk b1wWZKMpQgBGJbyvLUkQRNkL2J/eoZG/Zz8L1KhmJnGp6HGWyOEL/RGCUg3OcsT+/ptAHEI/ vsdQNwPRknd3aTsmuv9E7QywJR4RCXoFNp3VnVIxDfFDfEgUNbbTr/D/9Nw1zYsnMFeW/3ZY qL1bBIwMk2cOUIQZz/7DrpvzOyPvEDZVwF58kjKiKs25GXO6k9+he2F3N39JYXRGJQ9clyjj mDb+2X0BDkKOdrZziCKmlq3nfPGly7/XIMUFZW7++RsjVnVwXYcYDUJUXOrrP//jVSxM/pPJ kpR9icwoKwa8E2wUsK7TxC+uGSDvBMXR5xXCeJSwCuA0LbO6gCVQE0NVCdcaccOvdUzAzct0 zehndnkGDhuu729Um+G+/GfqjbaBMQOBTZcP2leF1JDuoS95tFo5v7Scjp9OIiOsPmkICP6/ wzJrW8Vh7AwtsAhyYzuqDgrnAmQSoj1oh8dv1uKAzj8sVknOOZJdKTztwGFsK8owJKxCwDY4 SNaw5X2APUmV8nlqcCbfAka8FhFDd6hOSaUv1NgFoJJG9+Fqy/6JtA4DN2TyS5U3ic4ldzBO ha7Vft5vsM7AZdTRfYfj3iNI8or17P8Mt/uS+rZaNFDCrAoKlLapX0zPxHNhT+1+KTJrU3YE cbzTCpRJSxCVfQPIMSeHI/xLoPHNghhnDiOFPgXPjys0KaEZW79dIrpxGCmN7hjhIvd+V292 48Ga6OilkQEOMWjM3a/zGLmBQ1TRZTNLcuu+5I/my/qClcOJVzN/NeKnet9I9U8xPQK/goKl 1nkMnJlJJPErSWvAW23hrpLNNsDgb4XQaoHABER IronPort-HdrOrdr: A9a23:eqfz2qvCXlfNHosKaMPgXT1E7skDctV00zEX/kB9WHVpm6uj5q aTdZUgpHjJYVMqMk3I9urvBEDtexzhHP1OkOss1NWZLW3bUQKTRekP0WKF+UyCJ8SXzIVgPM xbEpSWZueRMbErt6vHCEvRKadE/OW6 X-IronPort-AV: E=Sophos;i="5.91,300,1647316800"; d="scan'208";a="76142775" From: Anthony PERARD To: CC: Anthony PERARD , Bertrand Marquis , Bertrand Marquis , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v2 1/4] build,include: rework shell script for headers++.chk Date: Tue, 14 Jun 2022 17:22:45 +0100 Message-ID: <20220614162248.40278-2-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220614162248.40278-1-anthony.perard@citrix.com> References: <20220614162248.40278-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1655223814810100001 Content-Type: text/plain; charset="utf-8" The command line generated for headers++.chk by make is quite long, and in some environment it is too long. This issue have been seen in Yocto build environment. Error messages: make[9]: execvp: /bin/sh: Argument list too long make[9]: *** [include/Makefile:181: include/headers++.chk] Error 127 Rework so that we do the foreach loop in shell rather that make to reduce the command line size by a lot. We also need a way to get headers prerequisite for some public headers so we use a switch "case" in shell to be able to do some simple pattern matching. Variables alone in POSIX shell don't allow to work with associative array or variables with "/". Reported-by: Bertrand Marquis Fixes: 28e13c7f43 ("build: xen/include: use if_changed") Signed-off-by: Anthony PERARD Reviewed-by: Bertrand Marquis --- Notes: v2: - fix typo in commit message - fix out-of-tree build =20 v1: - was sent as a reply to v1 of the series xen/include/Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 6d9bcc19b0..49c75a78f9 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -158,13 +158,22 @@ define cmd_headerscxx_chk touch $@.new; \ exit 0; \ fi; \ - $(foreach i, $(filter %.h,$^), \ - echo "#include "\"$(i)\" \ + get_prereq() { \ + case $$1 in \ + $(foreach i, $(filter %.h,$^), \ + $(if $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + $(i)$(close) \ + echo "$(foreach j, $($(patsubst $(srctree)/%,%,$(i))-prereq), \ + -include c$(j))";;)) \ + esac; \ + }; \ + for i in $(filter %.h,$^); do \ + echo "#include "\"$$i\" \ | $(CXX) -x c++ -std=3Dgnu++98 -Wall -Werror -D__XEN_TOOLS__ \ -include stdint.h -include $(srcdir)/public/xen.h \ - $(foreach j, $($(patsubst $(srctree)/%,%,$i)-prereq), -include c$(j= )) \ + `get_prereq $$i` \ -S -o /dev/null - \ - || exit $$?; echo $(i) >> $@.new;) \ + || exit $$?; echo $$i >> $@.new; done; \ mv $@.new $@ endef =20 --=20 Anthony PERARD From nobody Sun Feb 8 18:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1655223815; cv=none; d=zohomail.com; s=zohoarc; b=FYlNwEkq32NF5YYfqwj7NA1Akycq+MoYLXISLNNFi5ZXkL0zdEKqBU+FWVAN+ZqootyjgBIo+ZKpjkMyarMAGSYZA+kN5siLVx6pFNSPsT6dMBVqvavu54r8BOuP/QUnNfFxKrcYCyaKayHx1y+jKfJwPMz/RoXvWRReJZLr9lI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655223815; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=c1KwJOGWWQpnhfEZZ8nAEu7NijinSbcGgTmCJ3/4iO0=; b=AN4rsdwM9gUSHyXXF0ExP+X06pDAO1Ea0Kt0eqbqoiqV0nSxEb4CXIP5itSiF9HcQG0ZCSjgeFMjEFeipT526oSAzx0C8WrFRUYeEFOJiSOjOh6x3ht9ywwpHit+kQx8vQzYkLQYwod4e4jAduy5uaeh0OEyyJiSJ/OoekJIXlk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655223815424625.2539014046804; Tue, 14 Jun 2022 09:23:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.349231.575435 (Exim 4.92) (envelope-from ) id 1o19Jy-00033C-AK; Tue, 14 Jun 2022 16:23:14 +0000 Received: by outflank-mailman (output) from mailman id 349231.575435; Tue, 14 Jun 2022 16:23:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jy-000335-5k; Tue, 14 Jun 2022 16:23:14 +0000 Received: by outflank-mailman (input) for mailman id 349231; Tue, 14 Jun 2022 16:23:13 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jx-0002Ro-4B for xen-devel@lists.xenproject.org; Tue, 14 Jun 2022 16:23:13 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 48cb3387-ebfe-11ec-a26a-b96bd03d9e80; Tue, 14 Jun 2022 18:23:12 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 48cb3387-ebfe-11ec-a26a-b96bd03d9e80 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1655223791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LmV86saEUcknXXo+WrjWMC73fwG5cbzc7dPP7bJAl9Q=; b=Lb54RinZUkl2Lbl6irlUNla/gAMonL7CCCvKBO7aTjio3bTe370lyVeE T/MTRxtjOZuUhz4Yq0SJrW+92DNmemoAtq2PJJeWAcmmoLIi3XInD1GfJ Tujzo6fpfJFfKdpgns+OqhtUjKREEZ7NU5eBGQWjcvevFRTIVG6flOrrb 0=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 76142776 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:RBt+aap3Aeehknk9NjD7tlQwn1deBmJhZRIvgKrLsJaIsI4StFCzt garIBmFOv+MNmHzL94nao/loRwCuZeEyYQxSwM4/yBhEiNE+ZuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlVEliefQAOCU5NfsYkidfyc9IMsaoU8lyrdRbrJA24DjWVvT4 I+q+aUzBXf+s9JKGjNMg068gEsHUMTa4Fv0aXRnOJinFHeH/5UkJMp3yZOZdhMUcaENdgKOf M7RzanRw4/s10xF5uVJMFrMWhZirrb6ZWBig5fNMkSoqkAqSicais7XOBeAAKv+Zvrgc91Zk b1wWZKMpQgBGJbyvLUkQRNkL2J/eoZG/Zz8L1KhmJnGp6HGWyOEL/RGCUg3OcsT+/ptAHEI/ vsdQNwPRknd3aTsmuv9E7QywJR4RCXoFNp3VnVIxDfFDfEgUNbbTr/D/9Nw1zYsnMFeW/3ZY qL1bBIwMk2cOUIQZD/7DrobucOGhVPnTwdkqXivqrsazk2D/gVIhe2F3N39JYXRGJQ9clyjj nnd423zDxUeNdqe4TmI6HShgqnIhyyTcJ0WPK218LhtmlL77m4ODBwbU3OrrP//jVSxM/pPJ kpR9icwoKwa8E2wUsK7TxC+uGSDvBMXR5xXCeJSwAOHx7fQ4g2ZLnMZVTMHY9sj3PLaXhRzi AXPxYmwQ2Uy7vvFEhpx64t4sxuUAhYxfFYQbxM4DgpCyNnmg7o9pAzmG4ML/LGOsjHlJd3h6 2nU8XVk3upJ05JjO7aTpg6e3W/1znTdZktsv1iMADr4hu9sTNT9D7FE/2Q3+hqpwGyxalCa9 EYJlMGFhAzlJcHczXfdKAnh8VzA2hpkDNE/qQQ2d3XZ327xk0NPhKgJiN2EGG9nM9wfZRjia 1LJtAVa6fd7ZSX3MPYrPtjuVp51lcAM8OgJsdiFBuein7ArLFPXlM2QTRX4M5/RfLgEzvhkZ MbznTeEBncGE6V3pAeLqxMm+eZznEgWnDqLLbiilkjP+efPPxa9FOZaWGZim8hktctoVi2Oq 4YBXyZLoj0CONDDjt7/qtJLcQhTdCNrWvgbaaV/L4a+H+avI0l5Y9e5/F/rU9ANc3h9/gsQw kyAZw== IronPort-HdrOrdr: A9a23:4MnwQKAUt1QEoqnlHemo55DYdb4zR+YMi2TDsHoBLyC9E/bo8P xG+c5w6faaslgssR0b9uxoW5PwI080l6QFhbX5VI3KNGXbUQ2TXeJfBOPZqAEIcBeeygcy78 ddmvhFZeEZTzBB/KPH3DU= X-IronPort-AV: E=Sophos;i="5.91,300,1647316800"; d="scan'208";a="76142776" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v2 2/4] build: remove auto.conf prerequisite from compat/xlat.h target Date: Tue, 14 Jun 2022 17:22:46 +0100 Message-ID: <20220614162248.40278-3-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220614162248.40278-1-anthony.perard@citrix.com> References: <20220614162248.40278-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1655223816758100003 Content-Type: text/plain; charset="utf-8" Now that the command line generating "xlat.h" is check on rebuild, the header will be regenerated whenever the list of xlat headers changes due to change in ".config". We don't need to force a regeneration for every changes in ".config". Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- xen/include/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index 49c75a78f9..0d3e3d66e0 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -101,7 +101,7 @@ cmd_xlat_h =3D \ cat $(filter %.h,$^) >$@.new; \ mv -f $@.new $@ =20 -$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) $(obj)/c= onfig/auto.conf FORCE +$(obj)/compat/xlat.h: $(addprefix $(obj)/compat/.xlat/,$(xlat-y)) FORCE $(call if_changed,xlat_h) =20 ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) --=20 Anthony PERARD From nobody Sun Feb 8 18:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1655223816; cv=none; d=zohomail.com; s=zohoarc; b=hM75QrN6Rn6KFkgE9k3TJg91e8+jZu0oUhvRLveLeG4yLmNEvq8MiQja7C7aFtY5PJ68VQWc45u2t/JqX2Q7pFCHIe20LfcMdjZ9OkusDQnP96+BlXu1XG2UVDI0HUmQHLxhKuX4BrcN8ehZxZUa0r98suy73OA2Vykp4bzwasw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655223816; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ttRQ2BN1XQwzM4a5neRTD4vGB3Hh43yntfMkG/m/V64=; b=VYeNzokmY69jyk4vtrxdIZgb+4E081TXblUPaweX54NsjAXGgwpVpcBT6GGIwWnM8t4+u9x1DJqLhU2pPiWSnJmXoBzECnh/8bfTwq9h6L/IktciRGa362xpE2O1aeB0qlQ4V5GFRuotGC9aeOg6SGgt1PLZk081kycJv64CrzY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655223816846461.70052603782585; Tue, 14 Jun 2022 09:23:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.349232.575446 (Exim 4.92) (envelope-from ) id 1o19Jz-0003LI-JJ; Tue, 14 Jun 2022 16:23:15 +0000 Received: by outflank-mailman (output) from mailman id 349232.575446; Tue, 14 Jun 2022 16:23:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jz-0003L9-Fr; Tue, 14 Jun 2022 16:23:15 +0000 Received: by outflank-mailman (input) for mailman id 349232; Tue, 14 Jun 2022 16:23:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19Jy-0002Ro-Gl for xen-devel@lists.xenproject.org; Tue, 14 Jun 2022 16:23:14 +0000 Received: from esa4.hc3370-68.iphmx.com (esa4.hc3370-68.iphmx.com [216.71.155.144]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 497f4024-ebfe-11ec-a26a-b96bd03d9e80; Tue, 14 Jun 2022 18:23:13 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 497f4024-ebfe-11ec-a26a-b96bd03d9e80 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1655223793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9MlmA0ylP6rG0RiM/rbCen5PZYrP6dJUfb3R+KkbnFk=; b=UGh32qkUesmrdcOVwJOrEMapL11c8pHSR028XetLQnrf7zZGCjzdqQJY ZwhkkLw920G1/RbKd9HnJh3q2gCXoIvMh7GE61C/xlJRKc/5dlYpAZNWA R32vG2X9YzBDiqIvNsa5QRMWoF13Sc8s4kA3ZE31j7A5905nzSvt0Rgra o=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 76142780 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:97t6kqijQ9I5jJ+PddKsB0HXX161GRAKZh0ujC45NGQN5FlHY01je htvCG3SPPnfYWH8Lop/YY+29x8E7MPRz9FgQVFkrXoyRX4b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oDJ9CU6jefSLlbFILas1hpZHGeIcw98z0M68wIFqtQw24LhXVrR4 YmaT/D3YzdJ5RYlagr41IrbwP9flKyaVOQw5wFWiVhj5TcyplFNZH4tDfjZw0jQG+G4KtWSV efbpIxVy0uCl/sb5nFJpZ6gGqECaua60QFjERO6UYD66vRJjnRaPqrWqJPwwKqY4tmEt4kZ9 TlDiXC/YTUwYrb9wN0RaRxVAQEiZYxKw4fVGXfq5KR/z2WeG5ft6/BnDUVwNowE4OdnR2pJ8 JT0KhhUMErF3bjvhuvmFK883azPL+GyVG8bknhm0THeC+dgWZ3ZSr/GzdRZwC0xloZFGvO2i 88xNmQ2ME6fM0Un1lE/F4IflsaZrSjEdzxDgnDNoo1m/0PO9VkkuFTqGIWMIYHbLSlPpW6Dv X7P9Wn9BhAcNfScxCCD/3bqgfXA9QvkXKoCGbv+8eRl6HWR22gSBRs+RVa95/6jhSaWS99Zb kAZ5Ccqhawz71CwCMnwWQWip3yJtQJaXMBfe8U44gyQzqvf4y6CG3MJCDVGbbQbWNQeHGJwk AXTxpWwWGIp4Ob9pW+hGqm8nyruIhlNFGM4YCIWbVddwtXYmJMLgUeaJjp8K5JZnuEZCBmpn W3X9nFh3etP5SIY//7lpA6a2lpAsrCMF1dovVuPAwpJ+ysjPOaYi5qUBU83BBqqBKKQVRG/s XcNgKByB8heXMjWxERhrAjgdYxFBspp0xWG2DaD57F7q1yQF4eLJOi8Gg1WKkZzKdojcjT0e kLVsg45zMYNYSbzMfItPN/rVJxCIU3c+TPNB5jpgidmOMAtJGdrAgk1DaJv44wduBd1yvxuU XtqWc2tEWwbGcxa8dZCfM9EieVD7nlnnQv7HMmnpzz6gOH2TCPEFt843K6mM7lRAFWs+12Fr b6y9qKiln1ibQEJSnKLqdJLdAlRfSdT6FKfg5U/S9Nv6zFOQAkJY8I9C5t7E2C5t8y5Ttv1w 0w= IronPort-HdrOrdr: A9a23:DxzUU6H8GtAsNQvSpLqE0MeALOsnbusQ8zAXP0AYc3Jom6uj5q aTdZUgpGfJYVkqOE3I9ertBEDEewK4yXcX2/h3AV7BZniEhILAFugLhuGO/9SjIVybygc079 YYT0EUMrzN5DZB4voSmDPIceod/A== X-IronPort-AV: E=Sophos;i="5.91,300,1647316800"; d="scan'208";a="76142780" From: Anthony PERARD To: CC: Anthony PERARD , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [XEN PATCH v2 3/4] build: set PERL Date: Tue, 14 Jun 2022 17:22:47 +0100 Message-ID: <20220614162248.40278-4-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220614162248.40278-1-anthony.perard@citrix.com> References: <20220614162248.40278-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1655223818766100005 Content-Type: text/plain; charset="utf-8" We are going to use it in a moment. Also update README about Perl requirement. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v2: - update ./README xen/Makefile | 1 + README | 1 + 2 files changed, 2 insertions(+) diff --git a/xen/Makefile b/xen/Makefile index 82f5310b12..a6650a2acc 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -22,6 +22,7 @@ PYTHON_INTERPRETER :=3D $(word 1,$(shell which python3 py= thon python2 2>/dev/null) export PYTHON ?=3D $(PYTHON_INTERPRETER) =20 export CHECKPOLICY ?=3D checkpolicy +export PERL ?=3D perl =20 $(if $(filter __%, $(MAKECMDGOALS)), \ $(error targets prefixed with '__' are only for internal use)) diff --git a/README b/README index 5e55047ffd..c1c18de7e0 100644 --- a/README +++ b/README @@ -64,6 +64,7 @@ provided by your OS distributor: * iproute package (/sbin/ip) * GNU bison and GNU flex * ACPI ASL compiler (iasl) + * Perl =20 In addition to the above there are a number of optional build prerequisites. Omitting these will cause the related features to be --=20 Anthony PERARD From nobody Sun Feb 8 18:01:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1655223820; cv=none; d=zohomail.com; s=zohoarc; b=NjNUquNn45hh5mXR4on6thHfPhCo3GnyxBUsXWCGmVoA7cHzNpRXrDuA7gehtElQnDsCIM+rZyAzTM60GWJIC6jcB26t4++9xgFC+jBKc+9yZY2ZPY1Ab13hoaeSEFzf6KAZZxpWRxVAOB0SCBTnm0OV6UwycHtqnPWv//gCxOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655223820; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gMqFutY0RAd+vlxjLXDsP4lkF9Kayom5PJqNspYmWBw=; b=KuQCwc1T35gEXFj019lY+shvD1FIkcnkKjswp3Xso+/Z8OmLDZnZKWjV+NrlBQXOWH1fjf1NFu8LlPgz4rSQtxGSCa4xmMtdphYaLvodxxujDzdTmQ+sVU3rmMY9W1NRxBNF/FrPqSbyEb7xmVyYcjASxwE9x6M7XI8GVa5PieE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655223820295594.2769627634241; Tue, 14 Jun 2022 09:23:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.349234.575457 (Exim 4.92) (envelope-from ) id 1o19K3-0003iz-1g; Tue, 14 Jun 2022 16:23:19 +0000 Received: by outflank-mailman (output) from mailman id 349234.575457; Tue, 14 Jun 2022 16:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19K2-0003im-UJ; Tue, 14 Jun 2022 16:23:18 +0000 Received: by outflank-mailman (input) for mailman id 349234; Tue, 14 Jun 2022 16:23:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o19K0-0002Ro-TH for xen-devel@lists.xenproject.org; Tue, 14 Jun 2022 16:23:17 +0000 Received: from esa5.hc3370-68.iphmx.com (esa5.hc3370-68.iphmx.com [216.71.155.168]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 494718f0-ebfe-11ec-a26a-b96bd03d9e80; Tue, 14 Jun 2022 18:23:14 +0200 (CEST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 494718f0-ebfe-11ec-a26a-b96bd03d9e80 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1655223793; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mqw3sdm5n8MfKc9nInueGkXdH2kX+c2NXuRNB6zKpwQ=; b=RV15zRRmlJyy7X/mzQSb0aKqr234k40LJoDsb0b9LXT6auEh9Ancg5I2 LH34BNsZLNwDY52FckHuejK8viSEJp38VqRNzF0F6FpgqlBK0/s+3NQ5B 2lv6FAxreoS/OsaWMnF5Dbvw+iLT94PwY9eUMp+VjMtnEUNowiIzC1BTC I=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none X-SBRS: 5.1 X-MesageID: 72930165 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-Data: A9a23:ZVO51qvvWtMqXutYB+itqpOwXOfnVC9eMUV32f8akzHdYApBsoF/q tZmKW6FaarZMWXxKosibI6x9ElSu8WDnYNjTQJl+3w9RX8S+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQywobVvqYy2YLjW13U5 YuoyyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi8WP63ohdlAWSVASSFAPIZl8bGfeHqw5Jn7I03uKxMAwt1rBUAye4YZ5vx2ESdF8 vlwxDIlN07ZwbjsmfTiF7cq1p9LwMrDZevzvllpyy3ZCvA3B4jOWazQ6fdT3Ssqh9AIFvHbD yYcQWU1PU+YOkMSUrsRIK0Vv6SNjXrQTwwb9GOLrLAZxEWCyyUkhdABN/KKI4fXFK25hH2wv Xna9m70BhUbMt23yjef9H+owOjVkkvTR4Y6BLC+sPlwjzW7xHEXCRAQfUu2p7++kEHWc8JSL QkY9zQjqYA29Ve3VZ/tUhugunmGsxUAHd1KHIUS6guA167V6AaxHXUfQ3hKb9lOiSMtbWV0j BnTxYqvXGEx9u3OIZ6AyluKhQyzOQwIEDIIWTdeTTUEyPrqrtlqjB2aG76PD5WJYs3J9SDYm m7X8XJn2O9N0abnxI3gowmZ3mvESozhC1dsu16JBj/NAhZRPtbNWmC+1bTMAR+sxq69R0LJg nULktP2AAsmXcDUz3zlrAng8diUCxe53N702wcH82EJrWjFxpJaVdk4DMtCDEloKN0YXjTif VXevwhcjLcKYib3NPMqOd3sUZtypUQFKTgCfqG8UzazSsIpKF/vEN9GPiZ8IFwBYGBzyPpia P93gO6nDGoACLQP8Qdas9w1iOdxrghnnDu7bcmik3yPjOvFDFbIGOhtDbd7Rr1ghE9yiF6No 4g32grj40g3bdASlQGMrdZPdQlTdihkbX00wuQOHtO+zsNdMDlJI5fsLXkJIuSJQ4w9ej/0w 0yA IronPort-HdrOrdr: A9a23:nz4McqPIhRz0csBcTsejsMiBIKoaSvp037Eqv3ofdfUzSL3+qy nOpoVj6faaslcssR0b9OxofZPwI080lqQFhbX5X43DYOCOggLBR+tfBMnZsljd8kXFh4hgPM xbHZSWZuedMbEDt7eY3DWF X-IronPort-AV: E=Sophos;i="5.91,300,1647316800"; d="scan'208";a="72930165" From: Anthony PERARD To: CC: Anthony PERARD , Andrew Cooper , George Dunlap , "Jan Beulich" , Julien Grall , "Stefano Stabellini" , Wei Liu Subject: [XEN PATCH v2 4/4] build: replace get-fields.sh by a perl script Date: Tue, 14 Jun 2022 17:22:48 +0100 Message-ID: <20220614162248.40278-5-anthony.perard@citrix.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220614162248.40278-1-anthony.perard@citrix.com> References: <20220614162248.40278-1-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1655223820954100001 Content-Type: text/plain; charset="utf-8" The get-fields.sh which generate all the include/compat/.xlat/*.h headers is quite slow. It takes for example nearly 3 seconds to generate platform.h on a recent machine, or 2.3 seconds for memory.h. Since it's only text processing, rewriting the mix of shell/sed/python into a single perl script make the generation of those file a lot faster. I tried to keep a similar look for the code, to keep the code similar between the shell and perl, and to ease review. So some code in perl might look weird or could be written better. No functional change, the headers generated are identical. Signed-off-by: Anthony PERARD --- Notes: v2: - Add .pl extension to the perl script - remove "-w" from the shebang as it is duplicate of "use warning;" - Add a note in the commit message that the "headers generated are iden= tical". xen/include/Makefile | 6 +- xen/tools/compat-xlat-header.pl | 539 ++++++++++++++++++++++++++++++++ xen/tools/get-fields.sh | 528 ------------------------------- 3 files changed, 541 insertions(+), 532 deletions(-) create mode 100755 xen/tools/compat-xlat-header.pl delete mode 100644 xen/tools/get-fields.sh diff --git a/xen/include/Makefile b/xen/include/Makefile index 0d3e3d66e0..31b0be14bc 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -60,9 +60,7 @@ cmd_compat_c =3D \ =20 quiet_cmd_xlat_headers =3D GEN $@ cmd_xlat_headers =3D \ - while read what name; do \ - $(SHELL) $(srctree)/tools/get-fields.sh "$$what" compat_$$name $< = || exit $$?; \ - done <$(patsubst $(obj)/compat/%,$(obj)/compat/.xlat/%,$(basename $<))= .lst >$@.new; \ + $(PERL) $(srctree)/tools/compat-xlat-header.pl $< $(patsubst $(obj)/co= mpat/%,$(obj)/compat/.xlat/%,$(basename $<)).lst > $@.new; \ mv -f $@.new $@ =20 targets +=3D $(headers-y) @@ -80,7 +78,7 @@ $(obj)/compat/%.c: $(src)/public/%.h $(srcdir)/xlat.lst $= (srctree)/tools/compat- $(call if_changed,compat_c) =20 targets +=3D $(patsubst compat/%, compat/.xlat/%, $(headers-y)) -$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(src= tree)/tools/get-fields.sh FORCE +$(obj)/compat/.xlat/%.h: $(obj)/compat/%.h $(obj)/compat/.xlat/%.lst $(src= tree)/tools/compat-xlat-header.pl FORCE $(call if_changed,xlat_headers) =20 quiet_cmd_xlat_lst =3D GEN $@ diff --git a/xen/tools/compat-xlat-header.pl b/xen/tools/compat-xlat-header= .pl new file mode 100755 index 0000000000..791230591c --- /dev/null +++ b/xen/tools/compat-xlat-header.pl @@ -0,0 +1,539 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +open COMPAT_LIST, "<$ARGV[1]" or die "can't open $ARGV[1], $!"; +open HEADER, "<$ARGV[0]" or die "can't open $ARGV[0], $!"; + +my @typedefs; + +my @header_tokens; +while (
) { + next if m/^\s*#.*/; + s/([\]\[,;:{}])/ $1 /g; + s/^\s+//; + push(@header_tokens, split(/\s+/)); +} + +sub get_fields { + my ($looking_for) =3D @_; + my $level =3D 1; + my $aggr =3D 0; + my ($name, @fields); + + foreach (@header_tokens) { + if (/^(struct|union)$/) { + unless ($level !=3D 1) { + $aggr =3D 1; + @fields =3D (); + $name =3D ''; + } + } elsif ($_ eq '{') { + $level++; + } elsif ($_ eq '}') { + $level--; + if ($level =3D=3D 1 and $name eq $looking_for) { + push (@fields, $_); + return @fields; + } + } elsif (/^[a-zA-Z_].*/) { + unless ($aggr =3D=3D 0 or $name ne "") { + $name =3D $_; + } + } + unless ($aggr =3D=3D 0) { + push (@fields, $_); + } + } + return (); +} + +sub get_typedefs { + my $level =3D 1; + my $state =3D 0; + my @typedefs; + foreach (@_) { + if ($_ eq 'typedef') { + unless ($level !=3D 1) { + $state =3D 1; + } + } elsif (m/^COMPAT_HANDLE\(.*\)$/) { + unless ($level !=3D 1 or $state !=3D 1) { + $state =3D 2; + } + } elsif (m/^[\[\{]$/) { + $level++; + } elsif (m/^[\]\}]$/) { + $level--; + } elsif ($_ eq ';') { + unless ($level !=3D 1) { + $state =3D 0; + } + } elsif (m/^[a-zA-Z_].*$/) { + unless ($level !=3D 1 or $state !=3D 2) { + push (@typedefs, $_); + } + } + } + return @typedefs; +} + +sub build_enums { + my ($name, @tokens) =3D @_; + + my $level =3D 1; + my $kind =3D ''; + my $named =3D ''; + my (@fields, @members, $id); + + foreach (@tokens) { + if (m/^(struct|union)$/) { + unless ($level !=3D 2) { + @fields =3D (''); + } + $kind=3D"$_;$kind"; + } elsif ($_ eq '{') { + $level++; + } elsif ($_ eq '}') { + $level--; + if ($level =3D=3D 1) { + my $subkind =3D $kind; + $subkind =3D~ s/;.*//; + if ($subkind eq 'union') { + print "\nenum XLAT_$name {\n"; + foreach (@members) { + print " XLAT_${name}_$_,\n"; + } + print "};\n"; + } + return; + } elsif ($level =3D=3D 2) { + $named =3D '?'; + } + } elsif (/^[a-zA-Z_].*$/) { + $id =3D $_; + my $k =3D $kind; + $k =3D~ s/.*?;//; + if ($named ne '' and $k ne '') { + shift @fields if @fields > 0 and $fields[0] eq ''; + build_enums("${name}_$_", @fields); + $named =3D '!'; + } + } elsif ($_ eq ',') { + unless ($level !=3D 2) { + push (@members, $id); + } + } elsif ($_ eq ';') { + unless ($level !=3D 2) { + push (@members, $id); + } + unless ($named eq '') { + $kind =3D~ s/.*?;//; + } + $named =3D ''; + } + unless (@fields =3D=3D 0) { + push (@fields, $_); + } + } +} + +sub handle_field { + my ($prefix, $name, $id, $type, @fields) =3D @_; + + if (@fields =3D=3D 0) { + print " \\\n"; + if ($type eq '') { + print "$prefix\(_d_)->$id =3D (_s_)->$id;" + } else { + my $k =3D $id; + $k =3D~ s/\./_/g; + print "${prefix}XLAT_${name}_HNDL_${k}(_d_, _s_);"; + } + } elsif ("@fields" !~ m/[{}]/) { + my $tag =3D "@fields"; + $tag =3D~ s/\s*(struct|union)\s+(compat_)?(\w+)\s.*/$3/; + print " \\\n"; + print "${prefix}XLAT_$tag(&(_d_)->$id, &(_s_)->$id);" + } else { + my $func_id =3D $id; + my @func_tokens =3D @fields; + my $kind =3D ''; + my $array =3D ""; + my $level =3D 1; + my $arrlvl =3D 1; + my $array_type =3D ''; + my $id =3D ''; + my $type =3D ''; + @fields =3D (); + foreach (@func_tokens) { + if (/^(struct|union)$/) { + unless ($level !=3D 2) { + @fields =3D (''); + } + if ($level =3D=3D 1) { + $kind =3D $_; + if ($kind eq 'union') { + my $tmp =3D $func_id; + $tmp =3D~ s/\./_/g; + print " \\\n"; + print "${prefix}switch ($tmp) {" + } + } + } elsif ($_ eq '{') { + $level++; + $id =3D ''; + } elsif ($_ eq '}') { + $level--; + $id =3D ''; + if ($level =3D=3D 1 and $kind eq 'union') { + print " \\\n"; + print "$prefix}" + } + } elsif ($_ eq '[') { + if ($level !=3D 2 or $arrlvl !=3D 1) { + # skip + } elsif ($array eq '') { + $array =3D ' '; + } else { + $array =3D "$array;"; + } + $arrlvl++; + } elsif ($_ eq ']') { + $arrlvl--; + } elsif (m/^COMPAT_HANDLE\((.*)\)$/) { + if ($level =3D=3D 2 and $id eq '') { + $type =3D $1; + $type =3D~ s/^compat_//; + } + } elsif ($_ eq "compat_domain_handle_t") { + if ($level =3D=3D 2 and $id eq '') { + $array_type =3D $_; + } + } elsif (m/^[a-zA-Z_].*$/) { + if ($id eq '' and $type eq '' and $array_type eq '') { + foreach $id (@typedefs) { + unless ($id ne $_) { + $type =3D $id; + } + } + if ($type eq '') { + $id =3D $_; + } else { + $id =3D ''; + } + } else { + $id =3D $_; + } + } elsif (m/^[,;]$/) { + if ($level =3D=3D 2 and $id !~ /^_pad\d*$/) { + if ($kind eq 'union') { + my $tmp =3D "$func_id.$id"; + $tmp =3D~ s/\./_/g; + print " \\\n"; + print "${prefix}case XLAT_${name}_$tmp:"; + shift @fields if @fields > 0 and $fields[0] eq ''; + handle_field("$prefix ", $name, "$func_id.$id"= , $type, @fields); + } elsif ($array eq '' and $array_type eq '') { + shift @fields if @fields > 0 and $fields[0] eq ''; + handle_field($prefix, $name, "$func_id.$id", $type= , @fields); + } elsif ($array eq '') { + copy_array(" ", "$func_id.$id"); + } else { + $array =3D~ s/^.*?;//; + shift @fields if @fields > 0 and $fields[0] eq ''; + handle_array($prefix, $name, "$func_id.$id", $arra= y, $type, @fields); + } + unless ($_ ne ';') { + @fields =3D (); + $id =3D ''; + $type =3D ''; + } + $array =3D ''; + if ($kind eq 'union') { + print " \\\n"; + print "$prefix break;"; + } + } + } else { + if ($array ne '') { + $array =3D "$array $_"; + } + } + unless (@fields =3D=3D 0) { + push (@fields, $_); + } + } + } +} + +sub copy_array { + my ($prefix, $id) =3D @_; + + print " \\\n"; + print "${prefix}if ((_d_)->$id !=3D (_s_)->$id) \\\n"; + print "$prefix memcpy((_d_)->$id, (_s_)->$id, sizeof((_d_)->$id));= "; +} + +sub handle_array { + my ($prefix, $name, $id, $array, $type, @fields) =3D @_; + + my $i =3D $array; + $i =3D~ s/[^;]//g; + $i =3D length($i); + $i =3D "i$i"; + + print " \\\n"; + print "$prefix\{ \\\n"; + print "$prefix unsigned int $i; \\\n"; + my $tmp =3D $array; + $tmp =3D~ s/;.*$//; + $tmp =3D~ s/^\s*(.*)\s*$/$1/; + print "$prefix for ($i =3D 0; $i < $tmp; ++$i) {"; + if ($array !~ m/^.*?;/) { + handle_field("$prefix ", $name, "$id\[$i]", $type, @fields); + } else { + handle_array("$prefix " ,$name, "$id\[$i]", $', $type, @fie= lds); + } + print " \\\n"; + print "$prefix } \\\n"; + print "$prefix\}"; +} + +sub build_body { + my ($name, @tokens) =3D @_; + my $level =3D 1; + my $id =3D ''; + my $array =3D ''; + my $arrlvl =3D 1; + my $array_type =3D ''; + my $type =3D ''; + my @fields; + + printf "\n#define XLAT_$name(_d_, _s_) do {"; + + foreach (@tokens) { + if (/^(struct|union)$/) { + unless ($level !=3D 2) { + @fields =3D (''); + } + } elsif ($_ eq '{') { + $level++; + $id =3D ''; + } elsif ($_ eq '}') { + $level--; + $id =3D ''; + } elsif ($_ eq '[') { + if ($level !=3D 2 or $arrlvl !=3D 1) { + # skip + } elsif ($array eq '') { + $array =3D ' '; + } else { + $array =3D "$array;"; + } + $arrlvl++; + } elsif ($_ eq ']') { + $arrlvl--; + } elsif (m/^COMPAT_HANDLE\((.*)\)$/) { + if ($level =3D=3D 2 and $id eq '') { + $type =3D $1; + $type =3D~ s/^compat_//; + } + } elsif ($_ eq "compat_domain_handle_t") { + if ($level =3D=3D 2 and $id eq '') { + $array_type =3D $_; + } + } elsif (m/^[a-zA-Z_].*$/) { + if ($array ne '') { + $array =3D "$array $_"; + } elsif ($id eq '' and $type eq '' and $array_type eq '') { + foreach $id (@typedefs) { + unless ($id eq $_) { + $type =3D $id; + } + } + if ($type eq '') { + $id =3D $_; + } else { + $id =3D ''; + } + } else { + $id =3D $_; + } + } elsif (m/^[,;]$/) { + if ($level =3D=3D 2 and $id !~ /^_pad\d*$/) { + if ($array eq '' and $array_type eq '') { + shift @fields if @fields > 0 and $fields[0] eq ''; + handle_field(" ", $name, $id, $type, @fields); + } elsif ($array eq '') { + copy_array(" ", $id); + } else { + my $tmp =3D $array; + $tmp =3D~ s/^.*?;//; + shift @fields if @fields > 0 and $fields[0] eq ''; + handle_array(" ", $name, $id, $tmp, $type, @fields); + } + unless ($_ ne ';') { + @fields =3D (); + $id =3D ''; + $type =3D ''; + } + $array =3D ''; + } + } else { + if ($array ne '') { + $array =3D "$array $_"; + } + } + unless (@fields =3D=3D 0) { + push (@fields, $_); + } + } + print " \\\n} while (0)\n"; +} + +sub check_field { + my ($kind, $name, $field, @extrafields) =3D @_; + + if ("@extrafields" !~ m/[{}]/) { + print "; \\\n"; + if (@extrafields !=3D 0) { + foreach (@extrafields) { + if (m/^(struct|union)$/) { + # skip + } elsif (m/^[a-zA-Z_].*/) { + s/^xen_//; + print " CHECK_$_"; + last; + } else { + die "Malformed compound declaration: '$_'"; + } + } + } elsif ($field !~ m/\./) { + print " CHECK_FIELD_($kind, $name, $field)"; + } else { + my $n =3D $field =3D~ s/\./, /g; + print " CHECK_SUBFIELD_${n}_($kind, $name, $field)"; + } + } else { + my $level =3D 1; + my @fields =3D (); + my $id =3D ''; + + foreach (@extrafields) { + if (m/^(struct|union)$/) { + unless ($level !=3D 2) { + @fields =3D (''); + } + } elsif ($_ eq '{') { + $level++; + $id =3D ''; + } elsif ($_ eq '}') { + $level--; + $id =3D ''; + } elsif (/^compat_.*_t$/) { + if ($level =3D=3D 2) { + @fields =3D (''); + s/_t$//; + s/^compat_//; + } + } elsif (/^evtchn_.*_compat_t$/) { + if ($level =3D=3D 2 and $_ ne "evtchn_port_compat_t") { + @fields =3D (''); + s/_compat_t$//; + } + } elsif (/^[a-zA-Z_].*$/) { + $id =3D $_; + } elsif (/^[,;]$/) { + if ($level =3D=3D 2 and $id !~ /^_pad\d*$/) { + shift @fields if @fields > 0 and $fields[0] eq ''; + check_field($kind, $name, "$field.$id", @fields); + unless ($_ ne ";") { + @fields =3D (); + $id =3D ''; + } + } + } + unless (@fields =3D=3D 0) { + push (@fields, $_); + } + } + } +} + +sub build_check { + my ($name, @tokens) =3D @_; + my $level =3D 1; + my (@fields, $kind, $id); + my $arrlvl =3D 1; + + print "\n"; + print "#define CHECK_$name \\\n"; + + foreach (@tokens) { + if (/^(struct|union)$/) { + if ($level =3D=3D 1) { + $kind =3D $_; + print " CHECK_SIZE_($kind, $name)"; + } elsif ($level =3D=3D 2) { + @fields =3D (''); + } + } elsif ($_ eq '{') { + $level++; + $id =3D ''; + } elsif ($_ eq '}') { + $level--; + $id =3D ''; + } elsif ($_ eq '[') { + $arrlvl++; + } elsif ($_ eq ']') { + $arrlvl--; + } elsif (/^compat_.*_t$/) { + if ($level =3D=3D 2 and $_ ne "compat_argo_port_t") { + @fields =3D (''); + s/_t$//; + s/^compat_//; + } + } elsif (/^[a-zA-Z_].*$/) { + unless ($level !=3D 2 or $arrlvl !=3D 1) { + $id =3D $_; + } + } elsif (/^[,;]$/) { + if ($level =3D=3D 2 and $id !~ /^_pad\d*$/) { + shift @fields if @fields > 0 and $fields[0] eq ''; + check_field($kind, $name, $id, @fields); + unless ($_ ne ";") { + @fields =3D (); + $id =3D ''; + } + } + } + + unless (@fields =3D=3D 0) { + push (@fields, $_); + } + } + print "\n"; +} + +@typedefs =3D get_typedefs(@header_tokens); + +while () { + my ($what, $name) =3D split(/\s+/, $_); + $name =3D~ s/^xen//; + + my @fields =3D get_fields("compat_$name"); + if (@fields =3D=3D 0) { + die "Fields of 'compat_$name' not found in '$ARGV[1]'"; + } + + if ($what eq "!") { + build_enums($name, @fields); + build_body($name, @fields); + } elsif ($what eq "?") { + build_check($name, @fields); + } else { + die "Invalid translation indicator: '$what'"; + } +} diff --git a/xen/tools/get-fields.sh b/xen/tools/get-fields.sh deleted file mode 100644 index 002db2093f..0000000000 --- a/xen/tools/get-fields.sh +++ /dev/null @@ -1,528 +0,0 @@ -test -n "$1" -a -n "$2" -a -n "$3" -set -ef - -SED=3Dsed -if test -x /usr/xpg4/bin/sed; then - SED=3D/usr/xpg4/bin/sed -fi -if test -z ${PYTHON}; then - PYTHON=3D`/usr/bin/env python` -fi -if test -z ${PYTHON}; then - echo "Python not found" - exit 1 -fi - -get_fields () -{ - local level=3D1 aggr=3D0 name=3D fields=3D - for token in $2 - do - case "$token" in - struct|union) - test $level !=3D 1 || aggr=3D1 fields=3D name=3D - ;; - "{") - level=3D$(expr $level + 1) - ;; - "}") - level=3D$(expr $level - 1) - if [ $level =3D 1 -a $name =3D $1 ] - then - echo "$fields }" - return 0 - fi - ;; - [a-zA-Z_]*) - test $aggr =3D 0 -o -n "$name" || name=3D"$token" - ;; - esac - test $aggr =3D 0 || fields=3D"$fields $token" - done -} - -get_typedefs () -{ - local level=3D1 state=3D - for token in $1 - do - case "$token" in - typedef) - test $level !=3D 1 || state=3D1 - ;; - COMPAT_HANDLE\(*\)) - test $level !=3D 1 -o "$state" !=3D 1 || state=3D2 - ;; - [\{\[]) - level=3D$(expr $level + 1) - ;; - [\}\]]) - level=3D$(expr $level - 1) - ;; - ";") - test $level !=3D 1 || state=3D - ;; - [a-zA-Z_]*) - test $level !=3D 1 -o "$state" !=3D 2 || echo "$token" - ;; - esac - done -} - -build_enums () -{ - local level=3D1 kind=3D fields=3D members=3D named=3D id=3D token - for token in $2 - do - case "$token" in - struct|union) - test $level !=3D 2 || fields=3D" " - kind=3D"$token;$kind" - ;; - "{") - level=3D$(expr $level + 1) - ;; - "}") - level=3D$(expr $level - 1) - if [ $level =3D 1 ] - then - if [ "${kind%%;*}" =3D union ] - then - echo - echo "enum XLAT_$1 {" - for m in $members - do - echo " XLAT_${1}_$m," - done - echo "};" - fi - return 0 - elif [ $level =3D 2 ] - then - named=3D'?' - fi - ;; - [a-zA-Z]*) - id=3D$token - if [ -n "$named" -a -n "${kind#*;}" ] - then - build_enums ${1}_$token "$fields" - named=3D'!' - fi - ;; - ",") - test $level !=3D 2 || members=3D"$members $id" - ;; - ";") - test $level !=3D 2 || members=3D"$members $id" - test -z "$named" || kind=3D${kind#*;} - named=3D - ;; - esac - test -z "$fields" || fields=3D"$fields $token" - done -} - -handle_field () -{ - if [ -z "$5" ] - then - echo " \\" - if [ -z "$4" ] - then - printf %s "$1(_d_)->$3 =3D (_s_)->$3;" - else - printf %s "$1XLAT_${2}_HNDL_$(echo $3 | $SED 's,\.,_,g')(_d_, _s_);" - fi - elif [ -z "$(echo "$5" | $SED 's,[^{}],,g')" ] - then - local tag=3D$(echo "$5" | ${PYTHON} -c ' -import re,sys -for line in sys.stdin.readlines(): - sys.stdout.write(re.subn(r"\s*(struct|union)\s+(compat_)?(\w+)\s.*", r= "\3", line)[0].rstrip() + "\n") -') - echo " \\" - printf %s "${1}XLAT_$tag(&(_d_)->$3, &(_s_)->$3);" - else - local level=3D1 kind=3D fields=3D id=3D array=3D arrlvl=3D1 array_type= =3D type=3D token - for token in $5 - do - case "$token" in - struct|union) - test $level !=3D 2 || fields=3D" " - if [ $level =3D 1 ] - then - kind=3D$token - if [ $kind =3D union ] - then - echo " \\" - printf %s "${1}switch ($(echo $3 | $SED 's,\.,_,g')) {" - fi - fi - ;; - "{") - level=3D$(expr $level + 1) id=3D - ;; - "}") - level=3D$(expr $level - 1) id=3D - if [ $level =3D 1 -a $kind =3D union ] - then - echo " \\" - printf %s "$1}" - fi - ;; - "[") - if [ $level !=3D 2 -o $arrlvl !=3D 1 ] - then - : - elif [ -z "$array" ] - then - array=3D" " - else - array=3D"$array;" - fi - arrlvl=3D$(expr $arrlvl + 1) - ;; - "]") - arrlvl=3D$(expr $arrlvl - 1) - ;; - COMPAT_HANDLE\(*\)) - if [ $level =3D 2 -a -z "$id" ] - then - type=3D${token#COMPAT_HANDLE?} - type=3D${type%?} - type=3D${type#compat_} - fi - ;; - compat_domain_handle_t) - if [ $level =3D 2 -a -z "$id" ] - then - array_type=3D$token - fi - ;; - [a-zA-Z]*) - if [ -z "$id" -a -z "$type" -a -z "$array_type" ] - then - for id in $typedefs - do - test $id !=3D "$token" || type=3D$id - done - if [ -z "$type" ] - then - id=3D$token - else - id=3D - fi - else - id=3D$token - fi - ;; - [\,\;]) - if [ $level =3D 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] - then - if [ $kind =3D union ] - then - echo " \\" - printf %s "${1}case XLAT_${2}_$(echo $3.$id | $SED 's,\.,_,g'):" - handle_field "$1 " $2 $3.$id "$type" "$fields" - elif [ -z "$array" -a -z "$array_type" ] - then - handle_field "$1" $2 $3.$id "$type" "$fields" - elif [ -z "$array" ] - then - copy_array " " $3.$id - else - handle_array "$1" $2 $3.$id "${array#*;}" "$type" "$fields" - fi - test "$token" !=3D ";" || fields=3D id=3D type=3D - array=3D - if [ $kind =3D union ] - then - echo " \\" - printf %s "$1 break;" - fi - fi - ;; - *) - if [ -n "$array" ] - then - array=3D"$array $token" - fi - ;; - esac - test -z "$fields" || fields=3D"$fields $token" - done - fi -} - -copy_array () -{ - echo " \\" - echo "${1}if ((_d_)->$2 !=3D (_s_)->$2) \\" - printf %s "$1 memcpy((_d_)->$2, (_s_)->$2, sizeof((_d_)->$2));" -} - -handle_array () -{ - local i=3D"i$(echo $4 | $SED 's,[^;], ,g' | wc -w | $SED 's,[[:space:]]*,= ,g')" - echo " \\" - echo "$1{ \\" - echo "$1 unsigned int $i; \\" - printf %s "$1 for ($i =3D 0; $i < "${4%%;*}"; ++$i) {" - if [ "$4" =3D "${4#*;}" ] - then - handle_field "$1 " $2 $3[$i] "$5" "$6" - else - handle_array "$1 " $2 $3[$i] "${4#*;}" "$5" "$6" - fi - echo " \\" - echo "$1 } \\" - printf %s "$1}" -} - -build_body () -{ - echo - printf %s "#define XLAT_$1(_d_, _s_) do {" - local level=3D1 fields=3D id=3D array=3D arrlvl=3D1 array_type=3D type=3D= token - for token in $2 - do - case "$token" in - struct|union) - test $level !=3D 2 || fields=3D" " - ;; - "{") - level=3D$(expr $level + 1) id=3D - ;; - "}") - level=3D$(expr $level - 1) id=3D - ;; - "[") - if [ $level !=3D 2 -o $arrlvl !=3D 1 ] - then - : - elif [ -z "$array" ] - then - array=3D" " - else - array=3D"$array;" - fi - arrlvl=3D$(expr $arrlvl + 1) - ;; - "]") - arrlvl=3D$(expr $arrlvl - 1) - ;; - COMPAT_HANDLE\(*\)) - if [ $level =3D 2 -a -z "$id" ] - then - type=3D${token#COMPAT_HANDLE?} - type=3D${type%?} - type=3D${type#compat_} - fi - ;; - compat_domain_handle_t) - if [ $level =3D 2 -a -z "$id" ] - then - array_type=3D$token - fi - ;; - [a-zA-Z_]*) - if [ -n "$array" ] - then - array=3D"$array $token" - elif [ -z "$id" -a -z "$type" -a -z "$array_type" ] - then - for id in $typedefs - do - test $id !=3D "$token" || type=3D$id - done - if [ -z "$type" ] - then - id=3D$token - else - id=3D - fi - else - id=3D$token - fi - ;; - [\,\;]) - if [ $level =3D 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] - then - if [ -z "$array" -a -z "$array_type" ] - then - handle_field " " $1 $id "$type" "$fields" - elif [ -z "$array" ] - then - copy_array " " $id - else - handle_array " " $1 $id "${array#*;}" "$type" "$fields" - fi - test "$token" !=3D ";" || fields=3D id=3D type=3D - array=3D - fi - ;; - *) - if [ -n "$array" ] - then - array=3D"$array $token" - fi - ;; - esac - test -z "$fields" || fields=3D"$fields $token" - done - echo " \\" - echo "} while (0)" -} - -check_field () -{ - if [ -z "$(echo "$4" | $SED 's,[^{}],,g')" ] - then - echo "; \\" - local n=3D$(echo $3 | $SED 's,[^.], ,g' | wc -w | $SED 's,[[:space:]]*,,= g') - if [ -n "$4" ] - then - for n in $4 - do - case $n in - struct|union) - ;; - [a-zA-Z_]*) - printf %s " CHECK_${n#xen_}" - break - ;; - *) - echo "Malformed compound declaration: '$n'" >&2 - exit 1 - ;; - esac - done - elif [ $n =3D 0 ] - then - printf %s " CHECK_FIELD_($1, $2, $3)" - else - printf %s " CHECK_SUBFIELD_${n}_($1, $2, $(echo $3 | $SED 's!\.!, !g= '))" - fi - else - local level=3D1 fields=3D id=3D token - for token in $4 - do - case "$token" in - struct|union) - test $level !=3D 2 || fields=3D" " - ;; - "{") - level=3D$(expr $level + 1) id=3D - ;; - "}") - level=3D$(expr $level - 1) id=3D - ;; - compat_*_t) - if [ $level =3D 2 ] - then - fields=3D" " - token=3D"${token%_t}" - token=3D"${token#compat_}" - fi - ;; - evtchn_*_compat_t) - if [ $level =3D 2 -a $token !=3D evtchn_port_compat_t ] - then - fields=3D" " - token=3D"${token%_compat_t}" - fi - ;; - [a-zA-Z]*) - id=3D$token - ;; - [\,\;]) - if [ $level =3D 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] - then - check_field $1 $2 $3.$id "$fields" - test "$token" !=3D ";" || fields=3D id=3D - fi - ;; - esac - test -z "$fields" || fields=3D"$fields $token" - done - fi -} - -build_check () -{ - echo - echo "#define CHECK_$1 \\" - local level=3D1 fields=3D kind=3D id=3D arrlvl=3D1 token - for token in $2 - do - case "$token" in - struct|union) - if [ $level =3D 1 ] - then - kind=3D$token - printf %s " CHECK_SIZE_($kind, $1)" - elif [ $level =3D 2 ] - then - fields=3D" " - fi - ;; - "{") - level=3D$(expr $level + 1) id=3D - ;; - "}") - level=3D$(expr $level - 1) id=3D - ;; - "[") - arrlvl=3D$(expr $arrlvl + 1) - ;; - "]") - arrlvl=3D$(expr $arrlvl - 1) - ;; - compat_*_t) - if [ $level =3D 2 -a $token !=3D compat_argo_port_t ] - then - fields=3D" " - token=3D"${token%_t}" - token=3D"${token#compat_}" - fi - ;; - [a-zA-Z_]*) - test $level !=3D 2 -o $arrlvl !=3D 1 || id=3D$token - ;; - [\,\;]) - if [ $level =3D 2 -a -n "$(echo $id | $SED 's,^_pad[[:digit:]]*,,')" ] - then - check_field $kind $1 $id "$fields" - test "$token" !=3D ";" || fields=3D id=3D - fi - ;; - esac - test -z "$fields" || fields=3D"$fields $token" - done - echo "" -} - -list=3D"$($SED -e 's,^[[:space:]]#.*,,' -e 's!\([]\[,;:{}]\)! \1 !g' $3)" -fields=3D"$(get_fields $(echo $2 | $SED 's,^compat_xen,compat_,') "$list")" -if [ -z "$fields" ] -then - echo "Fields of '$2' not found in '$3'" >&2 - exit 1 -fi -name=3D${2#compat_} -name=3D${name#xen} -case "$1" in -"!") - typedefs=3D"$(get_typedefs "$list")" - build_enums $name "$fields" - build_body $name "$fields" - ;; -"?") - build_check $name "$fields" - ;; -*) - echo "Invalid translation indicator: '$1'" >&2 - exit 1 - ;; -esac --=20 Anthony PERARD