From patchwork Mon Jun 6 17:15:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 9158915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 468C360572 for ; Mon, 6 Jun 2016 17:16:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33DF528335 for ; Mon, 6 Jun 2016 17:16:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25E452834F; Mon, 6 Jun 2016 17:16:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9B5F028335 for ; Mon, 6 Jun 2016 17:16:35 +0000 (UTC) Received: from localhost ([::1]:44043 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9y8g-0003Wr-Ep for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Jun 2016 13:16:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59920) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9y8C-0003Tz-Vr for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:16:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9y89-0004zf-OK for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:16:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9y89-0004za-Gn for qemu-devel@nongnu.org; Mon, 06 Jun 2016 13:16:01 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E939212655; Mon, 6 Jun 2016 17:16:00 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-112-64.ams2.redhat.com [10.36.112.64]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u56HFwQh018170; Mon, 6 Jun 2016 13:15:59 -0400 From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 6 Jun 2016 19:15:55 +0200 Message-Id: <1465233355-8046-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 06 Jun 2016 17:16:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] os-posix: include sys/mman.h X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP qemu/osdep.h checks whether MAP_ANONYMOUS is defined, but this check is bogus without a previous inclusion of sys/mman.h. Include it in sysemu/os-posix.h and remove it from everywhere else. Signed-off-by: Paolo Bonzini Reviewed-by: Peter Maydell --- audio/ossaudio.c | 1 - block/qcow2-cache.c | 1 - bsd-user/elfload.c | 1 - bsd-user/main.c | 1 - bsd-user/mmap.c | 1 - bsd-user/syscall.c | 1 - contrib/ivshmem-server/ivshmem-server.c | 1 - exec.c | 1 - hw/block/xen_disk.c | 1 - hw/char/xen_console.c | 1 - hw/display/xenfb.c | 1 - hw/i386/kvm/pci-assign.c | 1 - hw/misc/ivshmem.c | 2 -- hw/misc/pc-testdev.c | 1 - hw/net/xen_nic.c | 1 - hw/usb/xen-usb.c | 1 - hw/vfio/common.c | 1 - hw/vfio/pci.c | 1 - hw/virtio/virtio-balloon.c | 4 ---- hw/xen/xen_backend.c | 1 - hw/xen/xen_pt_msi.c | 1 - include/qemu/osdep.h | 2 -- include/sysemu/os-posix.h | 1 + kvm-all.c | 1 - linux-user/elfload.c | 1 - linux-user/flatload.c | 1 - linux-user/main.c | 1 - linux-user/mmap.c | 1 - linux-user/strace.c | 1 - linux-user/syscall.c | 1 - migration/postcopy-ram.c | 1 - net/netmap.c | 1 - os-posix.c | 1 - qemu-char.c | 1 - scripts/clean-includes | 4 +++- target-arm/kvm.c | 1 - target-arm/kvm32.c | 1 - target-arm/kvm64.c | 1 - target-i386/kvm.c | 1 - target-mips/kvm.c | 1 - target-ppc/kvm.c | 1 - target-s390x/kvm.c | 1 - tests/i440fx-test.c | 1 - tests/ivshmem-test.c | 1 - tests/vhost-user-bridge.c | 1 - tests/vhost-user-test.c | 1 - translate-all.c | 2 -- util/memfd.c | 2 -- util/mmap-alloc.c | 1 - util/osdep.c | 4 ---- util/oslib-posix.c | 1 - xen-hvm.c | 1 - xen-mapcache.c | 1 - 53 files changed, 4 insertions(+), 62 deletions(-) diff --git a/audio/ossaudio.c b/audio/ossaudio.c index a0d9cda..0edd7ea 100644 --- a/audio/ossaudio.c +++ b/audio/ossaudio.c @@ -22,7 +22,6 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" -#include #include #include #include "qemu-common.h" diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index 0fe8eda..4f4ce31 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -26,7 +26,6 @@ #include "qemu/osdep.h" #if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE) -#include #endif #include "block/block_int.h" diff --git a/bsd-user/elfload.c b/bsd-user/elfload.c index 898ee05..41a1309 100644 --- a/bsd-user/elfload.c +++ b/bsd-user/elfload.c @@ -1,7 +1,6 @@ /* This is the Linux kernel elf-loading code, ported into user space */ #include "qemu/osdep.h" -#include #include "qemu.h" #include "disas/disas.h" diff --git a/bsd-user/main.c b/bsd-user/main.c index 9f592be..abe9a26 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" #include -#include #include "qemu.h" #include "qemu/path.h" diff --git a/bsd-user/mmap.c b/bsd-user/mmap.c index 6ab5334..610f91b 100644 --- a/bsd-user/mmap.c +++ b/bsd-user/mmap.c @@ -17,7 +17,6 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" -#include #include "qemu.h" #include "qemu-common.h" diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c index 47cf865..a9fe869 100644 --- a/bsd-user/syscall.c +++ b/bsd-user/syscall.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" #include "qemu/path.h" -#include #include #include #include diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c index bf4ee0b..e2f295b 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -10,7 +10,6 @@ #include "qemu/host-utils.h" #include "qemu/sockets.h" -#include #include #include diff --git a/exec.c b/exec.c index f2c9e37..226a708 100644 --- a/exec.c +++ b/exec.c @@ -19,7 +19,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #ifndef _WIN32 -#include #endif #include "qemu/cutils.h" diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 064c116..ba7ce54 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include -#include #include #include "hw/hw.h" diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c index cbf1dcc..83108b0 100644 --- a/hw/char/xen_console.c +++ b/hw/char/xen_console.c @@ -22,7 +22,6 @@ #include "qemu/osdep.h" #include #include -#include #include "hw/hw.h" #include "sysemu/char.h" diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c index 9866dfd..259bcac 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -25,7 +25,6 @@ */ #include "qemu/osdep.h" -#include #include "hw/hw.h" #include "ui/console.h" diff --git a/hw/i386/kvm/pci-assign.c b/hw/i386/kvm/pci-assign.c index db2cbd2..dd9e73b 100644 --- a/hw/i386/kvm/pci-assign.c +++ b/hw/i386/kvm/pci-assign.c @@ -22,7 +22,6 @@ */ #include "qemu/osdep.h" #include "qapi/error.h" -#include #include "hw/hw.h" #include "hw/i386/pc.h" #include "qemu/error-report.h" diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index 90be9f7..c4dde3a 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -36,8 +36,6 @@ #include "hw/misc/ivshmem.h" -#include - #define PCI_VENDOR_ID_IVSHMEM PCI_VENDOR_ID_REDHAT_QUMRANET #define PCI_DEVICE_ID_IVSHMEM 0x1110 diff --git a/hw/misc/pc-testdev.c b/hw/misc/pc-testdev.c index 086893d..34bcebb 100644 --- a/hw/misc/pc-testdev.c +++ b/hw/misc/pc-testdev.c @@ -37,7 +37,6 @@ #include "qemu/osdep.h" #if defined(CONFIG_POSIX) -#include #endif #include "hw/hw.h" #include "hw/qdev.h" diff --git a/hw/net/xen_nic.c b/hw/net/xen_nic.c index 7281730..0b4ddae 100644 --- a/hw/net/xen_nic.c +++ b/hw/net/xen_nic.c @@ -22,7 +22,6 @@ #include "qemu/osdep.h" #include #include -#include #include #include "hw/hw.h" diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 664df04..09e9656 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "qemu/osdep.h" diff --git a/hw/vfio/common.c b/hw/vfio/common.c index e51ed3a..5ff5e92 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -20,7 +20,6 @@ #include "qemu/osdep.h" #include -#include #include #include "hw/vfio/vfio-common.h" diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index deab0c6..53b87b7 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -21,7 +21,6 @@ #include "qemu/osdep.h" #include #include -#include #include "hw/pci/msi.h" #include "hw/pci/msix.h" diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 8c15e09..557d3f9 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -27,10 +27,6 @@ #include "qapi-event.h" #include "trace.h" -#if defined(__linux__) -#include -#endif - #include "hw/virtio/virtio-bus.h" #include "hw/virtio/virtio-access.h" diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c index c63f9df..e7ce724 100644 --- a/hw/xen/xen_backend.c +++ b/hw/xen/xen_backend.c @@ -23,7 +23,6 @@ */ #include "qemu/osdep.h" -#include #include #include "hw/hw.h" diff --git a/hw/xen/xen_pt_msi.c b/hw/xen/xen_pt_msi.c index 9a16f2b..62add06 100644 --- a/hw/xen/xen_pt_msi.c +++ b/hw/xen/xen_pt_msi.c @@ -10,7 +10,6 @@ */ #include "qemu/osdep.h" -#include #include "hw/xen/xen_backend.h" #include "xen_pt.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 6937694..e63da28 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -197,8 +197,6 @@ void qemu_anon_ram_free(void *ptr, size_t size); #if defined(CONFIG_MADVISE) -#include - #define QEMU_MADV_WILLNEED MADV_WILLNEED #define QEMU_MADV_DONTNEED MADV_DONTNEED #ifdef MADV_DONTFORK diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index 07e3e5a..9c7dfdf 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -26,6 +26,7 @@ #ifndef QEMU_OS_POSIX_H #define QEMU_OS_POSIX_H +#include #include #include #include diff --git a/kvm-all.c b/kvm-all.c index d317dcb..9447e08 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -15,7 +15,6 @@ #include "qemu/osdep.h" #include -#include #include diff --git a/linux-user/elfload.c b/linux-user/elfload.c index bb2558f..f807baf 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2,7 +2,6 @@ #include "qemu/osdep.h" #include -#include #include #include "qemu.h" diff --git a/linux-user/flatload.c b/linux-user/flatload.c index f9139c3..48ad1c5 100644 --- a/linux-user/flatload.c +++ b/linux-user/flatload.c @@ -34,7 +34,6 @@ /****************************************************************************/ #include "qemu/osdep.h" -#include #include "qemu.h" #include "flat.h" diff --git a/linux-user/main.c b/linux-user/main.c index 8a11d02..42262a8 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -18,7 +18,6 @@ */ #include "qemu/osdep.h" #include "qemu-version.h" -#include #include #include diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 3519147..c4371d9 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c @@ -17,7 +17,6 @@ * along with this program; if not, see . */ #include "qemu/osdep.h" -#include #include #include diff --git a/linux-user/strace.c b/linux-user/strace.c index 0810c85..ec9bcff 100644 --- a/linux-user/strace.c +++ b/linux-user/strace.c @@ -5,7 +5,6 @@ #include #include #include -#include #include #include "qemu.h" diff --git a/linux-user/syscall.c b/linux-user/syscall.c index df70255..d03731e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c index cf7dcd2..1e422da 100644 --- a/migration/postcopy-ram.c +++ b/migration/postcopy-ram.c @@ -52,7 +52,6 @@ struct PostcopyDiscardState { #if defined(__linux__) #include -#include #include #include #include /* for __u64 */ diff --git a/net/netmap.c b/net/netmap.c index 6cc0db5..64967b9 100644 --- a/net/netmap.c +++ b/net/netmap.c @@ -26,7 +26,6 @@ #include "qemu/osdep.h" #include #include -#include #define NETMAP_WITH_LIBS #include #include diff --git a/os-posix.c b/os-posix.c index 107fde3..3755265 100644 --- a/os-posix.c +++ b/os-posix.c @@ -26,7 +26,6 @@ #include "qemu/osdep.h" #include /*needed for MAP_POPULATE before including qemu-options.h */ -#include #include #include #include diff --git a/qemu-char.c b/qemu-char.c index b13ecbb..c926e9a 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -47,7 +47,6 @@ #include #include #include -#include #include #include #include diff --git a/scripts/clean-includes b/scripts/clean-includes index 72b47f1..cdf070d 100755 --- a/scripts/clean-includes +++ b/scripts/clean-includes @@ -104,6 +104,8 @@ for f in "$@"; do ;; *include/qemu/osdep.h | \ *include/qemu/compiler.h | \ + *include/sysemu/os-posix.h | \ + *include/sysemu/os-win32.h | \ *include/standard-headers/ ) # Removing include lines from osdep.h itself would be counterproductive. echo "SKIPPING $f (special case header)" @@ -143,7 +145,7 @@ for f in "$@"; do - + "sysemu/os-posix.h, sysemu/os-win32.h "glib-compat.h" "qemu/typedefs.h" ))' "$f" diff --git a/target-arm/kvm.c b/target-arm/kvm.c index 83da447..5c2bd7a 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -10,7 +10,6 @@ #include "qemu/osdep.h" #include -#include #include diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c index c03e3e5..af3c0b5 100644 --- a/target-arm/kvm32.c +++ b/target-arm/kvm32.c @@ -10,7 +10,6 @@ #include "qemu/osdep.h" #include -#include #include diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c index e2a34f6..c84d4c7 100644 --- a/target-arm/kvm64.c +++ b/target-arm/kvm64.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include -#include #include #include diff --git a/target-i386/kvm.c b/target-i386/kvm.c index abf50e6..7b092ee 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -15,7 +15,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include -#include #include #include diff --git a/target-mips/kvm.c b/target-mips/kvm.c index a854e4d..f3f832d 100644 --- a/target-mips/kvm.c +++ b/target-mips/kvm.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include -#include #include diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 24d6032..744a6ff 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -17,7 +17,6 @@ #include "qemu/osdep.h" #include #include -#include #include #include diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 8f46fd0..8c5dcab 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -23,7 +23,6 @@ #include "qemu/osdep.h" #include -#include #include #include diff --git a/tests/i440fx-test.c b/tests/i440fx-test.c index 05029e9..59c93b9 100644 --- a/tests/i440fx-test.c +++ b/tests/i440fx-test.c @@ -14,7 +14,6 @@ #include "qemu/osdep.h" #include -#include #include "libqtest.h" #include "libqos/pci.h" diff --git a/tests/ivshmem-test.c b/tests/ivshmem-test.c index c027ff1..e740c14 100644 --- a/tests/ivshmem-test.c +++ b/tests/ivshmem-test.c @@ -11,7 +11,6 @@ #include "qemu/osdep.h" #include #include -#include #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/pci-pc.h" #include "libqtest.h" diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 0779ba2..57c8f91 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6961596..b826cbd 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -18,7 +18,6 @@ #include "sysemu/sysemu.h" #include -#include #include #include diff --git a/translate-all.c b/translate-all.c index c599dc4..7e9af4a 100644 --- a/translate-all.c +++ b/translate-all.c @@ -18,8 +18,6 @@ */ #ifdef _WIN32 #include -#else -#include #endif #include "qemu/osdep.h" diff --git a/util/memfd.c b/util/memfd.c index 7c40691..8f0e7ce 100644 --- a/util/memfd.c +++ b/util/memfd.c @@ -30,8 +30,6 @@ #include #include -#include - #include "qemu/memfd.h" #ifdef CONFIG_MEMFD diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 0b4cc7f..629d97a 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -11,7 +11,6 @@ */ #include "qemu/osdep.h" #include -#include #define HUGETLBFS_MAGIC 0x958458f6 diff --git a/util/osdep.c b/util/osdep.c index 9a7a439..ff004e8 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -25,10 +25,6 @@ /* Needed early for CONFIG_BSD etc. */ -#if defined(CONFIG_MADVISE) || defined(CONFIG_POSIX_MADVISE) -#include -#endif - #ifdef CONFIG_SOLARIS #include /* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 4adde93..e2e1d4d 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -36,7 +36,6 @@ #include "trace.h" #include "qapi/error.h" #include "qemu/sockets.h" -#include #include #include #include "qemu/cutils.h" diff --git a/xen-hvm.c b/xen-hvm.c index 01ee25d..a819b8d 100644 --- a/xen-hvm.c +++ b/xen-hvm.c @@ -9,7 +9,6 @@ */ #include "qemu/osdep.h" -#include #include "cpu.h" #include "hw/pci/pci.h" diff --git a/xen-mapcache.c b/xen-mapcache.c index 49f394a..8f3a592 100644 --- a/xen-mapcache.c +++ b/xen-mapcache.c @@ -17,7 +17,6 @@ #include "qemu/bitmap.h" #include -#include #include "sysemu/xen-mapcache.h" #include "trace.h"