From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613459; cv=none; d=zohomail.com; s=zohoarc; b=M9WjV2sbI/mJ+YWBluGvSxww6/6yRJwQ853EhYLCUL42OxB3N3Cu/O8QJkdMXiRBrryyJ7wuOfXJDb3Zoq6AsjCx03QIi2BiZYKeiLxEnikZ/ItJUGrAmPLlDx+CoyNy36oFjLdVzbWRekiBRAGj+ebEAZYhzijijh3gbC6woZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613459; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fuga4LugH825TIlXqNJy7BbClfzwgBYhIYx2V+44kGA=; b=EZeAxkHVn1cRDF0SeC1/ICjwBIINW1vVMBRdUCDzxxHUiR7QYg28odzELQhHrTsonK0sUr+mZiEV6NG9igfX7OGvDMHlPrmdsPFej7yQv1oKbSWllT5NA27UE/dpuurNnuufL9IvwfMzdmrjZCeE0WLGTpExNAqiBVZGfvEGdeY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613459682492.2531657700322; Tue, 3 May 2022 14:30:59 -0700 (PDT) Received: from localhost ([::1]:48918 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm06j-0005Nk-Un for importer@patchew.org; Tue, 03 May 2022 17:30:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyvO-0001jH-H6 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:15:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:33890) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyvL-0003Eh-SB for qemu-devel@nongnu.org; Tue, 03 May 2022 16:15:10 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-68-7tN2x-QsN2ygkFkl9LMcMA-1; Tue, 03 May 2022 11:37:27 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 72FBC3CF0AA4; Tue, 3 May 2022 13:00:36 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5333F53CD; Tue, 3 May 2022 13:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fuga4LugH825TIlXqNJy7BbClfzwgBYhIYx2V+44kGA=; b=Psd5Cp4TPkYrPwPUdYTPd0w00padYYNWLaT3aPFaYFE8Cv+iPOw+oWsXPT4djs46YXOY2X QtapsKoksTFusTH0qPPW95DZcObNj1ZCu9LNn0sdKW6ZWr58prPJwDb2YXdP4JLWkNGWdh QQafSAUanKKjGBAF+8nBekcgPPMe91c= X-MC-Unique: 7tN2x-QsN2ygkFkl9LMcMA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 01/23] Use QEMU_SANITIZE_THREAD Date: Tue, 3 May 2022 17:00:01 +0400 Message-Id: <20220503130023.180544-2-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613461227100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Richard Henderson --- include/qemu/atomic.h | 8 +++++--- subprojects/libvhost-user/include/compiler.h | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) create mode 120000 subprojects/libvhost-user/include/compiler.h diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 112a29910bea..7e8fc8e7cde2 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -15,6 +15,8 @@ #ifndef QEMU_ATOMIC_H #define QEMU_ATOMIC_H =20 +#include "compiler.h" + /* Compiler barrier */ #define barrier() ({ asm volatile("" ::: "memory"); (void)0; }) =20 @@ -81,7 +83,7 @@ * no processors except Alpha need a barrier here. Leave it in if * using Thread Sanitizer to avoid warnings, otherwise optimize it away. */ -#if defined(__SANITIZE_THREAD__) +#ifdef QEMU_SANITIZE_THREAD #define smp_read_barrier_depends() ({ barrier(); __atomic_thread_fence(_= _ATOMIC_CONSUME); }) #elif defined(__alpha__) #define smp_read_barrier_depends() asm volatile("mb":::"memory") @@ -146,7 +148,7 @@ /* See above: most compilers currently treat consume and acquire the * same, but this slows down qatomic_rcu_read unnecessarily. */ -#ifdef __SANITIZE_THREAD__ +#ifdef QEMU_SANITIZE_THREAD #define qatomic_rcu_read__nocheck(ptr, valptr) \ __atomic_load(ptr, valptr, __ATOMIC_CONSUME); #else @@ -254,7 +256,7 @@ #define qatomic_mb_read(ptr) \ qatomic_load_acquire(ptr) =20 -#if !defined(__SANITIZE_THREAD__) && \ +#if !defined(QEMU_SANITIZE_THREAD) && \ (defined(__i386__) || defined(__x86_64__) || defined(__s390x__)) /* This is more efficient than a store plus a fence. */ # define qatomic_mb_set(ptr, i) ((void)qatomic_xchg(ptr, i)) diff --git a/subprojects/libvhost-user/include/compiler.h b/subprojects/lib= vhost-user/include/compiler.h new file mode 120000 index 000000000000..de7b70697cd2 --- /dev/null +++ b/subprojects/libvhost-user/include/compiler.h @@ -0,0 +1 @@ +../../../include/qemu/compiler.h \ No newline at end of file --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651612993; cv=none; d=zohomail.com; s=zohoarc; b=kZTpYyAdpDEotnW1B/AjqtiIx0Ps3FZ464cMQRebBmPO3BpcB3pVW0TkrDtL2bsdy3RdgqloQ0dzdw3ppdgo5JzEYYEwB66C+7l42vzy6v58huWedkfkovlzaA304VNqNWsP5CygDNhHHDZ1FntFFcNnAbJDTTCi3C+5+mE7/Oo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651612993; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vddiXhm6AjciFnp+PAgjI6tNEAIpZ19o/JjvTz+HyqA=; b=nLPwPtWxctjZDNh0UxzWtlB3F4QGVD0H2Bj9Ml8lN7yiRb4m9PXtdVWrv+0Km+lZt46tCYd76zHoNLHOlj4J4tHR757S/rBlje3NjfkayRt3ubNy9DI0/xM+3opmPwmAY2pMJSmeS8NeXZQ/4hQZAVhOjluihNUiWiER3Q9RwhU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 165161299361992.64788954346477; Tue, 3 May 2022 14:23:13 -0700 (PDT) Received: from localhost ([::1]:60992 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlzzA-0002ST-Oc for importer@patchew.org; Tue, 03 May 2022 17:23:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyuL-0000WI-Sc for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40360) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyuK-0002y7-1w for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:05 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-186--cEiGPJ0Nwm9PqlGux4WNA-1; Tue, 03 May 2022 11:35:42 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F189519308BB; Tue, 3 May 2022 13:00:41 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6D6D40CFD19; Tue, 3 May 2022 13:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vddiXhm6AjciFnp+PAgjI6tNEAIpZ19o/JjvTz+HyqA=; b=LYUyKEL7C64Yv0eG50hpPnoxrRnolUGr9xnsadEzrhgvd/wiuLo3aTAGu8loevtk2aAeoc rxeJoAz/7k41WhSJhxr4cV55a0J4pZPM/YeRvCLtseeEibMsi/EqgwnGM7KuaUv1ZZv9xr ai/HiORnXv4FSmMlJylYE/sMpLDBpJ8= X-MC-Unique: -cEiGPJ0Nwm9PqlGux4WNA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 02/23] Use QEMU_SANITIZE_ADDRESS Date: Tue, 3 May 2022 17:00:02 +0400 Message-Id: <20220503130023.180544-3-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651612995492100001 From: Marc-Andr=C3=A9 Lureau Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth --- tests/qtest/fdc-test.c | 2 +- util/coroutine-ucontext.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/qtest/fdc-test.c b/tests/qtest/fdc-test.c index 4aa72f36431f..0b3c2c0d523f 100644 --- a/tests/qtest/fdc-test.c +++ b/tests/qtest/fdc-test.c @@ -550,7 +550,7 @@ static void fuzz_registers(void) =20 static bool qtest_check_clang_sanitizer(void) { -#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) +#ifdef QEMU_SANITIZE_ADDRESS return true; #else g_test_skip("QEMU not configured using --enable-sanitizers"); diff --git a/util/coroutine-ucontext.c b/util/coroutine-ucontext.c index 904b375192ca..ed368e1a3ec3 100644 --- a/util/coroutine-ucontext.c +++ b/util/coroutine-ucontext.c @@ -30,7 +30,7 @@ #include #endif =20 -#if defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) +#ifdef QEMU_SANITIZE_ADDRESS #ifdef CONFIG_ASAN_IFACE_FIBER #define CONFIG_ASAN 1 #include --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651615683; cv=none; d=zohomail.com; s=zohoarc; b=GtjNtCU44bjKeH63sEoP3LDjA7neBB4ds3ETxAVX0bMJGj4AcL45lOpW0IctMV/1N5uZwPs8qvY3cTLHjteaWPKyFb+emAkRcZPG3XyMsXiEopFYYF9jRIm5SxFuSaozIe/mVntxn+5sS/ixfOaSS5pfWihrExckcK1QK8DdAxk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651615683; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bX/kKzh77xlg4GCxClyGvw/kEYrdscmX9tmktjjuMpY=; b=nWLEAtA9GxZaK3jM+p1dSdRRWmg25sLVNftWWZuLIcPaBh7g3Qk+QtDjKj8gfgLGwBN3gSEBcGmeuMGwEvCpJNaK9gln/feHu8GShKb8y+S19htW+3ovueH8sV9D0yVA43SyO8DSNkbMxorv140QuGK1OdGeuPJRtzaMD9eAw5E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651615683761187.38670690551157; Tue, 3 May 2022 15:08:03 -0700 (PDT) Received: from localhost ([::1]:38876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0gb-0001wh-Vw for importer@patchew.org; Tue, 03 May 2022 18:08:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz1S-0003JA-It for qemu-devel@nongnu.org; Tue, 03 May 2022 16:21:26 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52675) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz1N-00053f-LT for qemu-devel@nongnu.org; Tue, 03 May 2022 16:21:26 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-360-EIzhs_-TNSmmyPeAZbipTQ-1; Tue, 03 May 2022 11:35:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BEE301CCBFA1; Tue, 3 May 2022 13:00:48 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CED340D282C; Tue, 3 May 2022 13:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bX/kKzh77xlg4GCxClyGvw/kEYrdscmX9tmktjjuMpY=; b=gsbyX5GFrJ7cluUs06DoC4OgK2bkSihLbQLq58bhaNEdIxQt97MoTA29Ces4UuAGIiiR/L x51kTgp0Dz3ZM3DZHTLbjmz8Rf7VBPaeFzH+PRIuAWZzS2pji0uALecMehJ8n35zYMK0ti b8uoFqup70s63ReW/I8H4ZC81Di8UJo= X-MC-Unique: EIzhs_-TNSmmyPeAZbipTQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 03/23] tests: move libqtest.h back under qtest/ Date: Tue, 3 May 2022 17:00:03 +0400 Message-Id: <20220503130023.180544-4-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651615684386100001 From: Marc-Andr=C3=A9 Lureau Since commit a2ce7dbd917 ("meson: convert tests/qtest to meson"), libqtest.h is under libqos/ directory, while libqtest.c is still in qtest/. Move back to its original location to avoid mixing with libqos/. Suggested-by: Thomas Huth Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Thomas Huth Reviewed-by: Stefan Berger --- docs/devel/qtest.rst | 2 +- tests/qtest/acpi-utils.h | 2 +- tests/qtest/boot-sector.h | 2 +- tests/qtest/fuzz/fuzz.h | 2 +- tests/qtest/libqos/fw_cfg.h | 2 +- tests/qtest/libqos/i2c.h | 2 +- tests/qtest/libqos/libqos.h | 2 +- tests/qtest/libqos/malloc.h | 2 +- tests/qtest/libqos/pci.h | 2 +- tests/qtest/libqos/sdhci-cmd.h | 2 +- tests/qtest/libqtest-single.h | 2 +- tests/qtest/{libqos =3D> }/libqtest.h | 0 tests/qtest/migration-helpers.h | 2 +- tests/qtest/tpm-emu.h | 2 +- tests/qtest/ac97-test.c | 2 +- tests/qtest/ahci-test.c | 2 +- tests/qtest/am53c974-test.c | 2 +- tests/qtest/arm-cpu-features.c | 2 +- tests/qtest/aspeed_hace-test.c | 2 +- tests/qtest/boot-order-test.c | 2 +- tests/qtest/boot-sector.c | 2 +- tests/qtest/boot-serial-test.c | 2 +- tests/qtest/cdrom-test.c | 2 +- tests/qtest/dbus-display-test.c | 2 +- tests/qtest/dbus-vmstate-test.c | 2 +- tests/qtest/device-introspect-test.c | 2 +- tests/qtest/device-plug-test.c | 2 +- tests/qtest/drive_del-test.c | 2 +- tests/qtest/ds1338-test.c | 2 +- tests/qtest/e1000-test.c | 2 +- tests/qtest/eepro100-test.c | 2 +- tests/qtest/endianness-test.c | 2 +- tests/qtest/erst-test.c | 2 +- tests/qtest/es1370-test.c | 2 +- tests/qtest/fuzz-e1000e-test.c | 2 +- tests/qtest/fuzz-lsi53c895a-test.c | 2 +- tests/qtest/fuzz-megasas-test.c | 2 +- tests/qtest/fuzz-sb16-test.c | 2 +- tests/qtest/fuzz-sdcard-test.c | 2 +- tests/qtest/fuzz-virtio-scsi-test.c | 2 +- tests/qtest/fuzz-xlnx-dp-test.c | 2 +- tests/qtest/fuzz/fuzz.c | 2 +- tests/qtest/fuzz/generic_fuzz.c | 2 +- tests/qtest/fuzz/i440fx_fuzz.c | 2 +- tests/qtest/fuzz/qos_fuzz.c | 2 +- tests/qtest/fuzz/virtio_blk_fuzz.c | 2 +- tests/qtest/fuzz/virtio_net_fuzz.c | 2 +- tests/qtest/fuzz/virtio_scsi_fuzz.c | 2 +- tests/qtest/fw_cfg-test.c | 2 +- tests/qtest/hd-geo-test.c | 2 +- tests/qtest/hexloader-test.c | 2 +- tests/qtest/ide-test.c | 2 +- tests/qtest/ipoctal232-test.c | 2 +- tests/qtest/ivshmem-test.c | 2 +- tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c | 2 +- tests/qtest/libqos/ahci.c | 2 +- tests/qtest/libqos/arm-imx25-pdk-machine.c | 2 +- tests/qtest/libqos/arm-n800-machine.c | 2 +- tests/qtest/libqos/arm-raspi2-machine.c | 2 +- tests/qtest/libqos/arm-sabrelite-machine.c | 2 +- tests/qtest/libqos/arm-smdkc210-machine.c | 2 +- tests/qtest/libqos/arm-virt-machine.c | 2 +- tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c | 2 +- tests/qtest/libqos/e1000e.c | 2 +- tests/qtest/libqos/fw_cfg.c | 2 +- tests/qtest/libqos/i2c-imx.c | 2 +- tests/qtest/libqos/i2c-omap.c | 2 +- tests/qtest/libqos/i2c.c | 2 +- tests/qtest/libqos/libqos.c | 2 +- tests/qtest/libqos/pci-pc.c | 2 +- tests/qtest/libqos/pci-spapr.c | 2 +- tests/qtest/libqos/ppc64_pseries-machine.c | 2 +- tests/qtest/libqos/qgraph.c | 2 +- tests/qtest/libqos/qos_external.c | 2 +- tests/qtest/libqos/rtas.c | 2 +- tests/qtest/libqos/sdhci-cmd.c | 2 +- tests/qtest/libqos/sdhci.c | 2 +- tests/qtest/libqos/tpci200.c | 2 +- tests/qtest/libqos/usb.c | 2 +- tests/qtest/libqos/vhost-user-blk.c | 2 +- tests/qtest/libqos/virtio-9p.c | 2 +- tests/qtest/libqos/virtio-balloon.c | 2 +- tests/qtest/libqos/virtio-blk.c | 2 +- tests/qtest/libqos/virtio-iommu.c | 2 +- tests/qtest/libqos/virtio-mmio.c | 2 +- tests/qtest/libqos/virtio-net.c | 2 +- tests/qtest/libqos/virtio-pci.c | 2 +- tests/qtest/libqos/virtio-rng.c | 2 +- tests/qtest/libqos/virtio-scsi.c | 2 +- tests/qtest/libqos/virtio-serial.c | 2 +- tests/qtest/libqos/virtio.c | 2 +- tests/qtest/libqos/x86_64_pc-machine.c | 2 +- tests/qtest/libqtest.c | 2 +- tests/qtest/lpc-ich9-test.c | 2 +- tests/qtest/m48t59-test.c | 2 +- tests/qtest/machine-none-test.c | 2 +- tests/qtest/megasas-test.c | 2 +- tests/qtest/microbit-test.c | 2 +- tests/qtest/migration-test.c | 2 +- tests/qtest/modules-test.c | 2 +- tests/qtest/ne2000-test.c | 2 +- tests/qtest/npcm7xx_adc-test.c | 2 +- tests/qtest/npcm7xx_pwm-test.c | 2 +- tests/qtest/npcm7xx_sdhci-test.c | 2 +- tests/qtest/npcm7xx_smbus-test.c | 2 +- tests/qtest/npcm7xx_watchdog_timer-test.c | 2 +- tests/qtest/numa-test.c | 2 +- tests/qtest/nvme-test.c | 2 +- tests/qtest/pca9552-test.c | 2 +- tests/qtest/pci-test.c | 2 +- tests/qtest/pcnet-test.c | 2 +- tests/qtest/pflash-cfi02-test.c | 2 +- tests/qtest/pnv-xscom-test.c | 2 +- tests/qtest/prom-env-test.c | 2 +- tests/qtest/pvpanic-pci-test.c | 2 +- tests/qtest/pvpanic-test.c | 2 +- tests/qtest/pxe-test.c | 2 +- tests/qtest/q35-test.c | 2 +- tests/qtest/qmp-cmd-test.c | 2 +- tests/qtest/qmp-test.c | 2 +- tests/qtest/qom-test.c | 2 +- tests/qtest/rtas-test.c | 2 +- tests/qtest/sdhci-test.c | 2 +- tests/qtest/spapr-phb-test.c | 2 +- tests/qtest/tco-test.c | 2 +- tests/qtest/test-filter-mirror.c | 2 +- tests/qtest/test-filter-redirector.c | 2 +- tests/qtest/test-hmp.c | 2 +- tests/qtest/tpm-crb-swtpm-test.c | 2 +- tests/qtest/tpm-tis-device-swtpm-test.c | 2 +- tests/qtest/tpm-tis-swtpm-test.c | 2 +- tests/qtest/tpm-util.c | 2 +- tests/qtest/tulip-test.c | 2 +- tests/qtest/virtio-net-failover.c | 2 +- tests/qtest/virtio-rng-test.c | 2 +- tests/qtest/virtio-test.c | 2 +- tests/qtest/vmgenid-test.c | 2 +- tests/qtest/vmxnet3-test.c | 2 +- tests/qtest/wdt_ib700-test.c | 2 +- tests/qtest/xlnx-can-test.c | 2 +- tests/unit/test-qga.c | 2 +- scripts/oss-fuzz/output_reproducer.py | 2 +- 142 files changed, 141 insertions(+), 141 deletions(-) rename tests/qtest/{libqos =3D> }/libqtest.h (100%) diff --git a/docs/devel/qtest.rst b/docs/devel/qtest.rst index add293d39700..0455aa06ab28 100644 --- a/docs/devel/qtest.rst +++ b/docs/devel/qtest.rst @@ -88,4 +88,4 @@ QTest Protocol libqtest API reference ---------------------- =20 -.. kernel-doc:: tests/qtest/libqos/libqtest.h +.. kernel-doc:: tests/qtest/libqtest.h diff --git a/tests/qtest/acpi-utils.h b/tests/qtest/acpi-utils.h index 261784d25189..0c8678068931 100644 --- a/tests/qtest/acpi-utils.h +++ b/tests/qtest/acpi-utils.h @@ -13,7 +13,7 @@ #ifndef TEST_ACPI_UTILS_H #define TEST_ACPI_UTILS_H =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* DSDT and SSDTs format */ typedef struct { diff --git a/tests/qtest/boot-sector.h b/tests/qtest/boot-sector.h index b339fdee4c84..6ee6bb4d97f4 100644 --- a/tests/qtest/boot-sector.h +++ b/tests/qtest/boot-sector.h @@ -14,7 +14,7 @@ #ifndef TEST_BOOT_SECTOR_H #define TEST_BOOT_SECTOR_H =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* Create boot disk file. fname must be a suitable string for mkstemp() */ int boot_sector_init(char *fname); diff --git a/tests/qtest/fuzz/fuzz.h b/tests/qtest/fuzz/fuzz.h index 3a8570e84c79..c5f0b7227a10 100644 --- a/tests/qtest/fuzz/fuzz.h +++ b/tests/qtest/fuzz/fuzz.h @@ -17,7 +17,7 @@ #include "qemu/units.h" #include "qapi/error.h" =20 -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" =20 /** * A libfuzzer fuzzing target diff --git a/tests/qtest/libqos/fw_cfg.h b/tests/qtest/libqos/fw_cfg.h index c6a7cf8cf053..b0456a15df19 100644 --- a/tests/qtest/libqos/fw_cfg.h +++ b/tests/qtest/libqos/fw_cfg.h @@ -13,7 +13,7 @@ #ifndef LIBQOS_FW_CFG_H #define LIBQOS_FW_CFG_H =20 -#include "libqtest.h" +#include "../libqtest.h" =20 typedef struct QFWCFG QFWCFG; =20 diff --git a/tests/qtest/libqos/i2c.h b/tests/qtest/libqos/i2c.h index 1341bac1c599..d0322409227c 100644 --- a/tests/qtest/libqos/i2c.h +++ b/tests/qtest/libqos/i2c.h @@ -9,7 +9,7 @@ #ifndef LIBQOS_I2C_H #define LIBQOS_I2C_H =20 -#include "libqtest.h" +#include "../libqtest.h" #include "qgraph.h" =20 typedef struct I2CAdapter I2CAdapter; diff --git a/tests/qtest/libqos/libqos.h b/tests/qtest/libqos/libqos.h index e0b2bfe7caf9..ba7df448cad7 100644 --- a/tests/qtest/libqos/libqos.h +++ b/tests/qtest/libqos/libqos.h @@ -1,7 +1,7 @@ #ifndef LIBQOS_H #define LIBQOS_H =20 -#include "libqtest.h" +#include "../libqtest.h" #include "pci.h" #include "malloc.h" =20 diff --git a/tests/qtest/libqos/malloc.h b/tests/qtest/libqos/malloc.h index 4d1a2e2bef4a..bbb8c743cc5a 100644 --- a/tests/qtest/libqos/malloc.h +++ b/tests/qtest/libqos/malloc.h @@ -14,7 +14,7 @@ #define LIBQOS_MALLOC_H =20 #include "qemu/queue.h" -#include "libqtest.h" +#include "../libqtest.h" =20 typedef enum { ALLOC_NO_FLAGS =3D 0x00, diff --git a/tests/qtest/libqos/pci.h b/tests/qtest/libqos/pci.h index becb800f9e6a..e705e06598c2 100644 --- a/tests/qtest/libqos/pci.h +++ b/tests/qtest/libqos/pci.h @@ -13,7 +13,7 @@ #ifndef LIBQOS_PCI_H #define LIBQOS_PCI_H =20 -#include "libqtest.h" +#include "../libqtest.h" #include "qgraph.h" =20 #define QPCI_PIO_LIMIT 0x10000 diff --git a/tests/qtest/libqos/sdhci-cmd.h b/tests/qtest/libqos/sdhci-cmd.h index 64763c5a2ace..9e61dd494464 100644 --- a/tests/qtest/libqos/sdhci-cmd.h +++ b/tests/qtest/libqos/sdhci-cmd.h @@ -14,7 +14,7 @@ * for more details. */ =20 -#include "libqtest.h" +#include "../libqtest.h" =20 /* more details at hw/sd/sdhci-internal.h */ #define SDHC_BLKSIZE 0x04 diff --git a/tests/qtest/libqtest-single.h b/tests/qtest/libqtest-single.h index b0838b9e0e71..4e7d0ae1dcd3 100644 --- a/tests/qtest/libqtest-single.h +++ b/tests/qtest/libqtest-single.h @@ -11,7 +11,7 @@ #ifndef LIBQTEST_SINGLE_H #define LIBQTEST_SINGLE_H =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 QTestState *global_qtest __attribute__((common, weak)); =20 diff --git a/tests/qtest/libqos/libqtest.h b/tests/qtest/libqtest.h similarity index 100% rename from tests/qtest/libqos/libqtest.h rename to tests/qtest/libqtest.h diff --git a/tests/qtest/migration-helpers.h b/tests/qtest/migration-helper= s.h index 555adafce129..c7872e84421f 100644 --- a/tests/qtest/migration-helpers.h +++ b/tests/qtest/migration-helpers.h @@ -12,7 +12,7 @@ #ifndef MIGRATION_HELPERS_H_ #define MIGRATION_HELPERS_H_ =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 extern bool got_stop; =20 diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h index c33d99af3743..712cee9b7a54 100644 --- a/tests/qtest/tpm-emu.h +++ b/tests/qtest/tpm-emu.h @@ -22,7 +22,7 @@ #include "qemu/sockets.h" #include "io/channel.h" #include "sysemu/tpm.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 struct tpm_hdr { uint16_t tag; diff --git a/tests/qtest/ac97-test.c b/tests/qtest/ac97-test.c index e09f2495d24d..b084e31bff5f 100644 --- a/tests/qtest/ac97-test.c +++ b/tests/qtest/ac97-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/ahci-test.c b/tests/qtest/ahci-test.c index aff5f3f79776..f1e510b0ac00 100644 --- a/tests/qtest/ahci-test.c +++ b/tests/qtest/ahci-test.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/libqos-pc.h" #include "libqos/ahci.h" #include "libqos/pci-pc.h" diff --git a/tests/qtest/am53c974-test.c b/tests/qtest/am53c974-test.c index d214a912b3b4..ed3ac7db20de 100644 --- a/tests/qtest/am53c974-test.c +++ b/tests/qtest/am53c974-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 =20 static void test_cmdfifo_underflow_ok(void) diff --git a/tests/qtest/arm-cpu-features.c b/tests/qtest/arm-cpu-features.c index f76652143acc..5a145273860c 100644 --- a/tests/qtest/arm-cpu-features.c +++ b/tests/qtest/arm-cpu-features.c @@ -10,7 +10,7 @@ */ #include "qemu/osdep.h" #include "qemu/bitops.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" =20 diff --git a/tests/qtest/aspeed_hace-test.c b/tests/qtest/aspeed_hace-test.c index 58aa22014d04..be0dd71df9bd 100644 --- a/tests/qtest/aspeed_hace-test.c +++ b/tests/qtest/aspeed_hace-test.c @@ -7,7 +7,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/bitops.h" =20 #define HACE_CMD 0x10 diff --git a/tests/qtest/boot-order-test.c b/tests/qtest/boot-order-test.c index f1f59b1261fe..0680d79d6da3 100644 --- a/tests/qtest/boot-order-test.c +++ b/tests/qtest/boot-order-test.c @@ -12,7 +12,7 @@ =20 #include "qemu/osdep.h" #include "libqos/fw_cfg.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "standard-headers/linux/qemu_fw_cfg.h" =20 diff --git a/tests/qtest/boot-sector.c b/tests/qtest/boot-sector.c index 9d9825bc8145..44a109abd8f0 100644 --- a/tests/qtest/boot-sector.c +++ b/tests/qtest/boot-sector.c @@ -12,7 +12,7 @@ */ #include "qemu/osdep.h" #include "boot-sector.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #define LOW(x) ((x) & 0xff) #define HIGH(x) ((x) >> 8) diff --git a/tests/qtest/boot-serial-test.c b/tests/qtest/boot-serial-test.c index d72a82d6292e..2f99d71cab35 100644 --- a/tests/qtest/boot-serial-test.c +++ b/tests/qtest/boot-serial-test.c @@ -14,7 +14,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/libqos-spapr.h" =20 static const uint8_t bios_avr[] =3D { diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c index fdd889a487db..a7766a9e6571 100644 --- a/tests/qtest/cdrom-test.c +++ b/tests/qtest/cdrom-test.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "boot-sector.h" #include "qapi/qmp/qdict.h" =20 diff --git a/tests/qtest/dbus-display-test.c b/tests/qtest/dbus-display-tes= t.c index 81043162dfdd..8be597476315 100644 --- a/tests/qtest/dbus-display-test.c +++ b/tests/qtest/dbus-display-test.c @@ -2,7 +2,7 @@ #include "qemu/dbus.h" #include #include -#include "libqos/libqtest.h" +#include "libqtest.h" #include "dbus-display1.h" =20 static GDBusConnection* diff --git a/tests/qtest/dbus-vmstate-test.c b/tests/qtest/dbus-vmstate-tes= t.c index a8acab763f5d..74ede651f63d 100644 --- a/tests/qtest/dbus-vmstate-test.c +++ b/tests/qtest/dbus-vmstate-test.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include #include -#include "libqos/libqtest.h" +#include "libqtest.h" #include "dbus-vmstate1.h" #include "migration-helpers.h" =20 diff --git a/tests/qtest/device-introspect-test.c b/tests/qtest/device-intr= ospect-test.c index adf39b2518e8..5b0ffe43f5f4 100644 --- a/tests/qtest/device-introspect-test.c +++ b/tests/qtest/device-introspect-test.c @@ -21,7 +21,7 @@ #include "qapi/qmp/qstring.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 const char common_args[] =3D "-nodefaults -machine none"; =20 diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c index 404a92e1328a..2e3137843e37 100644 --- a/tests/qtest/device-plug-test.c +++ b/tests/qtest/device-plug-test.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qstring.h" =20 diff --git a/tests/qtest/drive_del-test.c b/tests/qtest/drive_del-test.c index 0cc18dfa4aae..5e6d58b4dd26 100644 --- a/tests/qtest/drive_del-test.c +++ b/tests/qtest/drive_del-test.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/virtio.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" diff --git a/tests/qtest/ds1338-test.c b/tests/qtest/ds1338-test.c index c5d46bcc643d..f6ade9a050fb 100644 --- a/tests/qtest/ds1338-test.c +++ b/tests/qtest/ds1338-test.c @@ -18,7 +18,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/i2c.h" =20 #define DS1338_ADDR 0x68 diff --git a/tests/qtest/e1000-test.c b/tests/qtest/e1000-test.c index ea286d179304..c387984ef6d6 100644 --- a/tests/qtest/e1000-test.c +++ b/tests/qtest/e1000-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/eepro100-test.c b/tests/qtest/eepro100-test.c index d72ad099f1eb..8dbffff0b81b 100644 --- a/tests/qtest/eepro100-test.c +++ b/tests/qtest/eepro100-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/endianness-test.c b/tests/qtest/endianness-test.c index 2f5a88bf4ce5..222d116fae2d 100644 --- a/tests/qtest/endianness-test.c +++ b/tests/qtest/endianness-test.c @@ -13,7 +13,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/bswap.h" =20 typedef struct TestCase TestCase; diff --git a/tests/qtest/erst-test.c b/tests/qtest/erst-test.c index a0adc35bef7f..4e768a126f6a 100644 --- a/tests/qtest/erst-test.c +++ b/tests/qtest/erst-test.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" #include #include "libqos/libqos-pc.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #include "hw/pci/pci.h" =20 diff --git a/tests/qtest/es1370-test.c b/tests/qtest/es1370-test.c index 2fd7fd2d3d30..adccdac1be57 100644 --- a/tests/qtest/es1370-test.c +++ b/tests/qtest/es1370-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/fuzz-e1000e-test.c b/tests/qtest/fuzz-e1000e-test.c index 66229e60964a..5052883fb6a8 100644 --- a/tests/qtest/fuzz-e1000e-test.c +++ b/tests/qtest/fuzz-e1000e-test.c @@ -8,7 +8,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * https://bugs.launchpad.net/qemu/+bug/1879531 diff --git a/tests/qtest/fuzz-lsi53c895a-test.c b/tests/qtest/fuzz-lsi53c89= 5a-test.c index 031d9de2419b..2e8e67859efb 100644 --- a/tests/qtest/fuzz-lsi53c895a-test.c +++ b/tests/qtest/fuzz-lsi53c895a-test.c @@ -6,7 +6,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * This used to trigger the assert in lsi_do_dma() diff --git a/tests/qtest/fuzz-megasas-test.c b/tests/qtest/fuzz-megasas-tes= t.c index 129b182f830c..287fe19fc764 100644 --- a/tests/qtest/fuzz-megasas-test.c +++ b/tests/qtest/fuzz-megasas-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * This used to trigger the assert in scsi_dma_complete diff --git a/tests/qtest/fuzz-sb16-test.c b/tests/qtest/fuzz-sb16-test.c index 91fdcd1e8a0f..a65826b94378 100644 --- a/tests/qtest/fuzz-sb16-test.c +++ b/tests/qtest/fuzz-sb16-test.c @@ -7,7 +7,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * This used to trigger the assert in audio_calloc diff --git a/tests/qtest/fuzz-sdcard-test.c b/tests/qtest/fuzz-sdcard-test.c index d0f4e0e93c0b..e7fd818148e8 100644 --- a/tests/qtest/fuzz-sdcard-test.c +++ b/tests/qtest/fuzz-sdcard-test.c @@ -7,7 +7,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * https://gitlab.com/qemu-project/qemu/-/issues/450 diff --git a/tests/qtest/fuzz-virtio-scsi-test.c b/tests/qtest/fuzz-virtio-= scsi-test.c index c9b6fe21231d..71c91b03568d 100644 --- a/tests/qtest/fuzz-virtio-scsi-test.c +++ b/tests/qtest/fuzz-virtio-scsi-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * Here a MemoryRegionCache pointed to an MMIO region but had a diff --git a/tests/qtest/fuzz-xlnx-dp-test.c b/tests/qtest/fuzz-xlnx-dp-tes= t.c index 69eb6c0eb104..51e9a373002c 100644 --- a/tests/qtest/fuzz-xlnx-dp-test.c +++ b/tests/qtest/fuzz-xlnx-dp-test.c @@ -7,7 +7,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * This used to trigger the out-of-bounds read in xlnx_dp_read diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 5f77c849837f..a7a5e14fa3bc 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -21,7 +21,7 @@ #include "sysemu/runstate.h" #include "qemu/main-loop.h" #include "qemu/rcu.h" -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/qgraph.h" #include "fuzz.h" =20 diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuz= z.c index bce83604825e..25df19fd5af3 100644 --- a/tests/qtest/fuzz/generic_fuzz.c +++ b/tests/qtest/fuzz/generic_fuzz.c @@ -15,7 +15,7 @@ #include =20 #include "hw/core/cpu.h" -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/pci-pc.h" #include "fuzz.h" #include "fork_fuzz.h" diff --git a/tests/qtest/fuzz/i440fx_fuzz.c b/tests/qtest/fuzz/i440fx_fuzz.c index 86796bff2bca..b17fc725dfd6 100644 --- a/tests/qtest/fuzz/i440fx_fuzz.c +++ b/tests/qtest/fuzz/i440fx_fuzz.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" =20 #include "qemu/main-loop.h" -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/pci.h" #include "tests/qtest/libqos/pci-pc.h" #include "fuzz.h" diff --git a/tests/qtest/fuzz/qos_fuzz.c b/tests/qtest/fuzz/qos_fuzz.c index dc891d838b6a..c856d3d500e8 100644 --- a/tests/qtest/fuzz/qos_fuzz.c +++ b/tests/qtest/fuzz/qos_fuzz.c @@ -22,7 +22,7 @@ #include "exec/memory.h" #include "qemu/main-loop.h" =20 -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/malloc.h" #include "tests/qtest/libqos/qgraph.h" #include "tests/qtest/libqos/qgraph_internal.h" diff --git a/tests/qtest/fuzz/virtio_blk_fuzz.c b/tests/qtest/fuzz/virtio_b= lk_fuzz.c index 623a756fd472..236d078cc862 100644 --- a/tests/qtest/fuzz/virtio_blk_fuzz.c +++ b/tests/qtest/fuzz/virtio_blk_fuzz.c @@ -11,7 +11,7 @@ =20 #include "qemu/osdep.h" =20 -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/virtio-blk.h" #include "tests/qtest/libqos/virtio.h" #include "tests/qtest/libqos/virtio-pci.h" diff --git a/tests/qtest/fuzz/virtio_net_fuzz.c b/tests/qtest/fuzz/virtio_n= et_fuzz.c index 0e873ab8e25f..3df78d9c1c2a 100644 --- a/tests/qtest/fuzz/virtio_net_fuzz.c +++ b/tests/qtest/fuzz/virtio_net_fuzz.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" =20 #include "standard-headers/linux/virtio_config.h" -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/virtio-net.h" #include "fuzz.h" #include "fork_fuzz.h" diff --git a/tests/qtest/fuzz/virtio_scsi_fuzz.c b/tests/qtest/fuzz/virtio_= scsi_fuzz.c index 6ff6fabe4ad3..b3220ef6cb20 100644 --- a/tests/qtest/fuzz/virtio_scsi_fuzz.c +++ b/tests/qtest/fuzz/virtio_scsi_fuzz.c @@ -12,7 +12,7 @@ =20 #include "qemu/osdep.h" =20 -#include "tests/qtest/libqos/libqtest.h" +#include "tests/qtest/libqtest.h" #include "tests/qtest/libqos/virtio-scsi.h" #include "tests/qtest/libqos/virtio.h" #include "tests/qtest/libqos/virtio-pci.h" diff --git a/tests/qtest/fw_cfg-test.c b/tests/qtest/fw_cfg-test.c index 95b3907c18c4..5dc807ba2385 100644 --- a/tests/qtest/fw_cfg-test.c +++ b/tests/qtest/fw_cfg-test.c @@ -12,7 +12,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "standard-headers/linux/qemu_fw_cfg.h" #include "libqos/fw_cfg.h" #include "qemu/bswap.h" diff --git a/tests/qtest/hd-geo-test.c b/tests/qtest/hd-geo-test.c index da9c4c2792de..413cf964c05b 100644 --- a/tests/qtest/hd-geo-test.c +++ b/tests/qtest/hd-geo-test.c @@ -18,7 +18,7 @@ #include "qemu/osdep.h" #include "qemu/bswap.h" #include "qapi/qmp/qlist.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/fw_cfg.h" #include "libqos/libqos.h" #include "standard-headers/linux/qemu_fw_cfg.h" diff --git a/tests/qtest/hexloader-test.c b/tests/qtest/hexloader-test.c index 561502052a67..8b7aa2d72d0d 100644 --- a/tests/qtest/hexloader-test.c +++ b/tests/qtest/hexloader-test.c @@ -10,7 +10,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* Load 'test.hex' and verify that the in-memory contents are as expected. * 'test.hex' is a memory test pattern stored in Hexadecimal Object diff --git a/tests/qtest/ide-test.c b/tests/qtest/ide-test.c index b7243a17b11d..5bcb75a7e53d 100644 --- a/tests/qtest/ide-test.c +++ b/tests/qtest/ide-test.c @@ -25,7 +25,7 @@ #include "qemu/osdep.h" =20 =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/libqos.h" #include "libqos/pci-pc.h" #include "libqos/malloc-pc.h" diff --git a/tests/qtest/ipoctal232-test.c b/tests/qtest/ipoctal232-test.c index 65ce10b81bef..53a8c9b13ce5 100644 --- a/tests/qtest/ipoctal232-test.c +++ b/tests/qtest/ipoctal232-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" =20 diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index 95628a418579..bfc91d1719d2 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -13,7 +13,7 @@ #include "contrib/ivshmem-server/ivshmem-server.h" #include "libqos/libqos-pc.h" #include "libqos/libqos-spapr.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #define TMPSHMSIZE (1 << 20) static char *tmpshm; diff --git a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c b/tests/qtest= /libqos/aarch64-xlnx-zcu102-machine.c index 79631cc7a9ad..c8a3ea11eb40 100644 --- a/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c +++ b/tests/qtest/libqos/aarch64-xlnx-zcu102-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c index 41c4be5efa93..f53f12aa9965 100644 --- a/tests/qtest/libqos/ahci.c +++ b/tests/qtest/libqos/ahci.c @@ -24,7 +24,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqtest.h" +#include "../libqtest.h" #include "ahci.h" #include "pci-pc.h" =20 diff --git a/tests/qtest/libqos/arm-imx25-pdk-machine.c b/tests/qtest/libqo= s/arm-imx25-pdk-machine.c index 6692adfa4fcb..54d0c9533044 100644 --- a/tests/qtest/libqos/arm-imx25-pdk-machine.c +++ b/tests/qtest/libqos/arm-imx25-pdk-machine.c @@ -19,7 +19,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "malloc.h" #include "qgraph.h" #include "i2c.h" diff --git a/tests/qtest/libqos/arm-n800-machine.c b/tests/qtest/libqos/arm= -n800-machine.c index ff2049c3a7eb..ecd46b1dafa0 100644 --- a/tests/qtest/libqos/arm-n800-machine.c +++ b/tests/qtest/libqos/arm-n800-machine.c @@ -19,7 +19,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "malloc.h" #include "qgraph.h" #include "i2c.h" diff --git a/tests/qtest/libqos/arm-raspi2-machine.c b/tests/qtest/libqos/a= rm-raspi2-machine.c index 09ca863c1030..0a2943440b28 100644 --- a/tests/qtest/libqos/arm-raspi2-machine.c +++ b/tests/qtest/libqos/arm-raspi2-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/arm-sabrelite-machine.c b/tests/qtest/libqo= s/arm-sabrelite-machine.c index 72425f0ad404..ec19a01660c0 100644 --- a/tests/qtest/libqos/arm-sabrelite-machine.c +++ b/tests/qtest/libqos/arm-sabrelite-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/arm-smdkc210-machine.c b/tests/qtest/libqos= /arm-smdkc210-machine.c index 321b8826d4a2..4bff249ee89a 100644 --- a/tests/qtest/libqos/arm-smdkc210-machine.c +++ b/tests/qtest/libqos/arm-smdkc210-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/arm-virt-machine.c b/tests/qtest/libqos/arm= -virt-machine.c index e0f59322845a..2e0beaefb8d7 100644 --- a/tests/qtest/libqos/arm-virt-machine.c +++ b/tests/qtest/libqos/arm-virt-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c b/tests/qtest/= libqos/arm-xilinx-zynq-a9-machine.c index 56e53c745bff..3be80020a6bc 100644 --- a/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c +++ b/tests/qtest/libqos/arm-xilinx-zynq-a9-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "malloc.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/e1000e.c b/tests/qtest/libqos/e1000e.c index a451f6168f63..f87e0e84b2aa 100644 --- a/tests/qtest/libqos/e1000e.c +++ b/tests/qtest/libqos/e1000e.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "pci-pc.h" #include "qemu/sockets.h" #include "qemu/iov.h" diff --git a/tests/qtest/libqos/fw_cfg.c b/tests/qtest/libqos/fw_cfg.c index 6b8e1babe51e..89f053ccacbd 100644 --- a/tests/qtest/libqos/fw_cfg.c +++ b/tests/qtest/libqos/fw_cfg.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" #include "fw_cfg.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/bswap.h" #include "hw/nvram/fw_cfg.h" =20 diff --git a/tests/qtest/libqos/i2c-imx.c b/tests/qtest/libqos/i2c-imx.c index 8f9a7e383146..710cb926d62b 100644 --- a/tests/qtest/libqos/i2c-imx.c +++ b/tests/qtest/libqos/i2c-imx.c @@ -21,7 +21,7 @@ #include "i2c.h" =20 =20 -#include "libqtest.h" +#include "../libqtest.h" =20 #include "hw/i2c/imx_i2c.h" =20 diff --git a/tests/qtest/libqos/i2c-omap.c b/tests/qtest/libqos/i2c-omap.c index eb4e453485db..6f98f54820be 100644 --- a/tests/qtest/libqos/i2c-omap.c +++ b/tests/qtest/libqos/i2c-omap.c @@ -11,7 +11,7 @@ =20 =20 #include "qemu/bswap.h" -#include "libqtest.h" +#include "../libqtest.h" =20 enum OMAPI2CRegisters { OMAP_I2C_REV =3D 0x00, diff --git a/tests/qtest/libqos/i2c.c b/tests/qtest/libqos/i2c.c index ade1bdb40e05..1a54c004eb41 100644 --- a/tests/qtest/libqos/i2c.c +++ b/tests/qtest/libqos/i2c.c @@ -8,7 +8,7 @@ */ #include "qemu/osdep.h" #include "i2c.h" -#include "libqtest.h" +#include "../libqtest.h" =20 void qi2c_send(QI2CDevice *i2cdev, const uint8_t *buf, uint16_t len) { diff --git a/tests/qtest/libqos/libqos.c b/tests/qtest/libqos/libqos.c index 2251e864efe1..85c7641add1b 100644 --- a/tests/qtest/libqos/libqos.c +++ b/tests/qtest/libqos/libqos.c @@ -1,7 +1,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqtest.h" +#include "../libqtest.h" #include "libqos.h" #include "pci.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/libqos/pci-pc.c b/tests/qtest/libqos/pci-pc.c index f97844289f13..e9dd5a57ec55 100644 --- a/tests/qtest/libqos/pci-pc.c +++ b/tests/qtest/libqos/pci-pc.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "pci-pc.h" #include "qapi/qmp/qdict.h" #include "hw/pci/pci_regs.h" diff --git a/tests/qtest/libqos/pci-spapr.c b/tests/qtest/libqos/pci-spapr.c index 262226985f37..76bf9a855d5c 100644 --- a/tests/qtest/libqos/pci-spapr.c +++ b/tests/qtest/libqos/pci-spapr.c @@ -6,7 +6,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "pci-spapr.h" #include "rtas.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/ppc64_pseries-machine.c b/tests/qtest/libqo= s/ppc64_pseries-machine.c index 24ca1799765f..364e9c689bb9 100644 --- a/tests/qtest/libqos/ppc64_pseries-machine.c +++ b/tests/qtest/libqos/ppc64_pseries-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qgraph.h" #include "pci-spapr.h" #include "qemu/module.h" diff --git a/tests/qtest/libqos/qgraph.c b/tests/qtest/libqos/qgraph.c index 109ff04e1e8f..0a2dddfafa4f 100644 --- a/tests/qtest/libqos/qgraph.c +++ b/tests/qtest/libqos/qgraph.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/queue.h" #include "qgraph_internal.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/qos_external.c b/tests/qtest/libqos/qos_ext= ernal.c index 10ee0f75b288..b7a0b873a362 100644 --- a/tests/qtest/libqos/qos_external.c +++ b/tests/qtest/libqos/qos_external.c @@ -18,7 +18,7 @@ =20 #include "qemu/osdep.h" #include -#include "libqtest.h" +#include "../libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qbool.h" #include "qapi/qmp/qstring.h" diff --git a/tests/qtest/libqos/rtas.c b/tests/qtest/libqos/rtas.c index db29d5554dcb..dedbfb4cb3a6 100644 --- a/tests/qtest/libqos/rtas.c +++ b/tests/qtest/libqos/rtas.c @@ -4,7 +4,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "rtas.h" =20 static void qrtas_copy_args(QTestState *qts, uint64_t target_args, diff --git a/tests/qtest/libqos/sdhci-cmd.c b/tests/qtest/libqos/sdhci-cmd.c index 2d9e51834114..a6f073ac1ac9 100644 --- a/tests/qtest/libqos/sdhci-cmd.c +++ b/tests/qtest/libqos/sdhci-cmd.c @@ -16,7 +16,7 @@ =20 #include "qemu/osdep.h" #include "sdhci-cmd.h" -#include "libqtest.h" +#include "../libqtest.h" =20 static ssize_t read_fifo(QTestState *qts, uint64_t reg, char *msg, size_t = count) { diff --git a/tests/qtest/libqos/sdhci.c b/tests/qtest/libqos/sdhci.c index 65f0d07fc5ac..71696980f83e 100644 --- a/tests/qtest/libqos/sdhci.c +++ b/tests/qtest/libqos/sdhci.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qgraph.h" #include "pci.h" #include "qemu/module.h" diff --git a/tests/qtest/libqos/tpci200.c b/tests/qtest/libqos/tpci200.c index 1787b1f188d3..8b0060324728 100644 --- a/tests/qtest/libqos/tpci200.c +++ b/tests/qtest/libqos/tpci200.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "pci.h" diff --git a/tests/qtest/libqos/usb.c b/tests/qtest/libqos/usb.c index 8b45b0298446..446fdb5796c4 100644 --- a/tests/qtest/libqos/usb.c +++ b/tests/qtest/libqos/usb.c @@ -12,7 +12,7 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "hw/usb/uhci-regs.h" #include "usb.h" =20 diff --git a/tests/qtest/libqos/vhost-user-blk.c b/tests/qtest/libqos/vhost= -user-blk.c index 568c3426ed3a..2f3c9cb5336d 100644 --- a/tests/qtest/libqos/vhost-user-blk.c +++ b/tests/qtest/libqos/vhost-user-blk.c @@ -21,7 +21,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_blk.h" #include "vhost-user-blk.h" diff --git a/tests/qtest/libqos/virtio-9p.c b/tests/qtest/libqos/virtio-9p.c index f51f0635cc0c..70aea8bf6287 100644 --- a/tests/qtest/libqos/virtio-9p.c +++ b/tests/qtest/libqos/virtio-9p.c @@ -22,7 +22,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_ids.h" #include "virtio-9p.h" diff --git a/tests/qtest/libqos/virtio-balloon.c b/tests/qtest/libqos/virti= o-balloon.c index a3da5c234d49..29b5d175845a 100644 --- a/tests/qtest/libqos/virtio-balloon.c +++ b/tests/qtest/libqos/virtio-balloon.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "virtio-balloon.h" diff --git a/tests/qtest/libqos/virtio-blk.c b/tests/qtest/libqos/virtio-bl= k.c index 5da02591bcc2..ee4943f32b99 100644 --- a/tests/qtest/libqos/virtio-blk.c +++ b/tests/qtest/libqos/virtio-blk.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_blk.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/virtio-iommu.c b/tests/qtest/libqos/virtio-= iommu.c index 18cba4ca36b6..afc7d14e9a60 100644 --- a/tests/qtest/libqos/virtio-iommu.c +++ b/tests/qtest/libqos/virtio-iommu.c @@ -12,7 +12,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "virtio-iommu.h" diff --git a/tests/qtest/libqos/virtio-mmio.c b/tests/qtest/libqos/virtio-m= mio.c index 75efda30299a..a6cca8613b2c 100644 --- a/tests/qtest/libqos/virtio-mmio.c +++ b/tests/qtest/libqos/virtio-mmio.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "virtio.h" #include "virtio-mmio.h" diff --git a/tests/qtest/libqos/virtio-net.c b/tests/qtest/libqos/virtio-ne= t.c index 1cae07f60d6c..2ac73ac0b416 100644 --- a/tests/qtest/libqos/virtio-net.c +++ b/tests/qtest/libqos/virtio-net.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "virtio-net.h" diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pc= i.c index cd3c0f5bf335..67c2498c84af 100644 --- a/tests/qtest/libqos/virtio-pci.c +++ b/tests/qtest/libqos/virtio-pci.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "virtio.h" #include "virtio-pci.h" #include "pci.h" diff --git a/tests/qtest/libqos/virtio-rng.c b/tests/qtest/libqos/virtio-rn= g.c index 2e09dd7c48cb..078e3abaa72a 100644 --- a/tests/qtest/libqos/virtio-rng.c +++ b/tests/qtest/libqos/virtio-rng.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "virtio-rng.h" diff --git a/tests/qtest/libqos/virtio-scsi.c b/tests/qtest/libqos/virtio-s= csi.c index 5644e32fc319..c4d046142012 100644 --- a/tests/qtest/libqos/virtio-scsi.c +++ b/tests/qtest/libqos/virtio-scsi.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "standard-headers/linux/virtio_ids.h" #include "qgraph.h" diff --git a/tests/qtest/libqos/virtio-serial.c b/tests/qtest/libqos/virtio= -serial.c index ee34afd95ad8..1d689c3e38fc 100644 --- a/tests/qtest/libqos/virtio-serial.c +++ b/tests/qtest/libqos/virtio-serial.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qemu/module.h" #include "qgraph.h" #include "virtio-serial.h" diff --git a/tests/qtest/libqos/virtio.c b/tests/qtest/libqos/virtio.c index fba918665951..09ec09b655cd 100644 --- a/tests/qtest/libqos/virtio.c +++ b/tests/qtest/libqos/virtio.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" #include "qemu/bswap.h" -#include "libqtest.h" +#include "../libqtest.h" #include "virtio.h" #include "standard-headers/linux/virtio_config.h" #include "standard-headers/linux/virtio_ring.h" diff --git a/tests/qtest/libqos/x86_64_pc-machine.c b/tests/qtest/libqos/x8= 6_64_pc-machine.c index ad96742a92d6..dce0c9463a47 100644 --- a/tests/qtest/libqos/x86_64_pc-machine.c +++ b/tests/qtest/libqos/x86_64_pc-machine.c @@ -17,7 +17,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqtest.h" +#include "../libqtest.h" #include "qgraph.h" #include "pci-pc.h" #include "qemu/module.h" diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index 5098d71485cc..aaf5ab0ca533 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -20,7 +20,7 @@ #include #include =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qapi/error.h" diff --git a/tests/qtest/lpc-ich9-test.c b/tests/qtest/lpc-ich9-test.c index fe0bef998075..8ac95b89f729 100644 --- a/tests/qtest/lpc-ich9-test.c +++ b/tests/qtest/lpc-ich9-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 static void test_lp1878642_pci_bus_get_irq_level_assert(void) { diff --git a/tests/qtest/m48t59-test.c b/tests/qtest/m48t59-test.c index 6db3234100a3..b94a1230f7fd 100644 --- a/tests/qtest/m48t59-test.c +++ b/tests/qtest/m48t59-test.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #define RTC_SECONDS 0x9 #define RTC_MINUTES 0xa diff --git a/tests/qtest/machine-none-test.c b/tests/qtest/machine-none-tes= t.c index 8ca18074b9f9..d0f8cd990245 100644 --- a/tests/qtest/machine-none-test.c +++ b/tests/qtest/machine-none-test.c @@ -13,7 +13,7 @@ #include "qemu/osdep.h" =20 #include "qemu/cutils.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" =20 =20 diff --git a/tests/qtest/megasas-test.c b/tests/qtest/megasas-test.c index eae70ff95f9c..d6796b9bd74d 100644 --- a/tests/qtest/megasas-test.c +++ b/tests/qtest/megasas-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/bswap.h" #include "qemu/module.h" #include "libqos/qgraph.h" diff --git a/tests/qtest/microbit-test.c b/tests/qtest/microbit-test.c index 2b255579dfdd..04e199ec33f4 100644 --- a/tests/qtest/microbit-test.c +++ b/tests/qtest/microbit-test.c @@ -16,7 +16,7 @@ =20 #include "qemu/osdep.h" #include "exec/hwaddr.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #include "hw/arm/nrf51.h" #include "hw/char/nrf51_uart.h" diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 2af36c16a371..cba6023eb500 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -12,7 +12,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qemu/module.h" diff --git a/tests/qtest/modules-test.c b/tests/qtest/modules-test.c index c238b3f42216..88217686e14e 100644 --- a/tests/qtest/modules-test.c +++ b/tests/qtest/modules-test.c @@ -1,5 +1,5 @@ #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 const char common_args[] =3D "-nodefaults -machine none"; =20 diff --git a/tests/qtest/ne2000-test.c b/tests/qtest/ne2000-test.c index 43cfc4535aab..3fc0e555d5e2 100644 --- a/tests/qtest/ne2000-test.c +++ b/tests/qtest/ne2000-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/npcm7xx_adc-test.c b/tests/qtest/npcm7xx_adc-test.c index 5ce8ce13b3d7..3fa6d9ece0bd 100644 --- a/tests/qtest/npcm7xx_adc-test.c +++ b/tests/qtest/npcm7xx_adc-test.c @@ -17,7 +17,7 @@ #include "qemu/osdep.h" #include "qemu/bitops.h" #include "qemu/timer.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" =20 #define REF_HZ (25000000) diff --git a/tests/qtest/npcm7xx_pwm-test.c b/tests/qtest/npcm7xx_pwm-test.c index a54fd70d273b..c4a5fdcacd79 100644 --- a/tests/qtest/npcm7xx_pwm-test.c +++ b/tests/qtest/npcm7xx_pwm-test.c @@ -16,7 +16,7 @@ =20 #include "qemu/osdep.h" #include "qemu/bitops.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qnum.h" =20 diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-t= est.c index c1f496fb29bb..aa35a77e8d37 100644 --- a/tests/qtest/npcm7xx_sdhci-test.c +++ b/tests/qtest/npcm7xx_sdhci-test.c @@ -17,7 +17,7 @@ #include "qemu/osdep.h" #include "hw/sd/npcm7xx_sdhci.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqtest-single.h" #include "libqos/sdhci-cmd.h" =20 diff --git a/tests/qtest/npcm7xx_smbus-test.c b/tests/qtest/npcm7xx_smbus-t= est.c index 6b3038ac596f..a878cdc00142 100644 --- a/tests/qtest/npcm7xx_smbus-test.c +++ b/tests/qtest/npcm7xx_smbus-test.c @@ -17,7 +17,7 @@ #include "qemu/osdep.h" #include "qemu/bitops.h" #include "libqos/i2c.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "hw/sensor/tmp105_regs.h" =20 #define NR_SMBUS_DEVICES 16 diff --git a/tests/qtest/npcm7xx_watchdog_timer-test.c b/tests/qtest/npcm7x= x_watchdog_timer-test.c index 3aae5a043813..4773a673b207 100644 --- a/tests/qtest/npcm7xx_watchdog_timer-test.c +++ b/tests/qtest/npcm7xx_watchdog_timer-test.c @@ -17,7 +17,7 @@ #include "qemu/osdep.h" #include "qemu/timer.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" =20 #define WTCR_OFFSET 0x1c diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c index 90bf68a5b33c..749429dd27e6 100644 --- a/tests/qtest/numa-test.c +++ b/tests/qtest/numa-test.c @@ -10,7 +10,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" =20 diff --git a/tests/qtest/nvme-test.c b/tests/qtest/nvme-test.c index f8bafb5d70fb..008d189b0faf 100644 --- a/tests/qtest/nvme-test.c +++ b/tests/qtest/nvme-test.c @@ -10,7 +10,7 @@ #include "qemu/osdep.h" #include "qemu/module.h" #include "qemu/units.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/qgraph.h" #include "libqos/pci.h" #include "include/block/nvme.h" diff --git a/tests/qtest/pca9552-test.c b/tests/qtest/pca9552-test.c index 42a131266512..d80ed93cd3a5 100644 --- a/tests/qtest/pca9552-test.c +++ b/tests/qtest/pca9552-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/qgraph.h" #include "libqos/i2c.h" #include "hw/misc/pca9552_regs.h" diff --git a/tests/qtest/pci-test.c b/tests/qtest/pci-test.c index e15d4d94d1d0..4b2092b94973 100644 --- a/tests/qtest/pci-test.c +++ b/tests/qtest/pci-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/pcnet-test.c b/tests/qtest/pcnet-test.c index 7583aeb3c38f..900944fa7e34 100644 --- a/tests/qtest/pcnet-test.c +++ b/tests/qtest/pcnet-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/pflash-cfi02-test.c b/tests/qtest/pflash-cfi02-tes= t.c index 6168edc821a8..7fce614b6412 100644 --- a/tests/qtest/pflash-cfi02-test.c +++ b/tests/qtest/pflash-cfi02-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* * To test the pflash_cfi02 device, we run QEMU with the musicpal machine = with diff --git a/tests/qtest/pnv-xscom-test.c b/tests/qtest/pnv-xscom-test.c index c8d40433620a..2c46d5cf6de3 100644 --- a/tests/qtest/pnv-xscom-test.c +++ b/tests/qtest/pnv-xscom-test.c @@ -8,7 +8,7 @@ */ #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 typedef enum PnvChipType { PNV_CHIP_POWER8E, /* AKA Murano (default) */ diff --git a/tests/qtest/prom-env-test.c b/tests/qtest/prom-env-test.c index bdbb01d8e584..c2b0448e551d 100644 --- a/tests/qtest/prom-env-test.c +++ b/tests/qtest/prom-env-test.c @@ -20,7 +20,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/libqos-spapr.h" =20 #define MAGIC 0xcafec0de diff --git a/tests/qtest/pvpanic-pci-test.c b/tests/qtest/pvpanic-pci-test.c index 2358852d356f..c82c365c267d 100644 --- a/tests/qtest/pvpanic-pci-test.c +++ b/tests/qtest/pvpanic-pci-test.c @@ -12,7 +12,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" diff --git a/tests/qtest/pvpanic-test.c b/tests/qtest/pvpanic-test.c index 6dcad2db4984..bc7b7dfc39e2 100644 --- a/tests/qtest/pvpanic-test.c +++ b/tests/qtest/pvpanic-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" =20 static void test_panic_nopause(void) diff --git a/tests/qtest/pxe-test.c b/tests/qtest/pxe-test.c index 3cb47d2c5496..52f0b5c67c03 100644 --- a/tests/qtest/pxe-test.c +++ b/tests/qtest/pxe-test.c @@ -14,7 +14,7 @@ =20 #include "qemu/osdep.h" #include -#include "libqos/libqtest.h" +#include "libqtest.h" #include "boot-sector.h" #include "libqos/libqos-spapr.h" =20 diff --git a/tests/qtest/q35-test.c b/tests/qtest/q35-test.c index b7cf1449906f..c922d81bc020 100644 --- a/tests/qtest/q35-test.c +++ b/tests/qtest/q35-test.c @@ -10,7 +10,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" #include "hw/pci-host/q35.h" diff --git a/tests/qtest/qmp-cmd-test.c b/tests/qtest/qmp-cmd-test.c index 7f103ea3fd2a..056b40e67f60 100644 --- a/tests/qtest/qmp-cmd-test.c +++ b/tests/qtest/qmp-cmd-test.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/error.h" #include "qapi/qapi-visit-introspect.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/qmp-test.c b/tests/qtest/qmp-test.c index cd27fae3deb2..9a42480cef0a 100644 --- a/tests/qtest/qmp-test.c +++ b/tests/qtest/qmp-test.c @@ -11,7 +11,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/error.h" #include "qapi/qapi-visit-control.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/qom-test.c b/tests/qtest/qom-test.c index 6b162e12b5aa..7b871b2a3107 100644 --- a/tests/qtest/qom-test.c +++ b/tests/qtest/qom-test.c @@ -12,7 +12,7 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" #include "qemu/cutils.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 static void test_properties(QTestState *qts, const char *path, bool recurs= e) { diff --git a/tests/qtest/rtas-test.c b/tests/qtest/rtas-test.c index 5f1194a6eb53..50df60e5b20e 100644 --- a/tests/qtest/rtas-test.c +++ b/tests/qtest/rtas-test.c @@ -1,6 +1,6 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 #include "libqos/libqos-spapr.h" #include "libqos/rtas.h" diff --git a/tests/qtest/sdhci-test.c b/tests/qtest/sdhci-test.c index a110cfe3219c..6275e7626c21 100644 --- a/tests/qtest/sdhci-test.c +++ b/tests/qtest/sdhci-test.c @@ -10,7 +10,7 @@ =20 #include "qemu/osdep.h" #include "hw/registerfields.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/pci-pc.h" #include "hw/pci/pci.h" diff --git a/tests/qtest/spapr-phb-test.c b/tests/qtest/spapr-phb-test.c index ea8d59650721..093dc22f2f41 100644 --- a/tests/qtest/spapr-phb-test.c +++ b/tests/qtest/spapr-phb-test.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" =20 diff --git a/tests/qtest/tco-test.c b/tests/qtest/tco-test.c index 47bc7ad3019d..254f7353701c 100644 --- a/tests/qtest/tco-test.c +++ b/tests/qtest/tco-test.c @@ -9,7 +9,7 @@ =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/test-filter-mirror.c b/tests/qtest/test-filter-mir= ror.c index fdf66cebd62f..c8b0a92b53b7 100644 --- a/tests/qtest/test-filter-mirror.c +++ b/tests/qtest/test-filter-mirror.c @@ -9,7 +9,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/tests/qtest/test-filter-redirector.c b/tests/qtest/test-filter= -redirector.c index 339d3c04cedc..24ca9280f814 100644 --- a/tests/qtest/test-filter-redirector.c +++ b/tests/qtest/test-filter-redirector.c @@ -51,7 +51,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/iov.h" #include "qemu/sockets.h" diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c index 413eb95d2a0c..f8b22abe4cac 100644 --- a/tests/qtest/test-hmp.c +++ b/tests/qtest/test-hmp.c @@ -15,7 +15,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 static int verbose; =20 diff --git a/tests/qtest/tpm-crb-swtpm-test.c b/tests/qtest/tpm-crb-swtpm-t= est.c index 1d82a48c04be..55fdb5657d91 100644 --- a/tests/qtest/tpm-crb-swtpm-test.c +++ b/tests/qtest/tpm-crb-swtpm-test.c @@ -15,7 +15,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "tpm-tests.h" #include "hw/acpi/tpm.h" diff --git a/tests/qtest/tpm-tis-device-swtpm-test.c b/tests/qtest/tpm-tis-= device-swtpm-test.c index f7126eff9e74..7b200351426a 100644 --- a/tests/qtest/tpm-tis-device-swtpm-test.c +++ b/tests/qtest/tpm-tis-device-swtpm-test.c @@ -16,7 +16,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "tpm-tests.h" #include "hw/acpi/tpm.h" diff --git a/tests/qtest/tpm-tis-swtpm-test.c b/tests/qtest/tpm-tis-swtpm-t= est.c index fa590e68f115..90131cb3c487 100644 --- a/tests/qtest/tpm-tis-swtpm-test.c +++ b/tests/qtest/tpm-tis-swtpm-test.c @@ -15,7 +15,7 @@ #include "qemu/osdep.h" #include =20 -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "tpm-tests.h" #include "hw/acpi/tpm.h" diff --git a/tests/qtest/tpm-util.c b/tests/qtest/tpm-util.c index 3a40ff3f96c2..e0dc5da0af1e 100644 --- a/tests/qtest/tpm-util.c +++ b/tests/qtest/tpm-util.c @@ -15,7 +15,7 @@ #include "qemu/osdep.h" =20 #include "hw/acpi/tpm.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "tpm-util.h" #include "qapi/qmp/qdict.h" =20 diff --git a/tests/qtest/tulip-test.c b/tests/qtest/tulip-test.c index da16cbfafcc2..2fb6c4d5a781 100644 --- a/tests/qtest/tulip-test.c +++ b/tests/qtest/tulip-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/virtio-net-failover.c b/tests/qtest/virtio-net-fai= lover.c index 78811f1c9216..443ee56de966 100644 --- a/tests/qtest/virtio-net-failover.c +++ b/tests/qtest/virtio-net-failover.c @@ -8,7 +8,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "libqos/pci.h" #include "libqos/pci-pc.h" #include "qapi/qmp/qdict.h" diff --git a/tests/qtest/virtio-rng-test.c b/tests/qtest/virtio-rng-test.c index e6b8cd8e0cfa..092ba130684d 100644 --- a/tests/qtest/virtio-rng-test.c +++ b/tests/qtest/virtio-rng-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/virtio-rng.h" diff --git a/tests/qtest/virtio-test.c b/tests/qtest/virtio-test.c index 63134176303a..f7c6afdcf111 100644 --- a/tests/qtest/virtio-test.c +++ b/tests/qtest/virtio-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/vmgenid-test.c b/tests/qtest/vmgenid-test.c index 6781a514479b..efba76e7164e 100644 --- a/tests/qtest/vmgenid-test.c +++ b/tests/qtest/vmgenid-test.c @@ -14,7 +14,7 @@ #include "hw/acpi/acpi-defs.h" #include "boot-sector.h" #include "acpi-utils.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" =20 #define VGID_GUID "324e6eaf-d1d1-4bf6-bf41-b9bb6c91fb87" diff --git a/tests/qtest/vmxnet3-test.c b/tests/qtest/vmxnet3-test.c index 97c23fd3a8f6..a81025252c87 100644 --- a/tests/qtest/vmxnet3-test.c +++ b/tests/qtest/vmxnet3-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qemu/module.h" #include "libqos/qgraph.h" #include "libqos/pci.h" diff --git a/tests/qtest/wdt_ib700-test.c b/tests/qtest/wdt_ib700-test.c index 6c36e43fb835..797288d939fa 100644 --- a/tests/qtest/wdt_ib700-test.c +++ b/tests/qtest/wdt_ib700-test.c @@ -8,7 +8,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" #include "qapi/qmp/qdict.h" #include "qemu/timer.h" =20 diff --git a/tests/qtest/xlnx-can-test.c b/tests/qtest/xlnx-can-test.c index 54de71a68643..89610fc499b6 100644 --- a/tests/qtest/xlnx-can-test.c +++ b/tests/qtest/xlnx-can-test.c @@ -25,7 +25,7 @@ */ =20 #include "qemu/osdep.h" -#include "libqos/libqtest.h" +#include "libqtest.h" =20 /* Base address. */ #define CAN0_BASE_ADDR 0xFF060000 diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index e17a288034bc..d6df1ee92ea1 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -4,7 +4,7 @@ #include #include =20 -#include "../qtest/libqos/libqtest.h" +#include "../qtest/libqtest.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" =20 diff --git a/scripts/oss-fuzz/output_reproducer.py b/scripts/oss-fuzz/outpu= t_reproducer.py index 3608b0600e00..e8ef76b34138 100755 --- a/scripts/oss-fuzz/output_reproducer.py +++ b/scripts/oss-fuzz/output_reproducer.py @@ -36,7 +36,7 @@ def c_header(owner): =20 #include "qemu/osdep.h" =20 -#include "libqos/libqtest.h" +#include "libqtest.h" =20 """.format(date=3Ddate.today().year, owner=3Downer) =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613049; cv=none; d=zohomail.com; s=zohoarc; b=ARrBkgjpyJF8eCaQ3WdpXRvZMmWrygbWHaHYJYITPXe1hkOp70DhyswPjHNCdvk3r4Ilt7+DMaOxuEqbzFGybszB6qdDP5b8s7Q8CCpe5lw3T4QXTrLYddqF7yamnrQ9mmxW1l/wAtQcg2LDJG7fElc7Z4bUoXOQ+rK8a2iNgRE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613049; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/B3JUrtBEqjJ+aFyAHIZ1ZXZ+Ykx206WXCymw/II6W8=; b=bFFFa+Uqdz2kkB6pTEa1I0XFbIgrUvpM1bi9hkjr3vcSoRUkzFKHnfWyI4r4VECrJgr1lplgigMfiBVvdH9FGmLH6FhQMzXvZ7JfsIZaqsZJm8PaZeXRq/8wHxYfzDX+GkSHpGPjHD9W9sIILTO0tRQOTwIjdnRjOGUOAC6PjL4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613049201160.07112094353454; Tue, 3 May 2022 14:24:09 -0700 (PDT) Received: from localhost ([::1]:35192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm008-00046Q-0K for importer@patchew.org; Tue, 03 May 2022 17:24:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44220) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyrR-000443-Az for qemu-devel@nongnu.org; Tue, 03 May 2022 16:11:05 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60531) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyrN-0002XA-TO for qemu-devel@nongnu.org; Tue, 03 May 2022 16:11:04 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-32-yhVacArmPkqW9ObOH7qHZA-1; Tue, 03 May 2022 11:37:31 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 284283CF0ABF; Tue, 3 May 2022 13:00:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 78FA940D282C; Tue, 3 May 2022 13:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608661; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/B3JUrtBEqjJ+aFyAHIZ1ZXZ+Ykx206WXCymw/II6W8=; b=RA+YwqokmRoBV5BiRnJ0xQpET3TKaCX7P/ck2eGBu88IC2euaB/zs+UrfyECOQOIaBNMU6 ff7PGsHJ8Sw963VGBmvqMEW4SfvW8z+X5melBq6mvXryXItJEoUN57SU+pKUYqfQEBQZKh 9+pQaPYLz8nJlvC8apItEpEuyRR7pMk= X-MC-Unique: yhVacArmPkqW9ObOH7qHZA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 04/23] libqtest: split QMP part in libqmp Date: Tue, 3 May 2022 17:00:04 +0400 Message-Id: <20220503130023.180544-5-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613049659100001 From: Marc-Andr=C3=A9 Lureau This will help moving QAPI/QMP in a common subproject. Signed-off-by: Marc-Andr=C3=A9 Lureau Acked-by: Thomas Huth --- tests/qtest/libqmp.h | 50 +++++++ tests/qtest/libqtest.h | 29 +--- tests/qtest/libqmp.c | 233 +++++++++++++++++++++++++++++++++ tests/qtest/libqtest.c | 205 +---------------------------- tests/qtest/libqos/meson.build | 5 +- tests/unit/meson.build | 2 +- 6 files changed, 290 insertions(+), 234 deletions(-) create mode 100644 tests/qtest/libqmp.h create mode 100644 tests/qtest/libqmp.c diff --git a/tests/qtest/libqmp.h b/tests/qtest/libqmp.h new file mode 100644 index 000000000000..94aa97328a17 --- /dev/null +++ b/tests/qtest/libqmp.h @@ -0,0 +1,50 @@ +/* + * libqmp test unit + * + * Copyright IBM, Corp. 2012 + * Copyright Red Hat, Inc. 2012 + * Copyright SUSE LINUX Products GmbH 2013 + * + * Authors: + * Anthony Liguori + * Paolo Bonzini + * Andreas F=C3=A4rber + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + * + */ +#ifndef LIBQMP_H_ +#define LIBQMP_H_ + +#include "qapi/qmp/qdict.h" + +QDict *qmp_fd_receive(int fd); +void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, + const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0); +void qmp_fd_vsend(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); +void qmp_fd_send(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); +void qmp_fd_send_raw(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); +void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2= , 0); +QDict *qmp_fdv(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); +QDict *qmp_fd(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); + +/** + * qmp_rsp_is_err: + * @rsp: QMP response to check for error + * + * Test @rsp for error and discard @rsp. + * Returns 'true' if there is error in @rsp and 'false' otherwise. + */ +bool qmp_rsp_is_err(QDict *rsp); + +/** + * qmp_expect_error_and_unref: + * @rsp: QMP response to check for error + * @class: an error class + * + * Assert the response has the given error class and discard @rsp. + */ +void qmp_expect_error_and_unref(QDict *rsp, const char *class); + +#endif /* LIBQMP_H_ */ diff --git a/tests/qtest/libqtest.h b/tests/qtest/libqtest.h index 552667f17e37..4ab0cad3266d 100644 --- a/tests/qtest/libqtest.h +++ b/tests/qtest/libqtest.h @@ -19,6 +19,7 @@ =20 #include "qapi/qmp/qobject.h" #include "qapi/qmp/qdict.h" +#include "libqmp.h" =20 typedef struct QTestState QTestState; =20 @@ -690,16 +691,6 @@ void qtest_remove_abrt_handler(void *data); void qtest_qmp_assert_success(QTestState *qts, const char *fmt, ...) G_GNUC_PRINTF(2, 3); =20 -QDict *qmp_fd_receive(int fd); -void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, - const char *fmt, va_list ap) G_GNUC_PRINTF(4, 0); -void qmp_fd_vsend(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); -void qmp_fd_send(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void qmp_fd_send_raw(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); -void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2= , 0); -QDict *qmp_fdv(int fd, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); -QDict *qmp_fd(int fd, const char *fmt, ...) G_GNUC_PRINTF(2, 3); - /** * qtest_cb_for_every_machine: * @cb: Pointer to the callback function @@ -771,24 +762,6 @@ void qtest_qmp_add_client(QTestState *qts, const char = *protocol, int fd); */ void qtest_qmp_device_del(QTestState *qts, const char *id); =20 -/** - * qmp_rsp_is_err: - * @rsp: QMP response to check for error - * - * Test @rsp for error and discard @rsp. - * Returns 'true' if there is error in @rsp and 'false' otherwise. - */ -bool qmp_rsp_is_err(QDict *rsp); - -/** - * qmp_expect_error_and_unref: - * @rsp: QMP response to check for error - * @class: an error class - * - * Assert the response has the given error class and discard @rsp. - */ -void qmp_expect_error_and_unref(QDict *rsp, const char *class); - /** * qtest_probe_child: * @s: QTestState instance to operate on. diff --git a/tests/qtest/libqmp.c b/tests/qtest/libqmp.c new file mode 100644 index 000000000000..0358b8313dc4 --- /dev/null +++ b/tests/qtest/libqmp.c @@ -0,0 +1,233 @@ +/* + * QTest + * + * Copyright IBM, Corp. 2012 + * Copyright Red Hat, Inc. 2012 + * Copyright SUSE LINUX Products GmbH 2013 + * + * Authors: + * Anthony Liguori + * Paolo Bonzini + * Andreas F=C3=A4rber + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "libqmp.h" + +#include "qapi/error.h" +#include "qapi/qmp/json-parser.h" +#include "qapi/qmp/qjson.h" + +#define SOCKET_MAX_FDS 16 + +typedef struct { + JSONMessageParser parser; + QDict *response; +} QMPResponseParser; + +static void socket_send(int fd, const char *buf, size_t size) +{ + size_t res =3D qemu_write_full(fd, buf, size); + + assert(res =3D=3D size); +} + +static void qmp_response(void *opaque, QObject *obj, Error *err) +{ + QMPResponseParser *qmp =3D opaque; + + assert(!obj !=3D !err); + + if (err) { + error_prepend(&err, "QMP JSON response parsing failed: "); + error_report_err(err); + abort(); + } + + g_assert(!qmp->response); + qmp->response =3D qobject_to(QDict, obj); + g_assert(qmp->response); +} + +QDict *qmp_fd_receive(int fd) +{ + QMPResponseParser qmp; + bool log =3D getenv("QTEST_LOG") !=3D NULL; + + qmp.response =3D NULL; + json_message_parser_init(&qmp.parser, qmp_response, &qmp, NULL); + while (!qmp.response) { + ssize_t len; + char c; + + len =3D read(fd, &c, 1); + if (len =3D=3D -1 && errno =3D=3D EINTR) { + continue; + } + + if (len =3D=3D -1 || len =3D=3D 0) { + fprintf(stderr, "Broken pipe\n"); + abort(); + } + + if (log) { + g_assert(write(2, &c, 1) =3D=3D 1); + } + json_message_parser_feed(&qmp.parser, &c, 1); + } + if (log) { + g_assert(write(2, "\n", 1) =3D=3D 1); + } + json_message_parser_destroy(&qmp.parser); + + return qmp.response; +} + +/* Sends a message and file descriptors to the socket. + * It's needed for qmp-commands like getfd/add-fd */ +static void socket_send_fds(int socket_fd, int *fds, size_t fds_num, + const char *buf, size_t buf_size) +{ + ssize_t ret; + struct msghdr msg =3D { 0 }; + char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] =3D { 0 }; + size_t fdsize =3D sizeof(int) * fds_num; + struct cmsghdr *cmsg; + struct iovec iov =3D { .iov_base =3D (char *)buf, .iov_len =3D buf_siz= e }; + + msg.msg_iov =3D &iov; + msg.msg_iovlen =3D 1; + + if (fds && fds_num > 0) { + g_assert_cmpuint(fds_num, <, SOCKET_MAX_FDS); + + msg.msg_control =3D control; + msg.msg_controllen =3D CMSG_SPACE(fdsize); + + cmsg =3D CMSG_FIRSTHDR(&msg); + cmsg->cmsg_len =3D CMSG_LEN(fdsize); + cmsg->cmsg_level =3D SOL_SOCKET; + cmsg->cmsg_type =3D SCM_RIGHTS; + memcpy(CMSG_DATA(cmsg), fds, fdsize); + } + + do { + ret =3D sendmsg(socket_fd, &msg, 0); + } while (ret < 0 && errno =3D=3D EINTR); + g_assert_cmpint(ret, >, 0); +} + +/** + * Allow users to send a message without waiting for the reply, + * in the case that they choose to discard all replies up until + * a particular EVENT is received. + */ +void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, + const char *fmt, va_list ap) +{ + QObject *qobj; + + /* Going through qobject ensures we escape strings properly */ + qobj =3D qobject_from_vjsonf_nofail(fmt, ap); + + /* No need to send anything for an empty QObject. */ + if (qobj) { + int log =3D getenv("QTEST_LOG") !=3D NULL; + GString *str =3D qobject_to_json(qobj); + + /* + * BUG: QMP doesn't react to input until it sees a newline, an + * object, or an array. Work-around: give it a newline. + */ + g_string_append_c(str, '\n'); + + if (log) { + fprintf(stderr, "%s", str->str); + } + /* Send QMP request */ + if (fds && fds_num > 0) { + socket_send_fds(fd, fds, fds_num, str->str, str->len); + } else { + socket_send(fd, str->str, str->len); + } + + g_string_free(str, true); + qobject_unref(qobj); + } +} + +void qmp_fd_vsend(int fd, const char *fmt, va_list ap) +{ + qmp_fd_vsend_fds(fd, NULL, 0, fmt, ap); +} + + +QDict *qmp_fdv(int fd, const char *fmt, va_list ap) +{ + qmp_fd_vsend_fds(fd, NULL, 0, fmt, ap); + + return qmp_fd_receive(fd); +} + +QDict *qmp_fd(int fd, const char *fmt, ...) +{ + va_list ap; + QDict *response; + + va_start(ap, fmt); + response =3D qmp_fdv(fd, fmt, ap); + va_end(ap); + return response; +} + +void qmp_fd_send(int fd, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + qmp_fd_vsend(fd, fmt, ap); + va_end(ap); +} + +void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) +{ + bool log =3D getenv("QTEST_LOG") !=3D NULL; + char *str =3D g_strdup_vprintf(fmt, ap); + + if (log) { + fprintf(stderr, "%s", str); + } + socket_send(fd, str, strlen(str)); + g_free(str); +} + +void qmp_fd_send_raw(int fd, const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + qmp_fd_vsend_raw(fd, fmt, ap); + va_end(ap); +} + +bool qmp_rsp_is_err(QDict *rsp) +{ + QDict *error =3D qdict_get_qdict(rsp, "error"); + qobject_unref(rsp); + return !!error; +} + +void qmp_expect_error_and_unref(QDict *rsp, const char *class) +{ + QDict *error =3D qdict_get_qdict(rsp, "error"); + + g_assert_cmpstr(qdict_get_try_str(error, "class"), =3D=3D, class); + g_assert_nonnull(qdict_get_try_str(error, "desc")); + g_assert(!qdict_haskey(rsp, "return")); + + qobject_unref(rsp); +} diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index aaf5ab0ca533..228357f1eade 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -21,10 +21,9 @@ #include =20 #include "libqtest.h" +#include "libqmp.h" #include "qemu/ctype.h" #include "qemu/cutils.h" -#include "qapi/error.h" -#include "qapi/qmp/json-parser.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" #include "qapi/qmp/qlist.h" @@ -32,8 +31,6 @@ =20 #define MAX_IRQ 256 #define SOCKET_TIMEOUT 50 -#define SOCKET_MAX_FDS 16 - =20 typedef void (*QTestSendFn)(QTestState *s, const char *buf); typedef void (*ExternalSendFn)(void *s, const char *buf); @@ -440,40 +437,6 @@ static void G_GNUC_PRINTF(2, 3) qtest_sendf(QTestState= *s, const char *fmt, ...) g_free(str); } =20 -/* Sends a message and file descriptors to the socket. - * It's needed for qmp-commands like getfd/add-fd */ -static void socket_send_fds(int socket_fd, int *fds, size_t fds_num, - const char *buf, size_t buf_size) -{ - ssize_t ret; - struct msghdr msg =3D { 0 }; - char control[CMSG_SPACE(sizeof(int) * SOCKET_MAX_FDS)] =3D { 0 }; - size_t fdsize =3D sizeof(int) * fds_num; - struct cmsghdr *cmsg; - struct iovec iov =3D { .iov_base =3D (char *)buf, .iov_len =3D buf_siz= e }; - - msg.msg_iov =3D &iov; - msg.msg_iovlen =3D 1; - - if (fds && fds_num > 0) { - g_assert_cmpuint(fds_num, <, SOCKET_MAX_FDS); - - msg.msg_control =3D control; - msg.msg_controllen =3D CMSG_SPACE(fdsize); - - cmsg =3D CMSG_FIRSTHDR(&msg); - cmsg->cmsg_len =3D CMSG_LEN(fdsize); - cmsg->cmsg_level =3D SOL_SOCKET; - cmsg->cmsg_type =3D SCM_RIGHTS; - memcpy(CMSG_DATA(cmsg), fds, fdsize); - } - - do { - ret =3D sendmsg(socket_fd, &msg, 0); - } while (ret < 0 && errno =3D=3D EINTR); - g_assert_cmpint(ret, >, 0); -} - static GString *qtest_client_socket_recv_line(QTestState *s) { GString *line; @@ -568,62 +531,6 @@ static int qtest_query_target_endianness(QTestState *s) return big_endian; } =20 -typedef struct { - JSONMessageParser parser; - QDict *response; -} QMPResponseParser; - -static void qmp_response(void *opaque, QObject *obj, Error *err) -{ - QMPResponseParser *qmp =3D opaque; - - assert(!obj !=3D !err); - - if (err) { - error_prepend(&err, "QMP JSON response parsing failed: "); - error_report_err(err); - abort(); - } - - g_assert(!qmp->response); - qmp->response =3D qobject_to(QDict, obj); - g_assert(qmp->response); -} - -QDict *qmp_fd_receive(int fd) -{ - QMPResponseParser qmp; - bool log =3D getenv("QTEST_LOG") !=3D NULL; - - qmp.response =3D NULL; - json_message_parser_init(&qmp.parser, qmp_response, &qmp, NULL); - while (!qmp.response) { - ssize_t len; - char c; - - len =3D read(fd, &c, 1); - if (len =3D=3D -1 && errno =3D=3D EINTR) { - continue; - } - - if (len =3D=3D -1 || len =3D=3D 0) { - fprintf(stderr, "Broken pipe\n"); - abort(); - } - - if (log) { - g_assert(write(2, &c, 1) =3D=3D 1); - } - json_message_parser_feed(&qmp.parser, &c, 1); - } - if (log) { - g_assert(write(2, "\n", 1) =3D=3D 1); - } - json_message_parser_destroy(&qmp.parser); - - return qmp.response; -} - QDict *qtest_qmp_receive(QTestState *s) { while (true) { @@ -664,50 +571,6 @@ int qtest_socket_server(const char *socket_path) return sock; } =20 -/** - * Allow users to send a message without waiting for the reply, - * in the case that they choose to discard all replies up until - * a particular EVENT is received. - */ -void qmp_fd_vsend_fds(int fd, int *fds, size_t fds_num, - const char *fmt, va_list ap) -{ - QObject *qobj; - - /* Going through qobject ensures we escape strings properly */ - qobj =3D qobject_from_vjsonf_nofail(fmt, ap); - - /* No need to send anything for an empty QObject. */ - if (qobj) { - int log =3D getenv("QTEST_LOG") !=3D NULL; - GString *str =3D qobject_to_json(qobj); - - /* - * BUG: QMP doesn't react to input until it sees a newline, an - * object, or an array. Work-around: give it a newline. - */ - g_string_append_c(str, '\n'); - - if (log) { - fprintf(stderr, "%s", str->str); - } - /* Send QMP request */ - if (fds && fds_num > 0) { - socket_send_fds(fd, fds, fds_num, str->str, str->len); - } else { - socket_send(fd, str->str, str->len); - } - - g_string_free(str, true); - qobject_unref(qobj); - } -} - -void qmp_fd_vsend(int fd, const char *fmt, va_list ap) -{ - qmp_fd_vsend_fds(fd, NULL, 0, fmt, ap); -} - void qtest_qmp_vsend_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) { @@ -719,13 +582,6 @@ void qtest_qmp_vsend(QTestState *s, const char *fmt, v= a_list ap) qmp_fd_vsend_fds(s->qmp_fd, NULL, 0, fmt, ap); } =20 -QDict *qmp_fdv(int fd, const char *fmt, va_list ap) -{ - qmp_fd_vsend_fds(fd, NULL, 0, fmt, ap); - - return qmp_fd_receive(fd); -} - QDict *qtest_vqmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, va_list ap) { @@ -743,26 +599,6 @@ QDict *qtest_vqmp(QTestState *s, const char *fmt, va_l= ist ap) return qtest_qmp_receive(s); } =20 -QDict *qmp_fd(int fd, const char *fmt, ...) -{ - va_list ap; - QDict *response; - - va_start(ap, fmt); - response =3D qmp_fdv(fd, fmt, ap); - va_end(ap); - return response; -} - -void qmp_fd_send(int fd, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - qmp_fd_vsend(fd, fmt, ap); - va_end(ap); -} - QDict *qtest_qmp_fds(QTestState *s, int *fds, size_t fds_num, const char *fmt, ...) { @@ -795,27 +631,6 @@ void qtest_qmp_send(QTestState *s, const char *fmt, ..= .) va_end(ap); } =20 -void qmp_fd_vsend_raw(int fd, const char *fmt, va_list ap) -{ - bool log =3D getenv("QTEST_LOG") !=3D NULL; - char *str =3D g_strdup_vprintf(fmt, ap); - - if (log) { - fprintf(stderr, "%s", str); - } - socket_send(fd, str, strlen(str)); - g_free(str); -} - -void qmp_fd_send_raw(int fd, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - qmp_fd_vsend_raw(fd, fmt, ap); - va_end(ap); -} - void qtest_qmp_send_raw(QTestState *s, const char *fmt, ...) { va_list ap; @@ -1539,24 +1354,6 @@ void qtest_qmp_device_del(QTestState *qts, const cha= r *id) qtest_qmp_eventwait(qts, "DEVICE_DELETED"); } =20 -bool qmp_rsp_is_err(QDict *rsp) -{ - QDict *error =3D qdict_get_qdict(rsp, "error"); - qobject_unref(rsp); - return !!error; -} - -void qmp_expect_error_and_unref(QDict *rsp, const char *class) -{ - QDict *error =3D qdict_get_qdict(rsp, "error"); - - g_assert_cmpstr(qdict_get_try_str(error, "class"), =3D=3D, class); - g_assert_nonnull(qdict_get_try_str(error, "desc")); - g_assert(!qdict_haskey(rsp, "return")); - - qobject_unref(rsp); -} - static void qtest_client_set_tx_handler(QTestState *s, QTestSendFn send) { diff --git a/tests/qtest/libqos/meson.build b/tests/qtest/libqos/meson.build index e988d1579172..9f292339f9cf 100644 --- a/tests/qtest/libqos/meson.build +++ b/tests/qtest/libqos/meson.build @@ -1,4 +1,7 @@ -libqos_srcs =3D files('../libqtest.c', +libqos_srcs =3D files( + '../libqtest.c', + '../libqmp.c', + 'qgraph.c', 'qos_external.c', 'pci.c', diff --git a/tests/unit/meson.build b/tests/unit/meson.build index ab01e00f12cf..264f2bc0c81d 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -154,7 +154,7 @@ if have_system endif =20 if have_ga and targetos =3D=3D 'linux' - tests +=3D {'test-qga': ['../qtest/libqtest.c']} + tests +=3D {'test-qga': ['../qtest/libqmp.c']} test_deps +=3D {'test-qga': qga} endif =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613905; cv=none; d=zohomail.com; s=zohoarc; b=VLoP4bv9U5KlTBOyiEGF3638PFohH2OuEN22tifvx6iII/9tjY+skR+1cNrQtbhMgDBEBVMF3xDvLfiT4abxRVT+0kfgb8pGcLR2F4x44njFubZont5h78KKAxNIYLYCHbeOuoQpOCGfj7WHjKCOcT+yMswbjxHps5tjC/sGO9g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613905; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=WzRy/RaI9MhxFyECgyDG//yYxBQzB5Yathm3QqKh3CA=; b=ZdtTeJtwia28aWPtcWV1OaCEzYLV4LtCVtfMJLUAQq7A5BALjllHcMaZ7KF9BmS/IuCDSqwEP9P1wGyWPD8kUg6soAqZg3tI8gs7GYRrtj4TLZGjBJKJHlSTW5DroujJYbJEREOzof4cq6ms6FVjQpaLHpWePLax/D8fBWKQ+lA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613905239738.93686933398; Tue, 3 May 2022 14:38:25 -0700 (PDT) Received: from localhost ([::1]:38712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0Dv-0000XO-4A for importer@patchew.org; Tue, 03 May 2022 17:38:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyuG-0000TJ-TY for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:44478) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyuD-0002xC-TT for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:00 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-410-xhPpL0M0MBS0z9QrtI8eZA-1; Tue, 03 May 2022 11:33:59 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9DE09131A708; Tue, 3 May 2022 13:01:01 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97EB753CD; Tue, 3 May 2022 13:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608833; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WzRy/RaI9MhxFyECgyDG//yYxBQzB5Yathm3QqKh3CA=; b=MKFRuLm6CexA8du5ZcX4YJOLTcULfWVbTtxrGJWTUars9dRp9y29RbwKqWWLY5lzAkGJn0 Sgh+2WoPKZMOBMYJu52w8tZJChnWN434zWTQlr8c4QrTQVeFPQj0VvqUoRJDKJuqfb5HS7 +87W4uRFJNmeC/ExzHeV3YG7I97h6hk= X-MC-Unique: xhPpL0M0MBS0z9QrtI8eZA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 05/23] Use g_unix_set_fd_nonblocking() Date: Tue, 3 May 2022 17:00:05 +0400 Message-Id: <20220503130023.180544-6-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613905959100001 From: Marc-Andr=C3=A9 Lureau API available since glib 2.30. It also preserves errno. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- hw/misc/ivshmem.c | 2 +- util/event_notifier-posix.c | 6 ++---- util/main-loop.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c index e7c0099bdaf6..8270db53cda7 100644 --- a/hw/misc/ivshmem.c +++ b/hw/misc/ivshmem.c @@ -537,7 +537,7 @@ static void process_msg_connect(IVShmemState *s, uint16= _t posn, int fd, =20 IVSHMEM_DPRINTF("eventfds[%d][%d] =3D %d\n", posn, vector, fd); event_notifier_init_fd(&peer->eventfds[vector], fd); - fcntl_setfl(fd, O_NONBLOCK); /* msix/irqfd poll non block */ + g_unix_set_fd_nonblocking(fd, true, NULL); /* msix/irqfd poll non bloc= k */ =20 if (posn =3D=3D s->vm_id) { setup_interrupt(s, vector, errp); diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 8dc30c51414d..2aa14eabb38e 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -52,13 +52,11 @@ int event_notifier_init(EventNotifier *e, int active) if (qemu_pipe(fds) < 0) { return -errno; } - ret =3D fcntl_setfl(fds[0], O_NONBLOCK); - if (ret < 0) { + if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) { ret =3D -errno; goto fail; } - ret =3D fcntl_setfl(fds[1], O_NONBLOCK); - if (ret < 0) { + if (!g_unix_set_fd_nonblocking(fds[1], true, NULL)) { ret =3D -errno; goto fail; } diff --git a/util/main-loop.c b/util/main-loop.c index b7b0ce4ca087..9afac10dff0f 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -114,7 +114,7 @@ static int qemu_signal_init(Error **errp) return -errno; } =20 - fcntl_setfl(sigfd, O_NONBLOCK); + g_unix_set_fd_nonblocking(sigfd, true, NULL); =20 qemu_set_fd_handler(sigfd, sigfd_handler, NULL, (void *)(intptr_t)sigf= d); =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651615444; cv=none; d=zohomail.com; s=zohoarc; b=BiKznDGI3KOg/VBD0D6IBd/FLJlYR+WhEdFqUiFqhP5UCJYtr88On0cDc7La5kplg9yFt+8zhg8CTRbBaMoI+Rg5TJkvnRsjbCaEVkD2cJgkIdfVPQqHRKOejpKgzbnUiVxnx/l/9LvbjsBVVGqAHev0+EylJ6Uq6son+rXtmuM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651615444; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=6Xp/ZOvdkijbH2N7bf2mEvklYqn1dhF7/XdVsGvDIAA=; b=AxCfvFN4wK7QyF31jwvEY/nxHwXG/7T/N1CeqJJxEwYSB1X9b8hjsvXIDvPZJso92MJpSpJ3zqc71UjIaVpzBFAR4EYv4qmmUDEh/wZrqMDebzyYqgSezyzQuxGyQ/EIm6k4/lvTGWjTpQaSSYdhOrkqSZQFYpjYaAo8IBH5Rbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651615444321634.8129954441823; Tue, 3 May 2022 15:04:04 -0700 (PDT) Received: from localhost ([::1]:59158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0cl-0004fn-8W for importer@patchew.org; Tue, 03 May 2022 18:04:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46112) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz0g-00023U-Ap for qemu-devel@nongnu.org; Tue, 03 May 2022 16:20:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:43283) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz0e-0004zf-Je for qemu-devel@nongnu.org; Tue, 03 May 2022 16:20:37 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-1r_ryQhhNf-MY1rxvfEpSQ-1; Tue, 03 May 2022 11:35:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2803A1931787; Tue, 3 May 2022 13:01:11 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 390E17774; Tue, 3 May 2022 13:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6Xp/ZOvdkijbH2N7bf2mEvklYqn1dhF7/XdVsGvDIAA=; b=So0drIt2YCKDqBGvcDO8W7kWm2TmK38v7AfAFy7aKGPnGBW5tH6/xEj5mNHCz8uQi3ABty fCnMrWl4vFf5NCVh7/NwXHf6R19oRHv423EhOLGDM7yrqOOMUGOR0uzCQxt5NB+gYu9iHj twLXoA5oqfF3yEyi5GhPp5JxauUOcBo= X-MC-Unique: 1r_ryQhhNf-MY1rxvfEpSQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 06/23] block: move fcntl_setfl() Date: Tue, 3 May 2022 17:00:06 +0400 Message-Id: <20220503130023.180544-7-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651615446133100001 From: Marc-Andr=C3=A9 Lureau It is only used by block/file-posix.c, move it there. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- include/sysemu/os-posix.h | 2 -- block/file-posix.c | 15 +++++++++++++++ util/oslib-posix.c | 15 --------------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/sysemu/os-posix.h b/include/sysemu/os-posix.h index adbe19d3e468..58de7c994d85 100644 --- a/include/sysemu/os-posix.h +++ b/include/sysemu/os-posix.h @@ -96,8 +96,6 @@ static inline void qemu_funlockfile(FILE *f) funlockfile(f); } =20 -int fcntl_setfl(int fd, int flag); - #ifdef __cplusplus } #endif diff --git a/block/file-posix.c b/block/file-posix.c index bfd9b2111143..48cd0966249d 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -1022,6 +1022,21 @@ static int raw_handle_perm_lock(BlockDriverState *bs, return ret; } =20 +/* Sets a specific flag */ +static int fcntl_setfl(int fd, int flag) +{ + int flags; + + flags =3D fcntl(fd, F_GETFL); + if (flags =3D=3D -1) { + return -errno; + } + if (fcntl(fd, F_SETFL, flags | flag) =3D=3D -1) { + return -errno; + } + return 0; +} + static int raw_reconfigure_getfd(BlockDriverState *bs, int flags, int *open_flags, uint64_t perm, bool forc= e_dup, Error **errp) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index b8bf7d4070ce..289efca3fae1 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -897,21 +897,6 @@ size_t qemu_get_host_physmem(void) return 0; } =20 -/* Sets a specific flag */ -int fcntl_setfl(int fd, int flag) -{ - int flags; - - flags =3D fcntl(fd, F_GETFL); - if (flags =3D=3D -1) { - return -errno; - } - if (fcntl(fd, F_SETFL, flags | flag) =3D=3D -1) { - return -errno; - } - return 0; -} - int qemu_msync(void *addr, size_t length, int fd) { size_t align_mask =3D ~(qemu_real_host_page_size() - 1); --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651614298; cv=none; d=zohomail.com; s=zohoarc; b=hGa0fITOVo8/9neMrftf30D9n/DbxsYhOvXhLPN8e4vQN3O0LQ1maNzp4HtTd1iRbXbIl8u7jx7Sx2Qyu1FqljobRFRuNhKtdRgF4pugUG3C6thuJ7ePjJ+H18niFZ2MBa1Mwx9mVSmHyT8m3TlmTNJuKbm/eiE37Rjewfmdyzk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651614298; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bkeLNHuE43AGX49aIl9MIjSjAC3Z3ipnR5IIpltTe8o=; b=P8hgWgQdGiK3BCrtbYzj/yhnthvVSuMUAMsoyBByrBZbOhqSZ9T/ZmZla7POEHu+OerkzTwGbViggF2/3P7bnoUae0BY8oeQYbicQIII8sTkwjhp0S7Wp83L+h+pcZnIm03pdJO1XfsiafXbPO9+UvABln7u1XJKo1zbKGbv6GI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651614298489884.823415901936; Tue, 3 May 2022 14:44:58 -0700 (PDT) Received: from localhost ([::1]:51410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0KH-0001YG-6X for importer@patchew.org; Tue, 03 May 2022 17:44:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyyG-0006nU-Bd for qemu-devel@nongnu.org; Tue, 03 May 2022 16:18:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58925) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyyB-0003fW-Vl for qemu-devel@nongnu.org; Tue, 03 May 2022 16:18:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-228-q1BaaEN4Od-gawHt1_N1rQ-1; Tue, 03 May 2022 11:36:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BC9C33CF16CA; Tue, 3 May 2022 13:01:15 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0B4FC33AE5; Tue, 3 May 2022 13:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bkeLNHuE43AGX49aIl9MIjSjAC3Z3ipnR5IIpltTe8o=; b=HRGztLWB6iJoc/vu7Fs4NQT1PRrazLVi6NhRc7N+74vqXnrf5/VS4uJDMGICumKDHuRndO uisZmrsoEY6fQYVKJSIVrDOsfz1aB7YPdrnpwQ+T7w4VkedtHsYUbT3nxYtemUgWVOe9J3 6+GUvuT14SExmAO9bzAASH3AMDbA9fE= X-MC-Unique: q1BaaEN4Od-gawHt1_N1rQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 07/23] Replace qemu_pipe() with g_unix_open_pipe() Date: Tue, 3 May 2022 17:00:07 +0400 Message-Id: <20220503130023.180544-8-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651614299823100001 From: Marc-Andr=C3=A9 Lureau GLib g_unix_open_pipe() is essentially like qemu_pipe(), available since 2.30. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- include/qemu/osdep.h | 4 ---- qemu-nbd.c | 5 +++-- util/event_notifier-posix.c | 2 +- util/oslib-posix.c | 22 ---------------------- 4 files changed, 4 insertions(+), 29 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 52d81c027ba0..1c1e7eca9898 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -547,10 +547,6 @@ static inline void qemu_timersub(const struct timeval = *val1, ssize_t qemu_write_full(int fd, const void *buf, size_t count) G_GNUC_WARN_UNUSED_RESULT; =20 -#ifndef _WIN32 -int qemu_pipe(int pipefd[2]); -#endif - void qemu_set_cloexec(int fd); =20 /* Return a dynamically allocated directory path that is appropriate for s= toring diff --git a/qemu-nbd.c b/qemu-nbd.c index db63980df1e4..2382b5042adf 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -909,13 +909,14 @@ int main(int argc, char **argv) =20 if ((device && !verbose) || fork_process) { #ifndef WIN32 + g_autoptr(GError) err =3D NULL; int stderr_fd[2]; pid_t pid; int ret; =20 - if (qemu_pipe(stderr_fd) < 0) { + if (!g_unix_open_pipe(stderr_fd, FD_CLOEXEC, &err)) { error_report("Error setting up communication pipe: %s", - strerror(errno)); + err->message); exit(EXIT_FAILURE); } =20 diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c index 2aa14eabb38e..76420c5b560c 100644 --- a/util/event_notifier-posix.c +++ b/util/event_notifier-posix.c @@ -49,7 +49,7 @@ int event_notifier_init(EventNotifier *e, int active) if (errno !=3D ENOSYS) { return -errno; } - if (qemu_pipe(fds) < 0) { + if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { return -errno; } if (!g_unix_set_fd_nonblocking(fds[0], true, NULL)) { diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 289efca3fae1..2a6f6248ad03 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -274,28 +274,6 @@ void qemu_set_cloexec(int fd) assert(f !=3D -1); } =20 -/* - * Creates a pipe with FD_CLOEXEC set on both file descriptors - */ -int qemu_pipe(int pipefd[2]) -{ - int ret; - -#ifdef CONFIG_PIPE2 - ret =3D pipe2(pipefd, O_CLOEXEC); - if (ret !=3D -1 || errno !=3D ENOSYS) { - return ret; - } -#endif - ret =3D pipe(pipefd); - if (ret =3D=3D 0) { - qemu_set_cloexec(pipefd[0]); - qemu_set_cloexec(pipefd[1]); - } - - return ret; -} - char * qemu_get_local_state_dir(void) { --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613303; cv=none; d=zohomail.com; s=zohoarc; b=I/hwjky9IBezV/rKDjMpV2wwwOoJ3T5y08KrlK5cKBM7Hwm2OnzOjGZbVW/tSh2gxlzKcqIMZ+t27osMwhGQ/EP/mqkPs5mSotU0eQ11sXgi4MO/FZCrLi8cIKv5+5QNH4Xoml6NxyHVKV56nQht/2OTwstqe7RAi0K/qxl5nPY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613303; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=G5FbyBPo4kXvJWXxLfWFOr+WVaSKl8ZcoGzGXhLQDqs=; b=XybO92oDJnUg41+02WWWdiaJxO3wgOhEN6+7TTDO9yl1amYlBwc4cPH1JKWxacA/igNrlaRfNWQo/9D/FMIskGStzP8849A8CVMt0ezOGDpM2xH71CpT/gOeekvyGIOWPGOgrV0ib6HBkKOZsBKo4Z4VGGZ8XIQyKLrWKB91ZCE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16516133034741005.3331234332487; Tue, 3 May 2022 14:28:23 -0700 (PDT) Received: from localhost ([::1]:43546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm04E-0001dM-G0 for importer@patchew.org; Tue, 03 May 2022 17:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlysb-0006g8-08 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:12:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:26242) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlysU-0002mX-CI for qemu-devel@nongnu.org; Tue, 03 May 2022 16:12:16 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-6-FnucTUIsNOuNNYr_6sf73w-1; Tue, 03 May 2022 11:37:20 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ECF003CF16D9; Tue, 3 May 2022 13:01:19 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A17E463EC3; Tue, 3 May 2022 13:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608729; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G5FbyBPo4kXvJWXxLfWFOr+WVaSKl8ZcoGzGXhLQDqs=; b=dmba+8RDm2DPJcLmVKqKLMzMeAAKVKfgb6BORVbr4aROJIwLTTHZr4Y6LQKJVRyvp4OPFp XJIcaQ4WredS1/WTQBYPeBpnfqeeWnGTno7qqWTgLdc31m2F+5DD2cH9n/b6kXXOf+jvYX tbm+K7eOQ+su5nUWIEqVvxYKtQUSWP8= X-MC-Unique: FnucTUIsNOuNNYr_6sf73w-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 08/23] util: replace pipe()+cloexec with g_unix_open_pipe() Date: Tue, 3 May 2022 17:00:08 +0400 Message-Id: <20220503130023.180544-9-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613304069100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- util/compatfd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/compatfd.c b/util/compatfd.c index 55b6e0b7fb27..147e39e2c62b 100644 --- a/util/compatfd.c +++ b/util/compatfd.c @@ -60,14 +60,11 @@ static int qemu_signalfd_compat(const sigset_t *mask) =20 info =3D g_malloc(sizeof(*info)); =20 - if (pipe(fds) =3D=3D -1) { + if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { g_free(info); return -1; } =20 - qemu_set_cloexec(fds[0]); - qemu_set_cloexec(fds[1]); - memcpy(&info->mask, mask, sizeof(*mask)); info->fd =3D fds[1]; =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651614029; cv=none; d=zohomail.com; s=zohoarc; b=goiFixp8pnYLrsFDCu0Y+nZYSQcSeBl4f2KqNurkcGK3qqb9PBIt3cpHq+/0JOxCRY/S0cdamm19uW3J9bMgihbQXvKc8ybimw9/C3Vce5CbbxxB77O9fvPLTbMbuS5kA8xcci1gn4cHnq9qKMR+fMV+nzV1EOvtc0s5LAbjUrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651614029; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=fd+Rz0jgLWiYZFJ4+raBzYg5dQ+5DddFsUFfXtIIixA=; b=ARjSVwFG11BY45XntZNJ70tOe4h2Po0IgQpsBzRG09GFvVrT3cb33wnp+61P7Xx70x9mysbCdhwXiUObMF+h8bljqz8aagSZAPH3ahO3V0P+NLnKqObDndlRawjfU88Eo5euT6ITtueieiyNEa9lTynQlhvRrBVaaGk1I1fw71Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651614028998444.6678442813761; Tue, 3 May 2022 14:40:28 -0700 (PDT) Received: from localhost ([::1]:42808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0Fv-0003tY-PO for importer@patchew.org; Tue, 03 May 2022 17:40:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz0g-00023Q-9l for qemu-devel@nongnu.org; Tue, 03 May 2022 16:20:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:39077) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz0e-0004zb-JZ for qemu-devel@nongnu.org; Tue, 03 May 2022 16:20:37 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-55-kAc_WtXoN_W5pImOsONwXg-1; Tue, 03 May 2022 11:36:56 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C28CF1CCCB18; Tue, 3 May 2022 13:01:24 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id C540D40D2820; Tue, 3 May 2022 13:01:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609235; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fd+Rz0jgLWiYZFJ4+raBzYg5dQ+5DddFsUFfXtIIixA=; b=cXjIOW5CgjNnAbxUk5Yr2jhkQGzeoqJ96kiBmE9Hi8HX0Uyh7xYnjeOo5pcmmvgpGiCaEV mskf3CrXVJMe6RBdCpGWjkSqyUDDqNJcYGu0fu79jgU4bH3IYnsvMrXgrOi+6bITZVX19C NhtQ4RW3QzRc6zAwcjBfJJhOZkV18IU= X-MC-Unique: kAc_WtXoN_W5pImOsONwXg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 09/23] qga: replace pipe() with g_unix_open_pipe(CLOEXEC) Date: Tue, 3 May 2022 17:00:09 +0400 Message-Id: <20220503130023.180544-10-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651614030293100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- qga/commands-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 77f4672ca2c9..094487c2c395 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -2529,7 +2529,7 @@ void qmp_guest_set_user_password(const char *username, goto out; } =20 - if (pipe(datafd) < 0) { + if (!g_unix_open_pipe(datafd, FD_CLOEXEC, NULL)) { error_setg(errp, "cannot create pipe FDs"); goto out; } --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613243; cv=none; d=zohomail.com; s=zohoarc; b=lqPVh2wRZJpbSdJ45fP5/0/JP6UOUQY/pknAwd4qu0PfGjlAmaX5DluI0jrgRCdNSGewWHiwNaieDxR+Q+p2fyBcS3rOUlBCKThMlEEdbOEPXw8yH+uUmRgENaP4vkx+N25zKB4cNX0BPrFiPAtsqnkUTb92CnG4WsoHM3v2vJ4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613243; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9m1Y+nOorLPIX/35eqXi8Mnicnq6DPaZ0KxNncP/Vgw=; b=i1ihHtXT2HMM0zyWZiPpOhOjOry84eJb+lI9e7/0Lzd06Zh+wJF3g5xNj4cEBdIM65le4XprCv07vIPYYRsXlxdI/bNcrBRnC/T7NnLSCcYHOG7vttMCiC16//nv/l9QTmvWhMhDkCcgH7WcgRFM9HTQQe2y87QkF9dhzIJkVus= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613243136867.8760486755725; Tue, 3 May 2022 14:27:23 -0700 (PDT) Received: from localhost ([::1]:41158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm03F-0008ML-SI for importer@patchew.org; Tue, 03 May 2022 17:27:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyvO-0001jJ-I4 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:15:13 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:31618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyvL-0003Ei-SY for qemu-devel@nongnu.org; Tue, 03 May 2022 16:15:10 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-219-letgppWKO1aA-vWQj55NYw-1; Tue, 03 May 2022 11:35:56 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5F850ADE88D; Tue, 3 May 2022 13:01:29 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D7844010121; Tue, 3 May 2022 13:01:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9m1Y+nOorLPIX/35eqXi8Mnicnq6DPaZ0KxNncP/Vgw=; b=SNw0I7gsrHS/RUMx+S6nTkVIL9DI/XQsIugifCQ5CCWFgCacDRY2iDTkIRjBZGfbfI1h9N 9RcpnkLQq8eXTiWLH4v/0FKB6yTNzueFrufOoRRgN+QIK/ejLM9IEQTkBmpKJTLs99P/a9 JhRaaY1w9MQPxVUcVPIJjYUC8QLeqC0= X-MC-Unique: letgppWKO1aA-vWQj55NYw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 10/23] tests: replace pipe() with g_unix_open_pipe(CLOEXEC) Date: Tue, 3 May 2022 17:00:10 +0400 Message-Id: <20220503130023.180544-11-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613244079100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- tests/qtest/ivshmem-test.c | 5 +++-- tests/unit/test-io-channel-file.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/qtest/ivshmem-test.c b/tests/qtest/ivshmem-test.c index bfc91d1719d2..e23a97fa8ef4 100644 --- a/tests/qtest/ivshmem-test.c +++ b/tests/qtest/ivshmem-test.c @@ -304,6 +304,7 @@ static void setup_vm_with_server(IVState *s, int nvecto= rs) =20 static void test_ivshmem_server(void) { + g_autoptr(GError) err =3D NULL; IVState state1, state2, *s1, *s2; ServerThread thread; IvshmemServer server; @@ -320,8 +321,8 @@ static void test_ivshmem_server(void) g_assert_cmpint(ret, =3D=3D, 0); =20 thread.server =3D &server; - ret =3D pipe(thread.pipe); - g_assert_cmpint(ret, =3D=3D, 0); + g_unix_open_pipe(thread.pipe, FD_CLOEXEC, &err); + g_assert_no_error(err); thread.thread =3D g_thread_new("ivshmem-server", server_thread, &threa= d); g_assert(thread.thread !=3D NULL); =20 diff --git a/tests/unit/test-io-channel-file.c b/tests/unit/test-io-channel= -file.c index 29038e67b64d..1977006ce922 100644 --- a/tests/unit/test-io-channel-file.c +++ b/tests/unit/test-io-channel-file.c @@ -109,7 +109,7 @@ static void test_io_channel_pipe(bool async) QIOChannelTest *test; int fd[2]; =20 - if (pipe(fd) < 0) { + if (!g_unix_open_pipe(fd, FD_CLOEXEC, NULL)) { perror("pipe"); abort(); } --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651619910; cv=none; d=zohomail.com; s=zohoarc; b=XBaC5YRzHXuw1N7ufEtS5X0Ds31YHemY58GQOZb4R+QlIM/4S2MzKMYDJ2p+OIs3gR0LpbpbDzrm5sdG3ST3T0cL5lqVVSqywmxG3FzdmRdjsev1hP6bSR/hBsMBVUNPXNu9B7Ce3jT/azJqCKQZIiQNhrXiwnN3x7olZ+6ftMs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651619910; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l76Es0Go6yi7dxLGk9I6xUcPM8tl9660m8nL2N3LWXA=; b=MQINy4B3Diehb2k1AhpAR1SPoRVJHdMzjL/IYXQfzSwqjnNfgQEmnJI6uC3l3PfuVJdmUnhJjl/PLseNnRbhQMj3Bv6SBLD87i/F22rzpFnflNXyfDGjknMzdacFFVAt9mMr09ZtoJBE8Jk6bQyVbM6eJWaFhb8fCUYTJPeo8rU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651619910388375.02017172331045; Tue, 3 May 2022 16:18:30 -0700 (PDT) Received: from localhost ([::1]:42786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm1mm-0005xN-UM for importer@patchew.org; Tue, 03 May 2022 19:18:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52708) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzYQ-0005xA-RS for qemu-devel@nongnu.org; Tue, 03 May 2022 16:55:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:57869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzYN-0004vW-DH for qemu-devel@nongnu.org; Tue, 03 May 2022 16:55:29 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-159-ybXlHSIAOxmL0y5_ogaEng-1; Tue, 03 May 2022 11:36:18 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3EE431932723; Tue, 3 May 2022 13:01:33 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D8F540D2820; Tue, 3 May 2022 13:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651611322; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l76Es0Go6yi7dxLGk9I6xUcPM8tl9660m8nL2N3LWXA=; b=MlVHvGA+FpERrvCKBHCwvEo75ubazx/Lpph1VR8D62MMe2tlmuHgjiUBV3OIB//9wao2A1 MxBxvVlxCNWB1Mpau3LOkwDo6NFfQkRIWMFqfksmwxIV3YbM2QHShtW05Z6XySNoV90lqb gqEaItpQ9tTCPwdnqoZOJFSWdTUS0FY= X-MC-Unique: ybXlHSIAOxmL0y5_ogaEng-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 11/23] os-posix: replace pipe()+cloexec with g_unix_open_pipe(CLOEXEC) Date: Tue, 3 May 2022 17:00:11 +0400 Message-Id: <20220503130023.180544-12-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651619911622100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- os-posix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/os-posix.c b/os-posix.c index 1b746dba97a7..321fc4bd13b8 100644 --- a/os-posix.c +++ b/os-posix.c @@ -215,7 +215,7 @@ void os_daemonize(void) pid_t pid; int fds[2]; =20 - if (pipe(fds) =3D=3D -1) { + if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) { exit(1); } =20 @@ -240,7 +240,6 @@ void os_daemonize(void) =20 close(fds[0]); daemon_pipe =3D fds[1]; - qemu_set_cloexec(daemon_pipe); =20 setsid(); =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613664; cv=none; d=zohomail.com; s=zohoarc; b=KuOFPkN4otTGoBaCumE0AnpigD5LHrojvKViWSGpLNMQMMZ9JvfU8TXH9MsDAUqPKP8HlhuxMEHCNNaZiX5rNzLw4c0k6shbdvWmHhXMMwj7SQForKrzJqSis4STUekqICFLm2IcYY1qJM2vQ/jqaB/HXtdWGJq+Ni/6RVKC8Mw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613664; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=9hMdh9cpsvkt5DkxFqlwfDQSjcB2gcew1FUOpUo7mUQ=; b=KjTErzqlixdzgUjdlWS0xMKAVrBTP/LzoiyNf/VtiRecPbmjJG6NHCEYr03/HwScPjp6dh18VP3BQ/VfP1zh0Mh6TFTicli44Z/pqJAiql2iQNXi6jFerAKmCTcIRyRp9Vb+QZEJ9pn9+J9/nAqnf+MRwQ+FWZOJJNtpafSD3Sk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613664562622.3546847140634; Tue, 3 May 2022 14:34:24 -0700 (PDT) Received: from localhost ([::1]:58356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0A3-00034D-3k for importer@patchew.org; Tue, 03 May 2022 17:34:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyv9-0001Hk-7w for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23201) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyv7-00031r-O2 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:14:54 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-217-CcxArYicMMCGAHxtSw_CuQ-1; Tue, 03 May 2022 11:36:06 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 588D03CF16F4; Tue, 3 May 2022 13:01:37 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 87B5E428F19; Tue, 3 May 2022 13:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9hMdh9cpsvkt5DkxFqlwfDQSjcB2gcew1FUOpUo7mUQ=; b=OymLIcIB/tDQ4O0PtRa4+cN5sZoALI9ClXuWYvyeImXe1v7X8CgZQnxblI7Pd1sfVfQ6Eo MUrYRmDfNFEdKo3B9UvaOZlnv0HVu21nmykxWdU0YSJgSmubDrZOEQ/c8UpCKTCuaenrbT oQ2nR3DeRcTm9Adsw0VJ3iUW/lVr2Ng= X-MC-Unique: CcxArYicMMCGAHxtSw_CuQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 12/23] virtiofsd: replace pipe() with g_unix_open_pipe(CLOEXEC) Date: Tue, 3 May 2022 17:00:12 +0400 Message-Id: <20220503130023.180544-13-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613666571100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- tools/virtiofsd/helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c index f8981e5bdf1a..f5f66f292c70 100644 --- a/tools/virtiofsd/helper.c +++ b/tools/virtiofsd/helper.c @@ -275,7 +275,7 @@ int fuse_daemonize(int foreground) int waiter[2]; char completed; =20 - if (pipe(waiter)) { + if (!g_unix_open_pipe(waiter, FD_CLOEXEC, NULL)) { fuse_log(FUSE_LOG_ERR, "fuse_daemonize: pipe: %s\n", strerror(errno)); return -1; --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613279; cv=none; d=zohomail.com; s=zohoarc; b=h2Qdo777aEhrY1HTemI/RsL+/emm2VbADmYQZdORPEOFRU3Sg7Xbn8iMhYc8m2XemzFHZSOpTfOiyJ3ru1eBhL7AbfgB5Qy05rMlsqUFPLm4YxjV6I3xwjlB1lmcEbCyAkscKPshvYgG7FXeAcgeGBGmj1ImPZFEkVyDdVbz5Ns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613279; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=spcnoU6B6qZO+mMZtjLZJhWRg+6PC57/TK/gztEAXZ4=; b=n/jXy5cpwXoQQZRFx7toTFGobm7H7WO37TLaiYHbh1aaEgo/bjJaiyCTIfduMAPSHRqLmeViIrO4+OwpWihkxm8RDY8tCbDaoK9aUBYerSgRx9qQLhbQgNcIMFEWJHu3YiffpUfhSPu4PBsBw8on+gD2H1VgzKtXIdq7mMwC7QY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613279079602.6639626851141; Tue, 3 May 2022 14:27:59 -0700 (PDT) Received: from localhost ([::1]:42784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm03p-00014N-AD for importer@patchew.org; Tue, 03 May 2022 17:27:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44398) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlysQ-000647-9C for qemu-devel@nongnu.org; Tue, 03 May 2022 16:12:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56028) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlysO-0002jf-HF for qemu-devel@nongnu.org; Tue, 03 May 2022 16:12:05 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-375-HyD4babPM6Wb-zFdvW1yXA-1; Tue, 03 May 2022 11:34:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A004A131AE42; Tue, 3 May 2022 13:01:41 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBABF153AD3A; Tue, 3 May 2022 13:01:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608723; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spcnoU6B6qZO+mMZtjLZJhWRg+6PC57/TK/gztEAXZ4=; b=aGBgSk6P4IEkXlm8lRj5TIWIbGbyteM7bcoT0H4GAe9/SRllQ9JhkwrB05xeg3yjfO0zag AQ4P2KRA6CS5tTBoswl5jKCuYejFbET2mC6uGQLFuPYdo/63YP+lKv+nGFoLdT+BFRPMam 3vc8id+M9XeLFGQVCcn7SSDs++U6Zoo= X-MC-Unique: HyD4babPM6Wb-zFdvW1yXA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 13/23] io: replace pipe() with g_unix_open_pipe(CLOEXEC) Date: Tue, 3 May 2022 17:00:13 +0400 Message-Id: <20220503130023.180544-14-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613280098100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- io/channel-command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/io/channel-command.c b/io/channel-command.c index 338da73ade56..539685ea8340 100644 --- a/io/channel-command.c +++ b/io/channel-command.c @@ -76,8 +76,8 @@ qio_channel_command_new_spawn(const char *const argv[], } } =20 - if ((!stdinnull && pipe(stdinfd) < 0) || - (!stdoutnull && pipe(stdoutfd) < 0)) { + if ((!stdinnull && !g_unix_open_pipe(stdinfd, FD_CLOEXEC, NULL)) || + (!stdoutnull && !g_unix_open_pipe(stdoutfd, FD_CLOEXEC, NULL))) { error_setg_errno(errp, errno, "Unable to open pipe"); goto error; --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651612770; cv=none; d=zohomail.com; s=zohoarc; b=jWgO+x24zFfO8cg0eHauIFxATV63rMe6j0o1DHHeXIg6HxUV9y6OA4X5UhHJMelBIlc9VhEVkxw0TYT5RGKIJu4gaGnkFg/Ml4SIGKlqQ2Pw56bhWwGIQUtLFhrBTz6vCvX5EmHI2u3NagGkQ0Bu72QU3xdF75NS9JOh+TT0ia4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651612770; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vGAsPEx3J2jPmQD3Acyc8kZGSS2G4k65JexyADFPDzg=; b=MAV0TESMdQX5Duwgi7EfUXMB9b7rloPKNzagytmvZU9QI3gw9AY1JUrjIiXkAzyOhd+T6X5g1Ud+neZBveMGHqNQWrNDDCdD6XtTnfYl9DvYKUYtmU10kVhcTP+X6ZkR3ZOZglo6MBxrUENQEoognVYfvGTR50l/wTAtgR8WFHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651612770428447.4588774867825; Tue, 3 May 2022 14:19:30 -0700 (PDT) Received: from localhost ([::1]:54782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlzvc-0006XI-Vm for importer@patchew.org; Tue, 03 May 2022 17:19:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyqd-0002jb-2i for qemu-devel@nongnu.org; Tue, 03 May 2022 16:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:60861) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyqb-0002Sb-6e for qemu-devel@nongnu.org; Tue, 03 May 2022 16:10:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-OxjJIOG0OQ6ZQ8FLs4JZiw-1; Tue, 03 May 2022 11:36:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 664063CF16FE; Tue, 3 May 2022 13:01:46 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C21E153AD3A; Tue, 3 May 2022 13:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vGAsPEx3J2jPmQD3Acyc8kZGSS2G4k65JexyADFPDzg=; b=SvK5tZ/G9u5eQUqFE5QmciIbh/A4U8FjHzjFARNwcrtTYScl9Z5fUHIYwBDz3cKGtrhiD/ 3GlUsgzPEqUZEWWgNK1n1mrfHNsCYZDPwfgBgghOO4P4UdaA7FmuARLlBINL8Rl1pKwRca UYtZZP0RtOkXIFEuetOvDZJgsEF3EkA= X-MC-Unique: OxjJIOG0OQ6ZQ8FLs4JZiw-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 14/23] Replace fcntl(O_NONBLOCK) with g_unix_set_fd_nonblocking() Date: Tue, 3 May 2022 17:00:14 +0400 Message-Id: <20220503130023.180544-15-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651612772057100001 From: Marc-Andr=C3=A9 Lureau Suggested-by: Daniel P. Berrang=C3=A9 Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- net/tap-bsd.c | 4 ++-- net/tap-linux.c | 2 +- net/tap-solaris.c | 2 +- tests/qtest/fuzz/virtio_net_fuzz.c | 2 +- tests/unit/test-iov.c | 4 ++-- util/oslib-posix.c | 16 ++-------------- 6 files changed, 9 insertions(+), 21 deletions(-) diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 7e65bd391f0b..005ce05c6e07 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -98,7 +98,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr, return -1; } } - fcntl(fd, F_SETFL, O_NONBLOCK); + g_unix_set_fd_nonblocking(fd, true, NULL); return fd; } =20 @@ -189,7 +189,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, goto error; } =20 - fcntl(fd, F_SETFL, O_NONBLOCK); + g_unix_set_fd_nonblocking(fd, true, NULL); return fd; =20 error: diff --git a/net/tap-linux.c b/net/tap-linux.c index 3e24d232e782..304ff45071dd 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -113,7 +113,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, return -1; } pstrcpy(ifname, ifname_size, ifr.ifr_name); - fcntl(fd, F_SETFL, O_NONBLOCK); + g_unix_set_fd_nonblocking(fd, true, NULL); return fd; } =20 diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 79919785c9f6..a44f8805c23e 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -198,7 +198,7 @@ int tap_open(char *ifname, int ifname_size, int *vnet_h= dr, return -1; } } - fcntl(fd, F_SETFL, O_NONBLOCK); + g_unix_set_fd_nonblocking(fd, true, NULL); return fd; } =20 diff --git a/tests/qtest/fuzz/virtio_net_fuzz.c b/tests/qtest/fuzz/virtio_n= et_fuzz.c index 3df78d9c1c2a..c2c15f07f062 100644 --- a/tests/qtest/fuzz/virtio_net_fuzz.c +++ b/tests/qtest/fuzz/virtio_net_fuzz.c @@ -151,7 +151,7 @@ static void *virtio_net_test_setup_socket(GString *cmd_= line, void *arg) { int ret =3D socketpair(PF_UNIX, SOCK_STREAM, 0, sockfds); g_assert_cmpint(ret, !=3D, -1); - fcntl(sockfds[0], F_SETFL, O_NONBLOCK); + g_unix_set_fd_nonblocking(sockfds[0], true, NULL); sockfds_initialized =3D true; g_string_append_printf(cmd_line, " -netdev socket,fd=3D%d,id=3Dhs0 ", sockfds[1]); diff --git a/tests/unit/test-iov.c b/tests/unit/test-iov.c index 0d2ba9ba87d9..93bda00f0e10 100644 --- a/tests/unit/test-iov.c +++ b/tests/unit/test-iov.c @@ -186,7 +186,7 @@ static void test_io(void) =20 close(sv[0]); FD_SET(sv[1], &fds); - fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK); + g_unix_set_fd_nonblocking(sv[1], true, NULL); r =3D g_test_rand_int_range(sz / 2, sz); setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r)); =20 @@ -220,7 +220,7 @@ static void test_io(void) =20 close(sv[1]); FD_SET(sv[0], &fds); - fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK); + g_unix_set_fd_nonblocking(sv[0], true, NULL); r =3D g_test_rand_int_range(sz / 2, sz); setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r)); usleep(500000); diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 2a6f6248ad03..72f25e599dba 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -226,24 +226,12 @@ void qemu_anon_ram_free(void *ptr, size_t size) =20 void qemu_set_block(int fd) { - int f; - f =3D fcntl(fd, F_GETFL); - assert(f !=3D -1); - f =3D fcntl(fd, F_SETFL, f & ~O_NONBLOCK); - assert(f !=3D -1); + g_unix_set_fd_nonblocking(fd, false, NULL); } =20 int qemu_try_set_nonblock(int fd) { - int f; - f =3D fcntl(fd, F_GETFL); - if (f =3D=3D -1) { - return -errno; - } - if (fcntl(fd, F_SETFL, f | O_NONBLOCK) =3D=3D -1) { - return -errno; - } - return 0; + return g_unix_set_fd_nonblocking(fd, true, NULL) ? 0 : -errno; } =20 void qemu_set_nonblock(int fd) --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651619650; cv=none; d=zohomail.com; s=zohoarc; b=EBwAMDLGOAh3mY/5uWDI+CM0hUKJYhw+XfeVnMgqsfWfVNjkMQvZyNDQcXo7tRyYM288Nv+kkByz1rZ+xDnt5jKEv128st3AgQSwSyPxqRbjiR7GlLKtQb5Dv4fH1GZ/SFfJfRWUYk/DSsgKlIHxhnbmFmfk+a6hvFHosSB3Pwg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651619650; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I+ff3zhC/GfxIJDkyOFSY+KkTq2ShUF4jTiBhEYkeus=; b=Mddm4yuCGTb836uLwbxdjjx8ZpDuxxzfdwTBobgvk51oX++V5IXtIi/VqhFKJNsbt+px6Pf63eRh3COW9zWb+68fwwVhwrP8mXP1rQYuPD8Axb1A2E/0PGlyMz4MF/oVduNGlIrC4c1fb1JPMbYJ9+ColPIMkxwfk9yUaI7BpE4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651619650032217.44678821636626; Tue, 3 May 2022 16:14:10 -0700 (PDT) Received: from localhost ([::1]:35228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm1ia-0000nS-QJ for importer@patchew.org; Tue, 03 May 2022 19:14:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzTC-0003z9-Vn for qemu-devel@nongnu.org; Tue, 03 May 2022 16:50:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54919) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzTA-00046y-KW for qemu-devel@nongnu.org; Tue, 03 May 2022 16:50:06 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-663-FvIebvVCOLOUl9wU3t_R2Q-1; Tue, 03 May 2022 11:35:27 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FC5828C8020; Tue, 3 May 2022 13:01:50 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id B5983428F05; Tue, 3 May 2022 13:01:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651611004; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=I+ff3zhC/GfxIJDkyOFSY+KkTq2ShUF4jTiBhEYkeus=; b=fdDDHzozGJATYT62DMUO5K6mt5srK7kzwuSCG4tif7PHlS0mxFy9sStCwdX2umsPNait2s 7wL7+cnNUAVAEX27IzPn61R6G2Lk6sadbJSfrkKRCpJVrCRH91a3HeKIoRS8oOE+tCYptx FDAxOgaLXVHGVOpisi+2ThuqGcHoFC4= X-MC-Unique: FvIebvVCOLOUl9wU3t_R2Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 15/23] io: make qio_channel_command_new_pid() static Date: Tue, 3 May 2022 17:00:15 +0400 Message-Id: <20220503130023.180544-16-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651619652002100001 From: Marc-Andr=C3=A9 Lureau The function isn't used outside of qio_channel_command_new_spawn(), which is !win32-specific. Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Richard Henderson --- include/io/channel-command.h | 25 ------------------------- io/channel-command.c | 26 ++++++++++++++++++++++---- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/include/io/channel-command.h b/include/io/channel-command.h index 27e42bdadc71..305ac1d28066 100644 --- a/include/io/channel-command.h +++ b/include/io/channel-command.h @@ -45,31 +45,6 @@ struct QIOChannelCommand { }; =20 =20 -/** - * qio_channel_command_new_pid: - * @writefd: the FD connected to the command's stdin - * @readfd: the FD connected to the command's stdout - * @pid: the PID of the running child command - * @errp: pointer to a NULL-initialized error object - * - * Create a channel for performing I/O with the - * previously spawned command identified by @pid. - * The two file descriptors provide the connection - * to command's stdio streams, either one or which - * may be -1 to indicate that stream is not open. - * - * The channel will take ownership of the process - * @pid and will kill it when closing the channel. - * Similarly it will take responsibility for - * closing the file descriptors @writefd and @readfd. - * - * Returns: the command channel object, or NULL on error - */ -QIOChannelCommand * -qio_channel_command_new_pid(int writefd, - int readfd, - pid_t pid); - /** * qio_channel_command_new_spawn: * @argv: the NULL terminated list of command arguments diff --git a/io/channel-command.c b/io/channel-command.c index 539685ea8340..0790ac7895c0 100644 --- a/io/channel-command.c +++ b/io/channel-command.c @@ -26,8 +26,28 @@ #include "qemu/sockets.h" #include "trace.h" =20 - -QIOChannelCommand * +#ifndef WIN32 +/** + * qio_channel_command_new_pid: + * @writefd: the FD connected to the command's stdin + * @readfd: the FD connected to the command's stdout + * @pid: the PID of the running child command + * @errp: pointer to a NULL-initialized error object + * + * Create a channel for performing I/O with the + * previously spawned command identified by @pid. + * The two file descriptors provide the connection + * to command's stdio streams, either one or which + * may be -1 to indicate that stream is not open. + * + * The channel will take ownership of the process + * @pid and will kill it when closing the channel. + * Similarly it will take responsibility for + * closing the file descriptors @writefd and @readfd. + * + * Returns: the command channel object, or NULL on error + */ +static QIOChannelCommand * qio_channel_command_new_pid(int writefd, int readfd, pid_t pid) @@ -44,8 +64,6 @@ qio_channel_command_new_pid(int writefd, return ioc; } =20 - -#ifndef WIN32 QIOChannelCommand * qio_channel_command_new_spawn(const char *const argv[], int flags, --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613254; cv=none; d=zohomail.com; s=zohoarc; b=L2x7Ucw0O8b8EIl5+GztxIqIV3XhQ93M6/IRKpHyxzgoGILlTf5AHaj3N5mAG5OKFU7uVmYN8wWoZEvjfjtyAF7fVDQe5PdFYdL8TzhxJyARl42YGuOsOYEad4f+ruV9EH0uxfwrMxYDeBVUcu7ks6KZeRsTZBt/PkohTd50oqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613254; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kh5wpND6rfzlVoSuObqAw+C4AMVRJDb7YQyc66fcC3E=; b=VtMcAt8Fg0hr7qncxqPwnWH1iKKuxAsSLqYN3BIsi5lRzO6QtJCZUXnTYsuKrooZbqnAleWt0wFbCHls5fSJDoo6OMi8RdV3SQUc5d4mxU+k1g7/XHIhoj37Anfe5SL32Vxh1+I+9M0LF0oII96CU3pyY6p1ybCErt71/vcvJZ4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613254647302.61562196760826; Tue, 3 May 2022 14:27:34 -0700 (PDT) Received: from localhost ([::1]:41708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm03R-0000IN-7i for importer@patchew.org; Tue, 03 May 2022 17:27:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlypg-0000wK-Ay for qemu-devel@nongnu.org; Tue, 03 May 2022 16:09:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:23605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlype-0000eV-1o for qemu-devel@nongnu.org; Tue, 03 May 2022 16:09:15 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-390-VluoNF9BOeuSVSSKZqg1dQ-1; Tue, 03 May 2022 11:35:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0CC828C8023; Tue, 3 May 2022 13:01:54 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1CF14C28100; Tue, 3 May 2022 13:01:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608553; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kh5wpND6rfzlVoSuObqAw+C4AMVRJDb7YQyc66fcC3E=; b=hn44R2eRPIM+Wvnwzm/xQicC+2P3bZQBahYopeAev/Q4zb7SLklEMpmWSy5ij4+TI8Zt3+ 4hiSG6XbfSD7cLkHlUNnRpUQG1emEDNsqA70agxs8V/C0sJwSNTqexghYscdBhG/Q9WBv3 W73Qgh635AeK4LYxOGUNF98c7A2ZtJQ= X-MC-Unique: VluoNF9BOeuSVSSKZqg1dQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 16/23] chardev: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:16 +0400 Message-Id: <20220503130023.180544-17-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613255881100001 From: Marc-Andr=C3=A9 Lureau Those calls are either for non-socket fd, or are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- chardev/char-fd.c | 4 ++-- chardev/char-pty.c | 5 ++++- chardev/char-serial.c | 5 ++++- chardev/char-stdio.c | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/chardev/char-fd.c b/chardev/char-fd.c index 6ec9682b22f2..cf7845484174 100644 --- a/chardev/char-fd.c +++ b/chardev/char-fd.c @@ -212,8 +212,8 @@ void qemu_chr_open_fd(Chardev *chr, FDChardev *s =3D FD_CHARDEV(chr); g_autofree char *name =3D NULL; =20 - if (fd_out >=3D 0) { - qemu_set_nonblock(fd_out); + if (fd_out >=3D 0 && !g_unix_set_fd_nonblocking(fd_out, true, NULL)) { + assert(!"Failed to set FD nonblocking"); } =20 if (fd_out =3D=3D fd_in && fd_in >=3D 0) { diff --git a/chardev/char-pty.c b/chardev/char-pty.c index 1e2863f532a8..53f25c6bbd0c 100644 --- a/chardev/char-pty.c +++ b/chardev/char-pty.c @@ -324,7 +324,10 @@ static void char_pty_open(Chardev *chr, } =20 close(slave_fd); - qemu_set_nonblock(master_fd); + if (!g_unix_set_fd_nonblocking(master_fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return; + } =20 chr->filename =3D g_strdup_printf("pty:%s", pty_name); qemu_printf("char device redirected to %s (label %s)\n", diff --git a/chardev/char-serial.c b/chardev/char-serial.c index 7c3d84ae243e..4b0b83d5b45e 100644 --- a/chardev/char-serial.c +++ b/chardev/char-serial.c @@ -271,7 +271,10 @@ static void qmp_chardev_open_serial(Chardev *chr, if (fd < 0) { return; } - qemu_set_nonblock(fd); + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return; + } tty_serial_init(fd, 115200, 'N', 8, 1); =20 qemu_chr_open_fd(chr, fd, fd); diff --git a/chardev/char-stdio.c b/chardev/char-stdio.c index 403da308c980..3c648678ab14 100644 --- a/chardev/char-stdio.c +++ b/chardev/char-stdio.c @@ -103,7 +103,10 @@ static void qemu_chr_open_stdio(Chardev *chr, stdio_in_use =3D true; old_fd0_flags =3D fcntl(0, F_GETFL); tcgetattr(0, &oldtty); - qemu_set_nonblock(0); + if (!g_unix_set_fd_nonblocking(0, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return; + } atexit(term_exit); =20 memset(&act, 0, sizeof(act)); --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651615958; cv=none; d=zohomail.com; s=zohoarc; b=fDOtTNoj97d6lToPBj6n3KwYXjDBfzyBxxrUEAOMxQlAicaYcwPbWgHVx+T7DiARmzjM1yUaRsrtPQtpjoKQxqtBxrRz8kYAN8KZIw3qzEydrv1lM4gbMVEz0VN+e04A+bZ/nPHwoKjn8Iw+rnJqeAuE9+ELJ4kX1vEnWik42bk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651615958; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VWa9f4ka4YuAHq4UDl7U25CVSPUkZoYaRrxqfWzujgo=; b=i+5KflUnyMcu5C+9N3HuRsUfSNMIqzvKowJDG1p8umiXKj5ZJ1K1F4HkpNGOzGj/OrpAziTjY90cPB55H/xkwHP3gMcPErtTTnkisjBaguM88DkGsCr10vuxeNHEIbWVoNqY5zSsW0hSxSEkftx6eDOd8rEFsj8jBSC+Umfvwc8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651615958512435.71393530548767; Tue, 3 May 2022 15:12:38 -0700 (PDT) Received: from localhost ([::1]:47516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0l3-0007pX-81 for importer@patchew.org; Tue, 03 May 2022 18:12:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46516) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz2s-0006LF-VW for qemu-devel@nongnu.org; Tue, 03 May 2022 16:22:54 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz2r-0005CM-9V for qemu-devel@nongnu.org; Tue, 03 May 2022 16:22:54 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-34-90jdjp_ZMFqcj7iRXpZnHg-1; Tue, 03 May 2022 11:34:51 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C5E27131AE55; Tue, 3 May 2022 13:01:58 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED8AB400F75E; Tue, 3 May 2022 13:01:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VWa9f4ka4YuAHq4UDl7U25CVSPUkZoYaRrxqfWzujgo=; b=VLDrmIjYOqg+QW11ynq226M+gGJN7bz6l9cgZ5VXQePI8SkT1wSEM0Cw6T+W/ITVMSOX+8 CQRdDxanjJs2bTpOt21o0kzcaU1v0FkmeSuwnzyH2qTWx75Bp/r6GxF4MCl0W0+knWS5x/ vcWoC/gjedB7tleM/8FAcG7LqY1HYz8= X-MC-Unique: 90jdjp_ZMFqcj7iRXpZnHg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 17/23] io: replace qemu_set{_non}block() Date: Tue, 3 May 2022 17:00:17 +0400 Message-Id: <20220503130023.180544-18-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651615959986100001 From: Marc-Andr=C3=A9 Lureau Those calls are non-socket fd, or are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- io/channel-command.c | 16 +++++++++------- io/channel-file.c | 13 +++++++++---- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/io/channel-command.c b/io/channel-command.c index 0790ac7895c0..4a1f969aaa8e 100644 --- a/io/channel-command.c +++ b/io/channel-command.c @@ -301,16 +301,18 @@ static int qio_channel_command_set_blocking(QIOChanne= l *ioc, bool enabled, Error **errp) { +#ifdef WIN32 + /* command spawn is not supported on win32 */ + g_assert_not_reached(); +#else QIOChannelCommand *cioc =3D QIO_CHANNEL_COMMAND(ioc); =20 - if (enabled) { - qemu_set_block(cioc->writefd); - qemu_set_block(cioc->readfd); - } else { - qemu_set_nonblock(cioc->writefd); - qemu_set_nonblock(cioc->readfd); + if (!g_unix_set_fd_nonblocking(cioc->writefd, !enabled, NULL) || + !g_unix_set_fd_nonblocking(cioc->readfd, !enabled, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; } - +#endif return 0; } =20 diff --git a/io/channel-file.c b/io/channel-file.c index d7cf6d278ff9..d146ace7db9f 100644 --- a/io/channel-file.c +++ b/io/channel-file.c @@ -139,14 +139,19 @@ static int qio_channel_file_set_blocking(QIOChannel *= ioc, bool enabled, Error **errp) { +#ifdef WIN32 + /* not implemented */ + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; +#else QIOChannelFile *fioc =3D QIO_CHANNEL_FILE(ioc); =20 - if (enabled) { - qemu_set_block(fioc->fd); - } else { - qemu_set_nonblock(fioc->fd); + if (!g_unix_set_fd_nonblocking(fioc->fd, !enabled, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; } return 0; +#endif } =20 =20 --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651618703; cv=none; d=zohomail.com; s=zohoarc; b=X/5aIcO3zrB2YJ5TsJURxLcj7s2Y76Y9Hn908uPa4z2S7gxP2nD9pqy7zvnuiP0YNYInH0gVgNJE2YxG7NOD9++a+dZ+/VAGg7JZRQqyGgEg3t/gHWqiB3Jh83vFCCfp2CEE7IV2wrdB2vwK8mf1wDDnZAUEBbQOw9EPVnmWEFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651618703; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GeRNkgt6+1qnaLnhDd/WZh7qwSJ7BxYvRZ2SVl8Xe+M=; b=bnah5wxce9k+6Z5Eqc5eNXFibOBq2D6zVSEjSr5AJ/KmpZ/H9sM+V9iLwexBANQr534G9pp+BseND6nmO3UQ2VK49IX/RkvlubIEBVy7haFEY+0Eaa9rhcZH7dh1LIenIkccMGEV5REJgbAHTW5A/HIC+hzQK14y2nuZVPJgpxc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16516187034421005.5096217312671; Tue, 3 May 2022 15:58:23 -0700 (PDT) Received: from localhost ([::1]:55300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm1TK-0001hi-3C for importer@patchew.org; Tue, 03 May 2022 18:58:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzKC-0006J4-9V for qemu-devel@nongnu.org; Tue, 03 May 2022 16:40:48 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20422) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlzKA-000279-Nr for qemu-devel@nongnu.org; Tue, 03 May 2022 16:40:47 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-7giV7CW3M9uzYmMaKx-8mQ-1; Tue, 03 May 2022 11:35:32 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 107A228C802C; Tue, 3 May 2022 13:02:03 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A180153AD3A; Tue, 3 May 2022 13:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651610446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GeRNkgt6+1qnaLnhDd/WZh7qwSJ7BxYvRZ2SVl8Xe+M=; b=O2p2rZtZcNxcqr6b0tW1AMu4ANKirz9ZJnZZbe6kMl7QzRDeyOQz4Ge/nP/aKU9oBXEz+2 8bzxHuGUfj4O3TrblJ5Qjf4u1P8buyA6wzSGueMcgrVfocxYgCOF0+3y450ovFw7RJH1g4 bTzb2qWtL+Pe9T4J0PA5MHjbhbBEqRw= X-MC-Unique: 7giV7CW3M9uzYmMaKx-8mQ-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 18/23] qga: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:18 +0400 Message-Id: <20220503130023.180544-19-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651618704604100001 From: Marc-Andr=C3=A9 Lureau The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- qga/commands-posix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 094487c2c395..78f2f210015d 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -404,7 +404,11 @@ int64_t qmp_guest_file_open(const char *path, bool has= _mode, const char *mode, /* set fd non-blocking to avoid common use cases (like reading from a * named pipe) from hanging the agent */ - qemu_set_nonblock(fileno(fh)); + if (!g_unix_set_fd_nonblocking(fileno(fh), true, NULL)) { + fclose(fh); + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; + } =20 handle =3D guest_file_handle_add(fh, errp); if (handle < 0) { --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651614623; cv=none; d=zohomail.com; s=zohoarc; b=LZm2al5SdieuZj8mL/sXK+ln1cAwi2uGA6EHTwXJwUVRBcdJjqoMSbVfv5xMs2iV6rj0BRJwlx/amXhzcafY82GaQpc8Bv6mSxYbcfIz94Sxlbzov1G5PvRaKETv6GbIroc5cjv6W7VRGsOwksL2R+Po+k7ClGTFltPAwBdQCYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651614623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yS1MNt2tjqds9d74XEhJAshMqa8W7jCZ4EhHL0jutdM=; b=lE2lA1w/igbP1ilxqDyuZ7QKYbhxcd23FB/s2yiqnCquc+XLQvgIOYcZskti5RIju0w6gr0qLpFGsc620Mk9FkSDBf/JeNP6A3C8nuY1ZzQFr3mTIaarzOhsu80tc8BkeutZCUlhXidR3zyxjPElgW3Mir+kdSlb4fpkbF6tnX4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651614623958876.1332646276236; Tue, 3 May 2022 14:50:23 -0700 (PDT) Received: from localhost ([::1]:34270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0PW-000147-Cl for importer@patchew.org; Tue, 03 May 2022 17:50:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyyG-0006nV-RT for qemu-devel@nongnu.org; Tue, 03 May 2022 16:18:10 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26465) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyyB-0003fY-Vt for qemu-devel@nongnu.org; Tue, 03 May 2022 16:18:06 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-261-9Ha06Z59P5uqnz4RR9aACA-1; Tue, 03 May 2022 11:37:17 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 76183984B56; Tue, 3 May 2022 13:02:07 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85386428F05; Tue, 3 May 2022 13:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yS1MNt2tjqds9d74XEhJAshMqa8W7jCZ4EhHL0jutdM=; b=QHCuuNML28d2STe+PRTWsYVGNjRusTp5qBX0wvrbLfOyuWyd3sTZe7dUtWSdceNnYyj9Td r2nimktGzUkrTHTE53m0IqQliZPkYjEqTpgiyY1VZb29HOnNbWtC72o2suff6NZTdijHZ1 qpSWrUzrJomJXVl1La4HQEkv6v6U/3k= X-MC-Unique: 9Ha06Z59P5uqnz4RR9aACA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 19/23] hw: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:19 +0400 Message-Id: <20220503130023.180544-20-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651614624928100001 From: Marc-Andr=C3=A9 Lureau Those calls are non-socket fd, or are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- hw/input/virtio-input-host.c | 5 ++++- hw/virtio/vhost-vsock.c | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/input/virtio-input-host.c b/hw/input/virtio-input-host.c index 137efba57b0f..fea7139382a1 100644 --- a/hw/input/virtio-input-host.c +++ b/hw/input/virtio-input-host.c @@ -114,7 +114,10 @@ static void virtio_input_host_realize(DeviceState *dev= , Error **errp) error_setg_file_open(errp, errno, vih->evdev); return; } - qemu_set_nonblock(vih->fd); + if (!g_unix_set_fd_nonblocking(vih->fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + goto err_close; + } =20 rc =3D ioctl(vih->fd, EVIOCGVERSION, &ver); if (rc < 0) { diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 433d42d897df..714046210bd3 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -149,9 +149,8 @@ static void vhost_vsock_device_realize(DeviceState *dev= , Error **errp) return; } =20 - ret =3D qemu_try_set_nonblock(vhostfd); - if (ret < 0) { - error_setg_errno(errp, -ret, + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, "vhost-vsock: unable to set non-blocking mode= "); return; } @@ -163,7 +162,11 @@ static void vhost_vsock_device_realize(DeviceState *de= v, Error **errp) return; } =20 - qemu_set_nonblock(vhostfd); + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, + "Failed to set FD nonblocking"); + return; + } } =20 vhost_vsock_common_realize(vdev, "vhost-vsock"); --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651614728; cv=none; d=zohomail.com; s=zohoarc; b=WFZixE2akCXwkJ9fT5Vb/KalHzgw9o13MsCOL9VgWyOm977xcnvbYGHgRJolNnad7E1ArQWVuHgoiX1wqMsGLOWleCHz3EgpXtQ/Hkw9IhlzPyS8sAcaoG9ezqGOGDid+XZB1dZUXZYR9VhJO3lStfkRi6jxLU5aZXlhh9uLlQs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651614728; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RQBsgcrQOkDnPF+L/WmSPlub4EeftGUv7eS99iC3nn8=; b=g6D5G5wL+62vAeHWmVFO2kqo6lhVVdN4mcU1EJ07elLdtQmK8i3xQHcaafE2fNUJGztUnwtmBdctrZbaz0/5x6BFat5ZvrDiKr3l/ySqkNpW9ItqtJiu3NkHdHael1FzNnuZfoS3EBRp1m5dwr4jh4QbopdZBDPqh8osLZeja5s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651614728366824.7989936345048; Tue, 3 May 2022 14:52:08 -0700 (PDT) Received: from localhost ([::1]:37724 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0RD-0004Sy-83 for importer@patchew.org; Tue, 03 May 2022 17:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46288) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz1P-00038Y-CB for qemu-devel@nongnu.org; Tue, 03 May 2022 16:21:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:22474) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz1N-00053h-Lw for qemu-devel@nongnu.org; Tue, 03 May 2022 16:21:23 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-tLrAXL3SPoWuKhLXhBCa3Q-1; Tue, 03 May 2022 11:36:07 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 700901CCF92C; Tue, 3 May 2022 13:02:14 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8693C53CD; Tue, 3 May 2022 13:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RQBsgcrQOkDnPF+L/WmSPlub4EeftGUv7eS99iC3nn8=; b=XPKlG1usapA7RFPuaWgrgMj6H0YN+3zclGU8gdBNxLNS749Kbtli2o2Y0n+2/+vi/YuCwK r1w/J4Sx/IIWCc/mRr6cAH0tKRr4//PYsDlcX+idL4AmISCr0+oxGjIgrzSLZ3YOzpoe9v vVxNRN4Aiaz3U2lf25vKKoj/MbouHN8= X-MC-Unique: tLrAXL3SPoWuKhLXhBCa3Q-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 20/23] ui: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:20 +0400 Message-Id: <20220503130023.180544-21-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651614729318100001 From: Marc-Andr=C3=A9 Lureau The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- ui/input-linux.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/input-linux.c b/ui/input-linux.c index 05c0c988199a..e572a2e905b9 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -316,7 +316,10 @@ static void input_linux_complete(UserCreatable *uc, Er= ror **errp) error_setg_file_open(errp, errno, il->evdev); return; } - qemu_set_nonblock(il->fd); + if (!g_unix_set_fd_nonblocking(il->fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return; + } =20 rc =3D ioctl(il->fd, EVIOCGVERSION, &ver); if (rc < 0) { --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651619036; cv=none; d=zohomail.com; s=zohoarc; b=OMaW6rPSxzPpuXT0ZL7MOEBwUrkZWCj1T9Tt4jYBLI+DPvbLuHxYMl+cJhC5JtRqd0EXVCQaq0coPyA00gI5FW7vlNWe+dq6kYiJxnMw+tifIefcwDHx3gtkwY3DdBAU2zvHKhcFDQlp5RZhznrBpttbS8d/0C1hCAlCw0fOyV0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651619036; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YsouEnbuV9GgcrLCY8Gl7wv7pcLj+IAKuA5BuvZSaFk=; b=ddZqev/pHkIlCcp8NPyoHu6Bvrq6KkTOtxzq0AyL27nfDrRLSM7mq0HvEM6sa3pw7U50/xfF2h4WU27wKmGl+BIeHws8kek2dGyhQ6HzEgj8rjgskhyUcFKT2jwQQ0g1ufkQ+zs3MWSuvX7ILi9RMfB9jzzbFBwgdEI0qzPrraM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651619036119357.1077666731152; Tue, 3 May 2022 16:03:56 -0700 (PDT) Received: from localhost ([::1]:36762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm1Yg-0008Es-Vr for importer@patchew.org; Tue, 03 May 2022 19:03:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz9a-0002Ke-63 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:29:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58839) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz9Y-0006ma-88 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:29:49 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-48-U2L6COjHN9qXfo7sMjfXOA-1; Tue, 03 May 2022 11:36:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EC10BABE6A9; Tue, 3 May 2022 13:02:18 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBA29C27EB9; Tue, 3 May 2022 13:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YsouEnbuV9GgcrLCY8Gl7wv7pcLj+IAKuA5BuvZSaFk=; b=GpM/RaTmRWMPEadbzbvzoZpwxd9GlDl3cslTZ5ZHyNhtg60PEKurQ5RE9YKRETp3oTt+ak 9k9zcj9SVWUwrcrLDgZMOmhUZeujH9xaYlKQKNMG+hbPYvUIjFCmviEAxxOP50MYub2qTn NYcHSAiXP6JRzbQT3kWBr/k9U3wp7g8= X-MC-Unique: U2L6COjHN9qXfo7sMjfXOA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 21/23] net: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:21 +0400 Message-Id: <20220503130023.180544-22-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651619036872100001 From: Marc-Andr=C3=A9 Lureau Those calls are POSIX-specific. Use the dedicated GLib API. (qemu_set_nonblock() is for socket-like) (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 --- net/tap.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/net/tap.c b/net/tap.c index 6190fa699d2f..b3ddfd4a74b1 100644 --- a/net/tap.c +++ b/net/tap.c @@ -619,7 +619,10 @@ int net_init_bridge(const Netdev *netdev, const char *= name, return -1; } =20 - qemu_set_nonblock(fd); + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; + } vnet_hdr =3D tap_probe_vnet_hdr(fd, errp); if (vnet_hdr < 0) { close(fd); @@ -716,8 +719,6 @@ static void net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, } =20 if (vhostfdname) { - int ret; - vhostfd =3D monitor_fd_param(monitor_cur(), vhostfdname, &err); if (vhostfd =3D=3D -1) { if (tap->has_vhostforce && tap->vhostforce) { @@ -727,9 +728,8 @@ static void net_init_tap_one(const NetdevTapOptions *ta= p, NetClientState *peer, } return; } - ret =3D qemu_try_set_nonblock(vhostfd); - if (ret < 0) { - error_setg_errno(errp, -ret, "%s: Can't use file descripto= r %d", + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, "%s: Can't use file descript= or %d", name, fd); return; } @@ -745,7 +745,10 @@ static void net_init_tap_one(const NetdevTapOptions *t= ap, NetClientState *peer, } return; } - qemu_set_nonblock(vhostfd); + if (!g_unix_set_fd_nonblocking(vhostfd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblockin= g"); + return; + } } options.opaque =3D (void *)(uintptr_t)vhostfd; options.nvqs =3D 2; @@ -832,9 +835,8 @@ int net_init_tap(const Netdev *netdev, const char *name, return -1; } =20 - ret =3D qemu_try_set_nonblock(fd); - if (ret < 0) { - error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d= ", + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + error_setg_errno(errp, errno, "%s: Can't use file descriptor %= d", name, fd); close(fd); return -1; @@ -889,9 +891,9 @@ int net_init_tap(const Netdev *netdev, const char *name, goto free_fail; } =20 - ret =3D qemu_try_set_nonblock(fd); - if (ret < 0) { - error_setg_errno(errp, -ret, "%s: Can't use file descripto= r %d", + ret =3D g_unix_set_fd_nonblocking(fd, true, NULL); + if (!ret) { + error_setg_errno(errp, errno, "%s: Can't use file descript= or %d", name, fd); goto free_fail; } @@ -946,7 +948,10 @@ free_fail: return -1; } =20 - qemu_set_nonblock(fd); + if (!g_unix_set_fd_nonblocking(fd, true, NULL)) { + error_setg_errno(errp, errno, "Failed to set FD nonblocking"); + return -1; + } vnet_hdr =3D tap_probe_vnet_hdr(fd, errp); if (vnet_hdr < 0) { close(fd); --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651612663; cv=none; d=zohomail.com; s=zohoarc; b=FIkRb509lMpzqE4v5bqmay+j+go3Tyjb91oImkWVFT0X0olYG/AoPaB4jYm1sjaffRA7k5dI15j6lGArDZBq+XR/rZvkPkkdzEIPNyAy0LZx/NrQ19GGhkJUjnwyk5XLm1YwzppS10Hrhp8Q43Gk/5YdfCsMEeWYABmWKyxJSEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651612663; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=u0kPCdRap4Su4q5ht4TFzvIC2bhKM90/WOgTnCO2EwI=; b=XXEm7sQCSM/yzLbYtEiRiCQkMUi17kgmhup4W1xeBvh9NHToa6oo3cRq2LfKATNixAZzDx/8AxI3VI1hQeArLpc5LxikrdHpHh98ArNRtRvq1d8p+Nr+v6XsApx556gyOU/IQY2JHHR0eLTkBzo0igPEEJEjxIu+H++h2mFwPWk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651612663510552.3742754468891; Tue, 3 May 2022 14:17:43 -0700 (PDT) Received: from localhost ([::1]:50186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nlztu-0003HT-Fk for importer@patchew.org; Tue, 03 May 2022 17:17:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44054) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyqc-0002iV-Kf for qemu-devel@nongnu.org; Tue, 03 May 2022 16:10:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32141) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlyqa-0002Sc-Vr for qemu-devel@nongnu.org; Tue, 03 May 2022 16:10:14 -0400 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-177-JEpQJBxuOUqj-dDTII0yzg-1; Tue, 03 May 2022 11:36:55 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C53001CCF937; Tue, 3 May 2022 13:02:25 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2A6D2024CC6; Tue, 3 May 2022 13:02:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651608612; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u0kPCdRap4Su4q5ht4TFzvIC2bhKM90/WOgTnCO2EwI=; b=G+MVodjIikf3ZJxsbI/fSO2QJhtcSE179ioQdbamTwLWfOss5AHhcQs58tJNSocrGjM2up OHVH1foMsBV47hl2UvhpWib7lmR1lmyE7mHFcq13QJjeCHcV6XPbHnIbVOUpJb/MJle5eX ycUJ3nXowtxcArAJryHRdjn9ITPTnpA= X-MC-Unique: JEpQJBxuOUqj-dDTII0yzg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 22/23] tests: replace qemu_set_nonblock() Date: Tue, 3 May 2022 17:00:22 +0400 Message-Id: <20220503130023.180544-23-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651612665264100001 From: Marc-Andr=C3=A9 Lureau The call is POSIX-specific. Use the dedicated GLib API. (this is a preliminary patch before renaming qemu_set_nonblock()) Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Thomas Huth --- tests/qtest/vhost-user-test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/vhost-user-test.c b/tests/qtest/vhost-user-test.c index ee30f5479648..a2cec8768462 100644 --- a/tests/qtest/vhost-user-test.c +++ b/tests/qtest/vhost-user-test.c @@ -302,6 +302,7 @@ static int chr_can_read(void *opaque) =20 static void chr_read(void *opaque, const uint8_t *buf, int size) { + g_autoptr(GError) err =3D NULL; TestServer *s =3D opaque; CharBackend *chr =3D &s->chr; VhostUserMsg msg; @@ -394,7 +395,8 @@ static void chr_read(void *opaque, const uint8_t *buf, = int size) * The receive function forces it to be blocking, * so revert it back to non-blocking. */ - qemu_set_nonblock(fd); + g_unix_set_fd_nonblocking(fd, true, &err); + g_assert_no_error(err); break; =20 case VHOST_USER_SET_LOG_BASE: --=20 2.36.0.44.g0f828332d5ac From nobody Sat May 11 11:51:25 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1651613762; cv=none; d=zohomail.com; s=zohoarc; b=JxrWAXJygv9r8HeEg9BCF8Uog7HFCD9+2gU1RXj1CtaHVmuv4g/B3VLv6fVSXc7fE9hEEkfy9Inhprq6ir/ajHcoJlPgHWJQRRqUyVhREoXQDfm/a1uZ7EIaIp2O/z9uEE5+5q8PCD82/ZN6wDOQdxAqC25bKok3JtUbWMEIlm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651613762; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ath0I+YpFYfi5D/WBhzoab2jtqGjLmdzRZiFt4Deeo8=; b=amG+DF6gY05ZDcH+2LvltMT/bNBNGEkqRPr0O5Na/nS+O+s9YyhwCTRLVIfOZ6qnJI/T/hDY1MEzPTwsXj9Md+XpKGdGQ3sIBwds5E9TxnDIi89+lwimSgBtvzkyp8dD1ULFQbuVIVBbz7i4d3iGfYMoZe/ZKtYXh8lnHUTCrvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1651613762308356.14758797239335; Tue, 3 May 2022 14:36:02 -0700 (PDT) Received: from localhost ([::1]:60336 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nm0Bd-0004IT-6b for importer@patchew.org; Tue, 03 May 2022 17:36:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz3E-0007Gr-Ig for qemu-devel@nongnu.org; Tue, 03 May 2022 16:23:17 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49182) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nlz3C-0005ED-E0 for qemu-devel@nongnu.org; Tue, 03 May 2022 16:23:16 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-228-6HNC6-5jNiGg7tF5Ts6LmA-1; Tue, 03 May 2022 11:47:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E26191317FCB; Tue, 3 May 2022 13:02:30 +0000 (UTC) Received: from localhost (unknown [10.39.208.46]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60ADF1537D61; Tue, 3 May 2022 13:02:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651609393; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ath0I+YpFYfi5D/WBhzoab2jtqGjLmdzRZiFt4Deeo8=; b=h70/LS9P5yjrBL1vgtYlhZT0fyL6uCNeSrOkDoTU+v2/ShtGAOyqIGGqFC2BykSRIvH21O 2J0ScB5MSaQfDM3b90yxEt9WuD0MKb+nmFf226pZKMqpAJRQ8mN7l/w2YxdaVkd5WnP4es YGw+6wRk6Z7tdeHIgiS1R+FAWtkMrFY= X-MC-Unique: 6HNC6-5jNiGg7tF5Ts6LmA-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Cc: Peter Maydell , Richard Henderson , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [PULL 23/23] util: rename qemu_*block() socket functions Date: Tue, 3 May 2022 17:00:23 +0400 Message-Id: <20220503130023.180544-24-marcandre.lureau@redhat.com> In-Reply-To: <20220503130023.180544-1-marcandre.lureau@redhat.com> References: <20220503130023.180544-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1651613762975100001 From: Marc-Andr=C3=A9 Lureau The qemu_*block() functions are meant to be be used with sockets (the win32 implementation expects SOCKET) Over time, those functions where used with Win32 SOCKET or file-descriptors interchangeably. But for portability, they must only be used with socket-like file-descriptors. FDs can use g_unix_set_fd_nonblocking() instead. Rename the functions with "socket" in the name to prevent bad usages. This is effectively reverting commit f9e8cacc5557e43 ("oslib-posix: rename socket_set_nonblock() to qemu_set_nonblock()"). Signed-off-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Stefan Hajnoczi --- include/qemu/sockets.h | 6 +++--- chardev/char-socket.c | 2 +- contrib/ivshmem-server/ivshmem-server.c | 2 +- hw/hyperv/syndbg.c | 2 +- hw/virtio/vhost-user.c | 2 +- io/channel-socket.c | 6 +++--- net/l2tpv3.c | 2 +- net/socket.c | 10 +++++----- qga/channel-posix.c | 2 +- tests/unit/socket-helpers.c | 2 +- tests/unit/test-crypto-tlssession.c | 8 ++++---- util/oslib-posix.c | 8 ++++---- util/oslib-win32.c | 8 ++++---- util/vhost-user-server.c | 4 ++-- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 0c34bf23987e..038faa157f59 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -17,9 +17,9 @@ int qemu_socket(int domain, int type, int protocol); int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int socket_set_cork(int fd, int v); int socket_set_nodelay(int fd); -void qemu_set_block(int fd); -int qemu_try_set_nonblock(int fd); -void qemu_set_nonblock(int fd); +void qemu_socket_set_block(int fd); +int qemu_socket_try_set_nonblock(int fd); +void qemu_socket_set_nonblock(int fd); int socket_set_fast_reuse(int fd); =20 #ifdef WIN32 diff --git a/chardev/char-socket.c b/chardev/char-socket.c index fab2d791d43d..dc4e218eeb6a 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -311,7 +311,7 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, si= ze_t len) } =20 /* O_NONBLOCK is preserved across SCM_RIGHTS so reset it */ - qemu_set_block(fd); + qemu_socket_set_block(fd); =20 #ifndef MSG_CMSG_CLOEXEC qemu_set_cloexec(fd); diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-serv= er/ivshmem-server.c index 39a6ffdb5df9..2f3c7320a678 100644 --- a/contrib/ivshmem-server/ivshmem-server.c +++ b/contrib/ivshmem-server/ivshmem-server.c @@ -146,7 +146,7 @@ ivshmem_server_handle_new_conn(IvshmemServer *server) return -1; } =20 - qemu_set_nonblock(newfd); + qemu_socket_set_nonblock(newfd); IVSHMEM_SERVER_DEBUG(server, "accept()=3D%d\n", newfd); =20 /* allocate new structure for this peer */ diff --git a/hw/hyperv/syndbg.c b/hw/hyperv/syndbg.c index ebb8a29f7838..16d04cfdc669 100644 --- a/hw/hyperv/syndbg.c +++ b/hw/hyperv/syndbg.c @@ -334,7 +334,7 @@ static void hv_syndbg_realize(DeviceState *dev, Error *= *errp) return; } =20 - qemu_set_nonblock(syndbg->socket); + qemu_socket_set_nonblock(syndbg->socket); =20 syndbg->servaddr.sin_port =3D htons(syndbg->host_port); syndbg->servaddr.sin_family =3D AF_INET; diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 9c4f84f35f61..a80315ecfc40 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -1826,7 +1826,7 @@ static int vhost_user_postcopy_advise(struct vhost_de= v *dev, Error **errp) error_setg(errp, "%s: Failed to get ufd", __func__); return -EIO; } - qemu_set_nonblock(ufd); + qemu_socket_set_nonblock(ufd); =20 /* register ufd with userfault thread */ u->postcopy_fd.fd =3D ufd; diff --git a/io/channel-socket.c b/io/channel-socket.c index 9f5ddf68b687..e531d7bd2af5 100644 --- a/io/channel-socket.c +++ b/io/channel-socket.c @@ -460,7 +460,7 @@ static void qio_channel_socket_copy_fds(struct msghdr *= msg, } =20 /* O_NONBLOCK is preserved across SCM_RIGHTS so reset it */ - qemu_set_block(fd); + qemu_socket_set_block(fd); =20 #ifndef MSG_CMSG_CLOEXEC qemu_set_cloexec(fd); @@ -665,9 +665,9 @@ qio_channel_socket_set_blocking(QIOChannel *ioc, QIOChannelSocket *sioc =3D QIO_CHANNEL_SOCKET(ioc); =20 if (enabled) { - qemu_set_block(sioc->fd); + qemu_socket_set_block(sioc->fd); } else { - qemu_set_nonblock(sioc->fd); + qemu_socket_set_nonblock(sioc->fd); } return 0; } diff --git a/net/l2tpv3.c b/net/l2tpv3.c index b8faa8796c8f..af373e5c300c 100644 --- a/net/l2tpv3.c +++ b/net/l2tpv3.c @@ -716,7 +716,7 @@ int net_init_l2tpv3(const Netdev *netdev, s->vec =3D g_new(struct iovec, MAX_L2TPV3_IOVCNT); s->header_buf =3D g_malloc(s->header_size); =20 - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); =20 s->fd =3D fd; s->counter =3D 0; diff --git a/net/socket.c b/net/socket.c index ea5220a2eb51..bfd8596250c4 100644 --- a/net/socket.c +++ b/net/socket.c @@ -297,7 +297,7 @@ static int net_socket_mcast_create(struct sockaddr_in *= mcastaddr, } } =20 - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); return fd; fail: if (fd >=3D 0) @@ -522,7 +522,7 @@ static int net_socket_listen_init(NetClientState *peer, error_setg_errno(errp, errno, "can't create stream socket"); return -1; } - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); =20 socket_set_fast_reuse(fd); =20 @@ -570,7 +570,7 @@ static int net_socket_connect_init(NetClientState *peer, error_setg_errno(errp, errno, "can't create stream socket"); return -1; } - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); =20 connected =3D 0; for(;;) { @@ -688,7 +688,7 @@ static int net_socket_udp_init(NetClientState *peer, closesocket(fd); return -1; } - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); =20 s =3D net_socket_fd_init(peer, model, name, fd, 0, NULL, errp); if (!s) { @@ -730,7 +730,7 @@ int net_init_socket(const Netdev *netdev, const char *n= ame, if (fd =3D=3D -1) { return -1; } - ret =3D qemu_try_set_nonblock(fd); + ret =3D qemu_socket_try_set_nonblock(fd); if (ret < 0) { error_setg_errno(errp, -ret, "%s: Can't use file descriptor %d= ", name, fd); diff --git a/qga/channel-posix.c b/qga/channel-posix.c index 03739753607d..a996858e2492 100644 --- a/qga/channel-posix.c +++ b/qga/channel-posix.c @@ -34,7 +34,7 @@ static gboolean ga_channel_listen_accept(GIOChannel *chan= nel, g_warning("error converting fd to gsocket: %s", strerror(errno)); goto out; } - qemu_set_nonblock(client_fd); + qemu_socket_set_nonblock(client_fd); ret =3D ga_channel_client_add(c, client_fd); if (ret) { g_warning("error setting up connection"); diff --git a/tests/unit/socket-helpers.c b/tests/unit/socket-helpers.c index 0a9e090a68dd..5af4de513bb6 100644 --- a/tests/unit/socket-helpers.c +++ b/tests/unit/socket-helpers.c @@ -88,7 +88,7 @@ static int socket_can_bind_connect(const char *hostname, = int family) goto cleanup; } =20 - qemu_set_nonblock(cfd); + qemu_socket_set_nonblock(cfd); if (connect(cfd, (struct sockaddr *)&ss, sslen) < 0) { if (errno =3D=3D EINPROGRESS) { check_soerr =3D true; diff --git a/tests/unit/test-crypto-tlssession.c b/tests/unit/test-crypto-t= lssession.c index 5f0da9192c53..a266dc32dac9 100644 --- a/tests/unit/test-crypto-tlssession.c +++ b/tests/unit/test-crypto-tlssession.c @@ -90,8 +90,8 @@ static void test_crypto_tls_session_psk(void) * thread, so we need these non-blocking to avoid deadlock * of ourselves */ - qemu_set_nonblock(channel[0]); - qemu_set_nonblock(channel[1]); + qemu_socket_set_nonblock(channel[0]); + qemu_socket_set_nonblock(channel[1]); =20 clientCreds =3D test_tls_creds_psk_create( QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT, @@ -244,8 +244,8 @@ static void test_crypto_tls_session_x509(const void *op= aque) * thread, so we need these non-blocking to avoid deadlock * of ourselves */ - qemu_set_nonblock(channel[0]); - qemu_set_nonblock(channel[1]); + qemu_socket_set_nonblock(channel[0]); + qemu_socket_set_nonblock(channel[1]); =20 #define CLIENT_CERT_DIR "tests/test-crypto-tlssession-client/" #define SERVER_CERT_DIR "tests/test-crypto-tlssession-server/" diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 72f25e599dba..477990f39baf 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -224,20 +224,20 @@ void qemu_anon_ram_free(void *ptr, size_t size) qemu_ram_munmap(-1, ptr, size); } =20 -void qemu_set_block(int fd) +void qemu_socket_set_block(int fd) { g_unix_set_fd_nonblocking(fd, false, NULL); } =20 -int qemu_try_set_nonblock(int fd) +int qemu_socket_try_set_nonblock(int fd) { return g_unix_set_fd_nonblocking(fd, true, NULL) ? 0 : -errno; } =20 -void qemu_set_nonblock(int fd) +void qemu_socket_set_nonblock(int fd) { int f; - f =3D qemu_try_set_nonblock(fd); + f =3D qemu_socket_try_set_nonblock(fd); assert(f =3D=3D 0); } =20 diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 9c1e8121fd6d..dafef4f15733 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -184,14 +184,14 @@ static int socket_error(void) } } =20 -void qemu_set_block(int fd) +void qemu_socket_set_block(int fd) { unsigned long opt =3D 0; WSAEventSelect(fd, NULL, 0); ioctlsocket(fd, FIONBIO, &opt); } =20 -int qemu_try_set_nonblock(int fd) +int qemu_socket_try_set_nonblock(int fd) { unsigned long opt =3D 1; if (ioctlsocket(fd, FIONBIO, &opt) !=3D NO_ERROR) { @@ -200,9 +200,9 @@ int qemu_try_set_nonblock(int fd) return 0; } =20 -void qemu_set_nonblock(int fd) +void qemu_socket_set_nonblock(int fd) { - (void)qemu_try_set_nonblock(fd); + (void)qemu_socket_try_set_nonblock(fd); } =20 int socket_set_fast_reuse(int fd) diff --git a/util/vhost-user-server.c b/util/vhost-user-server.c index f66fbba7108b..232984ace6d7 100644 --- a/util/vhost-user-server.c +++ b/util/vhost-user-server.c @@ -65,7 +65,7 @@ static void vmsg_unblock_fds(VhostUserMsg *vmsg) { int i; for (i =3D 0; i < vmsg->fd_num; i++) { - qemu_set_nonblock(vmsg->fds[i]); + qemu_socket_set_nonblock(vmsg->fds[i]); } } =20 @@ -270,7 +270,7 @@ set_watch(VuDev *vu_dev, int fd, int vu_evt, =20 vu_fd_watch->fd =3D fd; vu_fd_watch->cb =3D cb; - qemu_set_nonblock(fd); + qemu_socket_set_nonblock(fd); aio_set_fd_handler(server->ioc->ctx, fd, true, kick_handler, NULL, NULL, NULL, vu_fd_watch); vu_fd_watch->vu_dev =3D vu_dev; --=20 2.36.0.44.g0f828332d5ac