From nobody Tue Apr 30 12:17:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1573503963; cv=none; d=zoho.com; s=zohoarc; b=k7b7djpSYV9OuxP3SkSac/aWHh+K3XaJ8qBUoS42t6Vr+Ol7va82flReREyp3ZBhlE+1FDtaTWBOwwoCfqv2HgXJgVvjNoq9stbtJ0NEJWPgywgJnkhDnEqJo+EI//VMdUzoH2yWgPZzlqBKRODXtFciNzMBTvcRyBodJ93lBo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573503963; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ABHd+nFJStzhaeQp9VN+4ZliUdkswfjfjQA+6Pe5tRU=; b=Z6DasfL4YfqnHtY+kLSLfuK3/pm+LMHu1g/1cA18gDyuFX6IcdQK2AHdcmgnM7f8+wRDpB0J2q5w/9IQPk5KbLBktRM2y44BAUiI98ihvCHQHqY6923uOBHoxKarkj8Ak9ppfGkvqsCVn0cvgNstLDxQ6knSgHC/zvMtn0lHYy4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 157350396357541.931515730832075; Mon, 11 Nov 2019 12:26:03 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iUGF1-0006h6-4Q; Mon, 11 Nov 2019 20:24:51 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iUGEz-0006h1-Jh for xen-devel@lists.xenproject.org; Mon, 11 Nov 2019 20:24:49 +0000 Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 4e283be2-04c1-11ea-9631-bc764e2007e4; Mon, 11 Nov 2019 20:24:47 +0000 (UTC) X-Inumbo-ID: 4e283be2-04c1-11ea-9631-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1573503887; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GiRo91B4upyh/LNspnqI+3PKUM/0RHn54N6o45OVxho=; b=M9PLn3jWtma3mFnh/Y7xD9CRpkmy5K5LlOOvXWFnIoDa9u1FVg5aSct8 QAcGezJoYinPXIgu2LvYgffsuvNIcbf0CXs5qVjR+We8ziw8J6i+XbmNw r5aChIMtrjwwMkfYy6274jlGyg7HgjX9LWNK+foTnpLyZT65TFqsRazJ9 A=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: QES2uoSkcia+RomJ/eGaly24jSpTolFyUkzANFWLwmh0VZ1juqMOvmJwxkFy9Yr7FbbzZ4qujG Q2ds/d36Bdt9aKWQ1MZ+RVVYIE8RB1FOGeMd87gH22Tn67xDY3sMuPvqz2/zj2N5IgWs3NxKbO G4ZnBD33sIfZmtRST9AVC6aV04eHOTscxr2fEG8L4X0oWOzcosCb0Rk+fw6Y/slHdPG14q4QWY 5X9Dc3Tc1bs3nVspMWEgIKE7gsFJDimm4mVWzysDmQ/fdohY6S1xKtu155lBaF4YGq7AgPtX2l U+I= X-SBRS: 2.7 X-MesageID: 8511421 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,293,1569297600"; d="scan'208";a="8511421" From: Andrew Cooper To: Xen-devel Date: Mon, 11 Nov 2019 20:24:43 +0000 Message-ID: <20191111202443.7154-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH for-4.13] xen: Drop bogus BOOLEAN definitions, TRUE and FALSE X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Julien Grall , Wei Liu , Andrew Cooper , Jan Beulich , Volodymyr Babchuk , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) actypes.h and efidef.h both define BOOLEAN as unsigned char, which is buggy= in combination with logic such as "BOOLEAN b =3D (a & 0x100);" Redefine BOOLE= AN as bool instead, which doesn't truncate. Both also define TRUE and FALSE, with actypes.h being extra rude and replac= ing whatever exists thus far. Drop all uses of TRUE and FALSE, replacing them with true/false respectively, and drop the declarations. Also drop the pointless conditional declaration of NULL while cleaning this up. Finally, correct all the comments which which were found by sed. Signed-off-by: Andrew Cooper Acked-by: Stefano Stabellini Reviewed-by: Wei Liu Tested-by: Stefano Stabellini --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Juergen Gross This is based on top of Rogers patch adjusting part of io_apic.c Compile tested on ARM, fully texted on x86. RFC for 4.13 - I thought I'd got all of the boolean truncation bugs back in 4.8 but clearly not... --- xen/arch/x86/io_apic.c | 12 ++++++------ xen/arch/x86/x86_64/mm.c | 2 +- xen/common/kexec.c | 6 +++--- xen/common/timer.c | 4 ++-- xen/drivers/acpi/tables/tbfadt.c | 4 ++-- xen/drivers/passthrough/vtd/utils.c | 2 +- xen/include/acpi/acconfig.h | 2 +- xen/include/acpi/actypes.h | 20 ++------------------ xen/include/asm-arm/arm64/efibind.h | 2 +- xen/include/asm-arm/regs.h | 2 +- xen/include/asm-x86/regs.h | 2 +- xen/include/asm-x86/x86_64/efibind.h | 2 +- xen/include/efi/efidef.h | 11 +---------- xen/include/xen/mm.h | 2 +- xen/include/xen/sched.h | 2 +- 15 files changed, 25 insertions(+), 50 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 732b57995c..6517eb5ae9 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -285,7 +285,7 @@ static void __io_apic_eoi(unsigned int apic, unsigned i= nt vector, unsigned int p { /* If vector is unknown, read it from the IO-APIC */ if ( vector =3D=3D IRQ_VECTOR_UNASSIGNED ) - vector =3D __ioapic_read_entry(apic, pin, TRUE).vector; + vector =3D __ioapic_read_entry(apic, pin, true).vector; =20 *(IO_APIC_BASE(apic)+16) =3D vector; } @@ -296,28 +296,28 @@ static void __io_apic_eoi(unsigned int apic, unsigned= int vector, unsigned int p struct IO_APIC_route_entry entry; bool need_to_unmask =3D false; =20 - entry =3D __ioapic_read_entry(apic, pin, TRUE); + entry =3D __ioapic_read_entry(apic, pin, true); =20 if ( ! entry.mask ) { /* If entry is not currently masked, mask it and make * a note to unmask it later */ entry.mask =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); need_to_unmask =3D true; } =20 /* Flip the trigger mode to edge and back */ entry.trigger =3D 0; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); entry.trigger =3D 1; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); =20 if ( need_to_unmask ) { /* Unmask if neccesary */ entry.mask =3D 0; - __ioapic_write_entry(apic, pin, TRUE, entry); + __ioapic_write_entry(apic, pin, true, entry); } } } diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c index fa55f3474e..e9d7b80caf 100644 --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -1077,7 +1077,7 @@ long do_set_segment_base(unsigned int which, unsigned= long base) } =20 =20 -/* Returns TRUE if given descriptor is valid for GDT or LDT. */ +/* Returns true if given descriptor is valid for GDT or LDT. */ int check_descriptor(const struct domain *dom, seg_desc_t *d) { u32 a =3D d->a, b =3D d->b; diff --git a/xen/common/kexec.c b/xen/common/kexec.c index a262cc5a18..8e7540f605 100644 --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -33,7 +33,7 @@ #include #endif =20 -bool_t kexecing =3D FALSE; +bool kexecing =3D false; =20 /* Memory regions to store the per cpu register state etc. on a crash. */ typedef struct { Elf_Note * start; size_t size; } crash_note_range_t; @@ -379,7 +379,7 @@ void kexec_crash(void) if ( !test_bit(KEXEC_IMAGE_CRASH_BASE + pos, &kexec_flags) ) return; =20 - kexecing =3D TRUE; + kexecing =3D true; =20 if ( kexec_common_shutdown() !=3D 0 ) return; @@ -395,7 +395,7 @@ static long kexec_reboot(void *_image) { struct kexec_image *image =3D _image; =20 - kexecing =3D TRUE; + kexecing =3D true; =20 kexec_common_shutdown(); machine_reboot_kexec(image); diff --git a/xen/common/timer.c b/xen/common/timer.c index 645206a989..29f8f40f88 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -100,7 +100,7 @@ static void up_heap(struct timer **heap, unsigned int p= os) } =20 =20 -/* Delete @t from @heap. Return TRUE if new top of heap. */ +/* Delete @t from @heap. Return true if new top of heap. */ static int remove_from_heap(struct timer **heap, struct timer *t) { unsigned int sz =3D heap_metadata(heap)->size; @@ -127,7 +127,7 @@ static int remove_from_heap(struct timer **heap, struct= timer *t) } =20 =20 -/* Add new entry @t to @heap. Return TRUE if new top of heap. */ +/* Add new entry @t to @heap. Return true if new top of heap. */ static int add_to_heap(struct timer **heap, struct timer *t) { unsigned int sz =3D heap_metadata(heap)->size; diff --git a/xen/drivers/acpi/tables/tbfadt.c b/xen/drivers/acpi/tables/tbf= adt.c index f11fd5a900..6f30aede9c 100644 --- a/xen/drivers/acpi/tables/tbfadt.c +++ b/xen/drivers/acpi/tables/tbfadt.c @@ -250,9 +250,9 @@ void __init acpi_tb_create_local_fadt(struct acpi_table= _header *table, u32 lengt =20 /* Take a copy of the Hardware Reduced flag */ =20 - acpi_gbl_reduced_hardware =3D FALSE; + acpi_gbl_reduced_hardware =3D false; if (acpi_gbl_FADT.flags & ACPI_FADT_HW_REDUCED) { - acpi_gbl_reduced_hardware =3D TRUE; + acpi_gbl_reduced_hardware =3D true; } =20 /* diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/= vtd/utils.c index 7552dd8e0c..4531581846 100644 --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -281,7 +281,7 @@ void vtd_dump_iommu_info(unsigned char key) for ( i =3D 0; i <=3D reg_01.bits.entries; i++ ) { struct IO_APIC_route_entry rte =3D - __ioapic_read_entry(apic, i, TRUE); + __ioapic_read_entry(apic, i, true); =20 remap =3D (struct IO_APIC_route_remap_entry *) &rte; if ( !remap->format ) diff --git a/xen/include/acpi/acconfig.h b/xen/include/acpi/acconfig.h index 422f29c06c..f0330fb990 100644 --- a/xen/include/acpi/acconfig.h +++ b/xen/include/acpi/acconfig.h @@ -87,7 +87,7 @@ * Should the subsystem abort the loading of an ACPI table if the * table checksum is incorrect? */ -#define ACPI_CHECKSUM_ABORT FALSE +#define ACPI_CHECKSUM_ABORT false =20 /*************************************************************************= ***** * diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h index f3e95abc3a..4aad815f7b 100644 --- a/xen/include/acpi/actypes.h +++ b/xen/include/acpi/actypes.h @@ -124,7 +124,7 @@ * *************************************************************************= *****/ =20 -typedef unsigned char BOOLEAN; +typedef bool BOOLEAN; typedef unsigned char UINT8; typedef unsigned short UINT16; typedef COMPILER_DEPENDENT_UINT64 UINT64; @@ -260,22 +260,6 @@ typedef acpi_native_uint acpi_size; * *************************************************************************= *****/ =20 -/* Logical defines and NULL */ - -#ifdef FALSE -#undef FALSE -#endif -#define FALSE (1 =3D=3D 0) - -#ifdef TRUE -#undef TRUE -#endif -#define TRUE (1 =3D=3D 1) - -#ifndef NULL -#define NULL (void *) 0 -#endif - /* * Mescellaneous types */ @@ -503,7 +487,7 @@ typedef u32 acpi_event_type; * Event Status - Per event * ------------- * The encoding of acpi_event_status is illustrated below. - * Note that a set bit (1) indicates the property is TRUE + * Note that a set bit (1) indicates the property is true * (e.g. if bit 0 is set then the event is enabled). * +-------------+-+-+-+ * | Bits 31:3 |2|1|0| diff --git a/xen/include/asm-arm/arm64/efibind.h b/xen/include/asm-arm/arm6= 4/efibind.h index 2b0bf40bf2..08ab70e668 100644 --- a/xen/include/asm-arm/arm64/efibind.h +++ b/xen/include/asm-arm/arm64/efibind.h @@ -107,7 +107,7 @@ typedef uint64_t UINTN; #define POST_CODE(_Data) =20 =20 -#define BREAKPOINT() while (TRUE); // Make it hang on Bios[Dbg]32 +#define BREAKPOINT() while (true); // Make it hang on Bios[Dbg]32 =20 // // Pointers must be aligned to these address to function diff --git a/xen/include/asm-arm/regs.h b/xen/include/asm-arm/regs.h index 0e3e56b452..f93e1d42b0 100644 --- a/xen/include/asm-arm/regs.h +++ b/xen/include/asm-arm/regs.h @@ -53,7 +53,7 @@ static inline bool guest_mode(const struct cpu_user_regs = *r) ASSERT(diff < STACK_SIZE); /* If not a guest frame, it must be a hypervisor frame. */ ASSERT((diff =3D=3D 0) || hyp_mode(r)); - /* Return TRUE if it's a guest frame. */ + /* Return true if it's a guest frame. */ return (diff =3D=3D 0); } =20 diff --git a/xen/include/asm-x86/regs.h b/xen/include/asm-x86/regs.h index 725a664e0a..679c38bb76 100644 --- a/xen/include/asm-x86/regs.h +++ b/xen/include/asm-x86/regs.h @@ -11,7 +11,7 @@ ASSERT(diff < STACK_SIZE); = \ /* If not a guest frame, it must be a hypervisor frame. */ = \ ASSERT((diff =3D=3D 0) || (r->cs =3D=3D __HYPERVISOR_CS)); = \ - /* Return TRUE if it's a guest frame. */ = \ + /* Return true if it's a guest frame. */ = \ (diff =3D=3D 0); = \ }) =20 diff --git a/xen/include/asm-x86/x86_64/efibind.h b/xen/include/asm-x86/x86= _64/efibind.h index b013db175d..2b7001f8f4 100644 --- a/xen/include/asm-x86/x86_64/efibind.h +++ b/xen/include/asm-x86/x86_64/efibind.h @@ -127,7 +127,7 @@ typedef uint64_t UINTN; #ifdef EFI_NT_EMULATOR #define BREAKPOINT() __asm { int 3 } #else - #define BREAKPOINT() while (TRUE); // Make it hang on Bios[D= bg]32 + #define BREAKPOINT() while (true); // Make it hang on Bios[D= bg]32 #endif =20 // diff --git a/xen/include/efi/efidef.h b/xen/include/efi/efidef.h index 86a7e111bf..fe1750de51 100644 --- a/xen/include/efi/efidef.h +++ b/xen/include/efi/efidef.h @@ -22,16 +22,7 @@ Revision History =20 typedef UINT16 CHAR16; typedef UINT8 CHAR8; -typedef UINT8 BOOLEAN; - -#ifndef TRUE - #define TRUE ((BOOLEAN) 1) - #define FALSE ((BOOLEAN) 0) -#endif - -#ifndef NULL - #define NULL ((VOID *) 0) -#endif +typedef bool BOOLEAN; =20 typedef UINTN EFI_STATUS; typedef UINT64 EFI_LBA; diff --git a/xen/include/xen/mm.h b/xen/include/xen/mm.h index 8d0ddfb60c..2b5ae8cae4 100644 --- a/xen/include/xen/mm.h +++ b/xen/include/xen/mm.h @@ -607,7 +607,7 @@ int __must_check donate_page(struct domain *d, struct p= age_info *page, #define RAM_TYPE_UNUSABLE 0x00000004 #define RAM_TYPE_ACPI 0x00000008 #define RAM_TYPE_UNKNOWN 0x00000010 -/* TRUE if the whole page at @mfn is of the requested RAM type(s) above. */ +/* true if the whole page at @mfn is of the requested RAM type(s) above. */ int page_is_ram_type(unsigned long mfn, unsigned long mem_type); /* Returns the page type(s). */ unsigned int page_get_ram_type(mfn_t mfn); diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 9f7bc69293..c43d9311aa 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -552,7 +552,7 @@ static inline bool is_system_domain(const struct domain= *d) =20 /* * Use this when you don't have an existing reference to @d. It returns - * FALSE if @d is being destroyed. + * false if @d is being destroyed. */ static always_inline int get_domain(struct domain *d) { --=20 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel