From patchwork Tue Aug 24 10:49:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 12454659 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=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 75BA0C4338F for ; Tue, 24 Aug 2021 10:51:25 +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 4052D61163 for ; Tue, 24 Aug 2021 10:51:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4052D61163 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.170902.311954 (Exim 4.92) (envelope-from ) id 1mIU1U-0003aa-HB; Tue, 24 Aug 2021 10:51:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 170902.311954; Tue, 24 Aug 2021 10:51:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIU1U-0003aO-Bk; Tue, 24 Aug 2021 10:51:16 +0000 Received: by outflank-mailman (input) for mailman id 170902; Tue, 24 Aug 2021 10:51:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mIU1T-0001EC-8L for xen-devel@lists.xenproject.org; Tue, 24 Aug 2021 10:51:15 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a7d11996-2282-4cd7-9e1f-89089d3a8aef; Tue, 24 Aug 2021 10:50:57 +0000 (UTC) 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: a7d11996-2282-4cd7-9e1f-89089d3a8aef DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1629802257; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Co6H7lVgiBUcy/feyke8bR5ma3P4dUmv5ksGl3mwp9c=; b=RyECNtla7WtKLhP5VrS8g/QrmUQJMJolbUA1qa5P6/f491WdC9XijfJP mpPQre//fSm6xIB0DjId1zlqVhjjZMt0kYZ+j+UXUeNiyJ+zfMrJ+m+LU rZFZnIkkn3D0GTnY88jBQr8DgAXmFbAHvBJZZeU1BLyJvANXOS0arcsaC o=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 3p1CextGzq0q9aOS4LAZ0UORCqraVkDsfc8ZpkLWAm/jshJ1BrfugFW/tAN4978p8Zbeh0HTYH +o6E6ZTkmAY19T3sZccjzvO9k2K8N3Sd1HOW2bm328Bu2iJJWN/SkHpIuWLub6TXJ/l9i7WHVA i6e/qN2PRifvasRCLCqBBkTUvi15uhJocjwq++34kURssTIAI3gPcIDbMHzui08WDLoFqL/E9e 9vIFOhVtWDy332c4aKbix3jMJcSO+0w5uwMgEiirF/Joqi8R+rcCYHetqbaRnxLn6mk422Ub/i DNXXlDvNm3di2srvJsL160cj X-SBRS: 5.1 X-MesageID: 52875430 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED IronPort-HdrOrdr: A9a23:/dW1DqGBbYKpD/ZypLqFVJHXdLJyesId70hD6qkvc3Fom52j/f xGws5x6fatskd2ZJkh8erhBEDyewKkyXcV2/hbAV7MZniDhILFFu9fBOjZsnfd8k/Fh4lgPM 5bGsATZ+EYZmIK7voSlTPIdurIt+P3kpxA692+815dCSVRL41w5QZwDQiWVmdsQhNdOJY/HJ 2AouJaujuJYx0sH4iGL0hAe9KGi8zAlZrgbxJDLQUg8hOygTSh76O/OwSE3y0ZTyhEzd4ZgC f4ek3Cl+ueWsOAu1/hPlzontdrcRzau5l+7fm3+4kow/PX+0OVjcpaKvm/VXsO0ZmSAR4R4a LxSlEbTolOAjrqDxuIiAqo1A/63Dk07Xj+jVeenHv4uMT8ACk3EsxbmOtiA23kAmcbzaVBOZ hwrhWkXltsfGL9tTW448KNWwBhl0Kyr3ZnmekPj2ZHWY9bbLNKt4QQ8E5cDZ9FRUvBmcgaOf grCNuZ6OddcFucYXyctm5zwMa0VnB2GhudWEANtsGczjATlnFkyEkTwtAZgx47hdsAYogB4/ 6BPrVjlblIQMNTZaVhBP0ZSc/yEWDJSQKkChPmHb0mLtB0B5vpke+I3FwY3pDXRHU49upApH 2aaiIkiYcbQTOQNeSemIZM7g3ABH6gWDiF8LAv26RE X-IronPort-AV: E=Sophos;i="5.84,347,1620705600"; d="scan'208";a="52875430" From: Anthony PERARD To: CC: Anthony PERARD , Jan Beulich , Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu Subject: [XEN PATCH v7 06/51] build,include: rework compat-build-source.py Date: Tue, 24 Aug 2021 11:49:53 +0100 Message-ID: <20210824105038.1257926-7-anthony.perard@citrix.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210824105038.1257926-1-anthony.perard@citrix.com> References: <20210824105038.1257926-1-anthony.perard@citrix.com> MIME-Version: 1.0 Improvement are: - give the path to xlat.lst as argument - include `grep -v` in compat-build-source.py script, we don't need to write this in several scripted language. No changes in final compat/%.h headers. Signed-off-by: Anthony PERARD Acked-by: Jan Beulich --- Notes: v7: - actually keep the dependency on Makefile v6: - remove dependency on Makefile as it's not needed anymore v5: - removed "have 'xlat.lst' path as a variable" from the patch. v4: - new patch xen/include/Makefile | 3 +-- xen/tools/compat-build-source.py | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/xen/include/Makefile b/xen/include/Makefile index c8ca97eed0fc..4fa10e68f997 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -61,8 +61,7 @@ compat/%.i: compat/%.c Makefile compat/%.c: public/%.h xlat.lst Makefile $(BASEDIR)/tools/compat-build-source.py mkdir -p $(@D) - grep -v 'DEFINE_XEN_GUEST_HANDLE(long)' $< | \ - $(PYTHON) $(BASEDIR)/tools/compat-build-source.py >$@.new + $(PYTHON) $(BASEDIR)/tools/compat-build-source.py xlat.lst <$< >$@.new mv -f $@.new $@ compat/.xlat/%.h: compat/%.h compat/.xlat/%.lst $(BASEDIR)/tools/get-fields.sh Makefile diff --git a/xen/tools/compat-build-source.py b/xen/tools/compat-build-source.py index 2bcaf27d05a3..274d6917ab7f 100755 --- a/xen/tools/compat-build-source.py +++ b/xen/tools/compat-build-source.py @@ -13,7 +13,11 @@ pats = [ [ r"XEN_GUEST_HANDLE", r"COMPAT_HANDLE" ], ]; -xlatf = open('xlat.lst', 'r') +try: + xlatf = open(sys.argv[1], 'r') +except IndexError: + print('missing path to xlat.lst argument') + sys.exit(1) for line in xlatf.readlines(): match = re.subn(r"^\s*\?\s+(\w*)\s.*", r"\1", line.rstrip()) if match[1]: @@ -25,6 +29,8 @@ for pat in pats: pat[0] = re.compile(pat[0]) for line in sys.stdin.readlines(): + if 'DEFINE_XEN_GUEST_HANDLE(long)' in line: + continue for pat in pats: line = re.sub(pat[0], pat[1], line) print(line.rstrip())