From patchwork Thu Apr 23 20:21:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 283986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E47AC54FCB for ; Thu, 23 Apr 2020 20:25:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5714620724 for ; Thu, 23 Apr 2020 20:25:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RWTxVMVy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5714620724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiP8-0003rK-Ay for qemu-devel@archiver.kernel.org; Thu, 23 Apr 2020 16:25:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55366) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiM0-0004ph-DH for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRiLz-0003WS-Rk for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:48 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22526 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRiLz-0003U3-0y for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587673303; 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=tPIOoo9ftY2Y0yP1OPzgpA1jMu3wYHrPWEzYbrSHsC0=; b=RWTxVMVytfxOgyeBYOA88xdntqcb4yVLaFYoLBoPaENs+Rwu8u+lDnb2oMVjm+JeVceEPB eKf7QXu1nyvDRxqNl1qMbFBIrFr5i+WTATWmDRtzy/y+TZ7E6kecTBeByAMJFtT4UW9+z6 wNLVWPLQETGyKH0EIvz4UvvIYAJtHaQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-433-FMlagvOiOguPjkD1qfGTHQ-1; Thu, 23 Apr 2020 16:21:41 -0400 X-MC-Unique: FMlagvOiOguPjkD1qfGTHQ-1 Received: by mail-wr1-f69.google.com with SMTP id i10so3385864wrq.8 for ; Thu, 23 Apr 2020 13:21:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vj0j3jl3RruHPgtbUoMtt40YI86Ylpvpu3a4TUFv2dY=; b=YC3eKzcUBKPNHfdVPsJ4EgjVfARWxIaGObrewTBsuntMTM2cIm9tb2axKWptmovVNv V01tm7DSZunoSc1Ua0NItnJwE5lkhXBC/5SXgDQL3fQA4RfUg0LnYRNCxtoLH//CTqOM NIKGAKj3M+C7E10AfJxcEk84ZBFIBmhBzP2XRUzS1rGGEBFRpn74ibWngXN3mO2jLP0Z 3KWl19jhWsD7j8n5UuBsQbJCMM3KvDoIlEKvdD0ww/f3zavVFTWW9jXNay9oGo5+a0jK rkBWzIY2nvFHvuEL3BNDea8MjwyIvW/gVvwPAzhJl1SCiQzm8YG1nbWdEAAHyaAaaCWx +oUg== X-Gm-Message-State: AGi0PuYSOHrc8uEhMYQ0E1MdSmvMxeSflRxyBizhCeCP5vTbdObbGSjO JyMc+iYlBjVb/MnDV0ZwFVzibGeEue9GjYV27vawa9bZvxCecYxVsoPvJVjOKQdwL63rT/Mg85i Qj/ZaImqYEdiOhnc= X-Received: by 2002:a1c:e906:: with SMTP id q6mr5779516wmc.62.1587673300285; Thu, 23 Apr 2020 13:21:40 -0700 (PDT) X-Google-Smtp-Source: APiQypJ3zhzGof0w8cR8tv/2XdV1bmsbwmF6riz6ZIDurnmMpSjKvwLvDe4tdg+eVKt+WKTDj8izBg== X-Received: by 2002:a1c:e906:: with SMTP id q6mr5779497wmc.62.1587673299991; Thu, 23 Apr 2020 13:21:39 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id x18sm5121841wrs.11.2020.04.23.13.21.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:21:39 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/7] chardev: Reduce "char-mux.h" scope, rename it "chardev-internal.h" Date: Thu, 23 Apr 2020 22:21:09 +0200 Message-Id: <20200423202112.644-5-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200423202112.644-1-philmd@redhat.com> References: <20200423202112.644-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.81; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/23 02:14:02 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.81 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John G Johnson , Jagannathan Raman , "Dr. David Alan Gilbert" , Markus Armbruster , =?utf-8?q?Marc-Andr=C3=A9_Lure?= =?utf-8?q?au?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" No file out of chardev/ requires access to this header, restrict its scope. Signed-off-by: Philippe Mathieu-Daudé --- include/chardev/char-mux.h => chardev/chardev-internal.h | 7 ++++--- chardev/char-fe.c | 2 +- chardev/char-mux.c | 2 +- chardev/char.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) rename include/chardev/char-mux.h => chardev/chardev-internal.h (96%) diff --git a/include/chardev/char-mux.h b/chardev/chardev-internal.h similarity index 96% rename from include/chardev/char-mux.h rename to chardev/chardev-internal.h index 417fe32eed..e0264ac349 100644 --- a/include/chardev/char-mux.h +++ b/chardev/chardev-internal.h @@ -1,5 +1,5 @@ /* - * QEMU System Emulator + * QEMU Character device internals * * Copyright (c) 2003-2008 Fabrice Bellard * @@ -21,8 +21,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#ifndef CHAR_MUX_H -#define CHAR_MUX_H +#ifndef CHARDEV_INTERNAL_H +#define CHARDEV_INTERNAL_H #include "chardev/char.h" #include "chardev/char-fe.h" @@ -30,6 +30,7 @@ #define MAX_MUX 4 #define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */ #define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1) + typedef struct MuxChardev { Chardev parent; CharBackend *backends[MAX_MUX]; diff --git a/chardev/char-fe.c b/chardev/char-fe.c index f3530a90e6..474715c5a9 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -29,7 +29,7 @@ #include "chardev/char-fe.h" #include "chardev/char-io.h" -#include "chardev/char-mux.h" +#include "chardev-internal.h" int qemu_chr_fe_write(CharBackend *be, const uint8_t *buf, int len) { diff --git a/chardev/char-mux.c b/chardev/char-mux.c index 46c44af67c..6f980bb836 100644 --- a/chardev/char-mux.c +++ b/chardev/char-mux.c @@ -29,7 +29,7 @@ #include "chardev/char.h" #include "sysemu/block-backend.h" #include "sysemu/sysemu.h" -#include "chardev/char-mux.h" +#include "chardev-internal.h" /* MUX driver for serial I/O splitting */ diff --git a/chardev/char.c b/chardev/char.c index e77564060d..b672a41150 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -39,7 +39,7 @@ #include "qemu/option.h" #include "qemu/id.h" -#include "chardev/char-mux.h" +#include "chardev-internal.h" /***********************************************************/ /* character device */ From patchwork Thu Apr 23 20:21:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 283987 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AD3AC54FCB for ; Thu, 23 Apr 2020 20:23:44 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 43C2020715 for ; Thu, 23 Apr 2020 20:23:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zln9NDJp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 43C2020715 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:39870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiNr-0000Se-D4 for qemu-devel@archiver.kernel.org; Thu, 23 Apr 2020 16:23:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55394) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiM9-00056e-2k for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRiM8-0003da-BW for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:56 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:44439 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRiM7-0003dT-W2 for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:21:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587673314; 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=aOyVErqFCmyf9pd+Nr+epVzmP7eWXaoL84ISysXFv0Q=; b=Zln9NDJphptNcX3TP8SNVTX5xwA2AhSk8Z4d3viMP3xpCVfi4griM5C434x/eEHdIyrAze glBMYYh6XDAdWf8pXOZZPSWXGBoG1P5UEUQCFSq/BRfYa+JH8VKY8H8vUYI73qXhswRrnQ zOujGeDw+8o9RMi4R5iBmYfCbnnCDvc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-271-Jw5aTiasMhqOwhfWO5B5eA-1; Thu, 23 Apr 2020 16:21:53 -0400 X-MC-Unique: Jw5aTiasMhqOwhfWO5B5eA-1 Received: by mail-wr1-f72.google.com with SMTP id v9so3380384wrt.7 for ; Thu, 23 Apr 2020 13:21:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8gYfBqFeTywo96T3GTdB1ETByq33AuAVSUY1XmaFyaw=; b=LgYPmQxL4iyho6dE3VUMLdfZYNnnu6rUQ64GGSeQCjRt1/ZRRc9Hx2tlQMd2ytGHPl /mNtEwHp7hp6c1Bd2hJq8Uh3Gvl8u1yMTLvwzq5WeG+C3W/BlKU1QdF0Ep3hSx27dfPL FaOGx8FSnSINrletJoIfxXavy+Zq+j0orrd8Ir5mA8JqOUkWEtVSfu4R0rh0Bx1qM2PV ZS25gcRVJIOInFPJI0OQrgjl9p4tQj1+lhOr2exLb4cKo0L0WPX+sZWmY1FiqVdYoJb1 4wrX+/YH+UbLHMNzOtKexRj/36s/olKWkwd+OiArOzKuQOijp7o+ir4PncJqJPYzNloa EDgg== X-Gm-Message-State: AGi0PubdnMNwPUKed84HGtqS60SdD2YSLH5WzMvq3z9JEiPdCZBHcJ4r e4fSwQoY5rpajs61IgCgrza+CMkcO7Fhn2RFbAJfWyNvTK6RltWBL91KhmyioN13FDornmfqnYJ S74ZQuqYwuS8YOB0= X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr6191719wmk.72.1587673311684; Thu, 23 Apr 2020 13:21:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLrHSHmXL1n+qmnOhiwmPwsBhOEScKtOKHLfqMligKeD1o9ZGj3ONDh33mP0lG3nxN3nRqrUw== X-Received: by 2002:a7b:c7d2:: with SMTP id z18mr6191700wmk.72.1587673311445; Thu, 23 Apr 2020 13:21:51 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id a67sm5423740wmc.30.2020.04.23.13.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:21:50 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 6/7] stubs: Split machine-init-done as machine-init and machine-notify Date: Thu, 23 Apr 2020 22:21:11 +0200 Message-Id: <20200423202112.644-7-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200423202112.644-1-philmd@redhat.com> References: <20200423202112.644-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=207.211.31.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/23 16:21:37 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 207.211.31.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John G Johnson , Jagannathan Raman , "Dr. David Alan Gilbert" , Markus Armbruster , =?utf-8?q?Marc-Andr=C3=A9_Lure?= =?utf-8?q?au?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" As the machine notify handlers are only used in system emulation, split the current file in two, and only build the notifier when system emulation is used. Signed-off-by: Philippe Mathieu-Daudé --- stubs/machine-init.c | 4 ++++ stubs/{machine-init-done.c => machine-notify.c} | 2 -- stubs/Makefile.objs | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 stubs/machine-init.c rename stubs/{machine-init-done.c => machine-notify.c} (78%) diff --git a/stubs/machine-init.c b/stubs/machine-init.c new file mode 100644 index 0000000000..7622930ee0 --- /dev/null +++ b/stubs/machine-init.c @@ -0,0 +1,4 @@ +#include "qemu/osdep.h" +#include "sysemu/sysemu.h" + +bool machine_init_done = true; diff --git a/stubs/machine-init-done.c b/stubs/machine-notify.c similarity index 78% rename from stubs/machine-init-done.c rename to stubs/machine-notify.c index cd8e81392d..d164ecccb9 100644 --- a/stubs/machine-init-done.c +++ b/stubs/machine-notify.c @@ -1,8 +1,6 @@ #include "qemu/osdep.h" #include "sysemu/sysemu.h" -bool machine_init_done = true; - void qemu_add_machine_init_done_notifier(Notifier *notify) { } diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index 45be5dc0ed..765659a3f9 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -15,7 +15,8 @@ stub-obj-y += iothread-lock.o stub-obj-y += is-daemonized.o stub-obj-$(CONFIG_LINUX_AIO) += linux-aio.o stub-obj-$(CONFIG_LINUX_IO_URING) += io_uring.o -stub-obj-y += machine-init-done.o +stub-obj-y += machine-init.o +stub-obj-$(CONFIG_SOFTMMU) += machine-notify.o stub-obj-y += migr-blocker.o stub-obj-y += change-state-handler.o stub-obj-y += monitor.o From patchwork Thu Apr 23 20:21:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 283985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26230C54FD0 for ; Thu, 23 Apr 2020 20:26:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E3E2520724 for ; Thu, 23 Apr 2020 20:26:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UNyTq1hm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E3E2520724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:40152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiQG-0006UC-SR for qemu-devel@archiver.kernel.org; Thu, 23 Apr 2020 16:26:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55416) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRiMF-0005Oi-Hj for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:22:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRiME-0003gI-Nk for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:22:03 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29778 helo=us-smtp-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1jRiME-0003g9-8H for qemu-devel@nongnu.org; Thu, 23 Apr 2020 16:22:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587673321; 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=wq10tdmagP4bZ/4I285kBZFNlh6YBL1XlJbyw1tLKw8=; b=UNyTq1hmKiPhlS3CMetjre/NIQ5MO29MOYNfVjbUqKPHykIkRMQWsDfj9jVxCNCaK98W8K 5CP8yt8eqed2vdIBlku7QdW9dSAkBLH/0HK/6tVnpVR+PtQRjiQ0Iw9cW32T5xmwUXQODg e3UhkNr6M1qu0/D8kGXFP+WKnkBG1n4= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-152-Q4yM1LQNNliAFdsg53b8pQ-1; Thu, 23 Apr 2020 16:21:59 -0400 X-MC-Unique: Q4yM1LQNNliAFdsg53b8pQ-1 Received: by mail-wr1-f71.google.com with SMTP id r11so3381938wrx.21 for ; Thu, 23 Apr 2020 13:21:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ar7WwMHZ0+CpcbAoGEZSCSPIuYugOvcLGHNI+3InVx8=; b=WG8apG2vb9yTobcNlK5oIZn+S/6/AcV1VgKzxWf1qOPIL2MOmVeK/+hgiIY5MGGNsr hy1hldMcTZ/yM094UKK7s89ufrMwoHFKZQqVDf7II50Ece0NDFlnDJX4LZ2iB7iVMuQ3 lnyhFsK6YocjjgzNPozK9V4vlSzw8xPZsTk+LtGljYibfO+4fHGF/7EqmpUlO2Pc3tFR zq55VcoftG2v/mTbQf9dr4TfVeaBX/CSAIcVanrk1wWFgrMdX/uEpsLuf5ScO2F0PDUU x9qLRJ5ZORSHfFY1vUZ823idZ/nugbWckUUFox/hXOpm8hQMJlUTvyIskIz7bar8CFSg ckfg== X-Gm-Message-State: AGi0PuZGO5al6sbVaqkdmYGZbvgcRRL8oUT5i6BLtLejZNw0K4XAvIcj ILcyUSi4U/QkF7agesvnNYIYiMtMKdGTlaXBT7APwnmN+VMt2AEwQ9cUTsDNAXsc15eAiDuHbys AxOTX5SfPl66mwUg= X-Received: by 2002:adf:8284:: with SMTP id 4mr6877019wrc.6.1587673318048; Thu, 23 Apr 2020 13:21:58 -0700 (PDT) X-Google-Smtp-Source: APiQypKH9YSaJ+JDgC9pahB+sDTq8Y4XOMtZ0jb+bccjXtPa7WsvKEEXtoqjOLwM/WnoOqI7V7U0Bg== X-Received: by 2002:adf:8284:: with SMTP id 4mr6876984wrc.6.1587673317711; Thu, 23 Apr 2020 13:21:57 -0700 (PDT) Received: from localhost.localdomain (116.red-83-42-57.dynamicip.rima-tde.net. [83.42.57.116]) by smtp.gmail.com with ESMTPSA id c1sm5402925wrc.4.2020.04.23.13.21.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Apr 2020 13:21:57 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 7/7] multi-process: Refactor machine_init and exit notifiers Date: Thu, 23 Apr 2020 22:21:12 +0200 Message-Id: <20200423202112.644-8-philmd@redhat.com> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200423202112.644-1-philmd@redhat.com> References: <20200423202112.644-1-philmd@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Received-SPF: pass client-ip=205.139.110.120; envelope-from=philmd@redhat.com; helo=us-smtp-1.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/04/23 05:42:05 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.120 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John G Johnson , Jagannathan Raman , "Dr. David Alan Gilbert" , Markus Armbruster , =?utf-8?q?Marc-Andr=C3=A9_Lure?= =?utf-8?q?au?= , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Elena Ufimtseva Relocate machine_int and exit notifiers into common code Signed-off-by: Elena Ufimtseva Signed-off-by: John G Johnson Signed-off-by: Jagannathan Raman [PMD: Removed NotifierList machine_init_done_notifiers stub] Signed-off-by: Philippe Mathieu-Daudé --- Makefile.objs | 1 + include/sysemu/sysemu.h | 2 ++ softmmu/vl.c | 42 ------------------------- stubs/machine-notify.c | 4 +++ util/machine-notify.c | 69 +++++++++++++++++++++++++++++++++++++++++ MAINTAINERS | 1 + 6 files changed, 77 insertions(+), 42 deletions(-) create mode 100644 util/machine-notify.c diff --git a/Makefile.objs b/Makefile.objs index a7c967633a..bfb9271862 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -79,6 +79,7 @@ qemu-seccomp.o-libs := $(SECCOMP_LIBS) common-obj-$(CONFIG_FDT) += device_tree.o common-obj-y += qapi/ +common-obj-y += util/machine-notify.o endif # CONFIG_SOFTMMU diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h index ef81302e1a..2438dd7bea 100644 --- a/include/sysemu/sysemu.h +++ b/include/sysemu/sysemu.h @@ -17,11 +17,13 @@ extern bool qemu_uuid_set; void qemu_add_exit_notifier(Notifier *notify); void qemu_remove_exit_notifier(Notifier *notify); +void qemu_run_exit_notifiers(void); extern bool machine_init_done; void qemu_add_machine_init_done_notifier(Notifier *notify); void qemu_remove_machine_init_done_notifier(Notifier *notify); +void qemu_run_machine_init_done_notifiers(void); extern int autostart; diff --git a/softmmu/vl.c b/softmmu/vl.c index 32c0047889..39cbb6b50d 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -172,12 +172,6 @@ int icount_align_option; QemuUUID qemu_uuid; bool qemu_uuid_set; -static NotifierList exit_notifiers = - NOTIFIER_LIST_INITIALIZER(exit_notifiers); - -static NotifierList machine_init_done_notifiers = - NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); - bool xen_allowed; uint32_t xen_domid; enum xen_mode xen_mode = XEN_EMULATE; @@ -2325,21 +2319,6 @@ static MachineClass *machine_parse(const char *name, GSList *machines) return mc; } -void qemu_add_exit_notifier(Notifier *notify) -{ - notifier_list_add(&exit_notifiers, notify); -} - -void qemu_remove_exit_notifier(Notifier *notify) -{ - notifier_remove(notify); -} - -static void qemu_run_exit_notifiers(void) -{ - notifier_list_notify(&exit_notifiers, NULL); -} - static const char *pid_file; static Notifier qemu_unlink_pidfile_notifier; @@ -2350,27 +2329,6 @@ static void qemu_unlink_pidfile(Notifier *n, void *data) } } -bool machine_init_done; - -void qemu_add_machine_init_done_notifier(Notifier *notify) -{ - notifier_list_add(&machine_init_done_notifiers, notify); - if (machine_init_done) { - notify->notify(notify, NULL); - } -} - -void qemu_remove_machine_init_done_notifier(Notifier *notify) -{ - notifier_remove(notify); -} - -static void qemu_run_machine_init_done_notifiers(void) -{ - machine_init_done = true; - notifier_list_notify(&machine_init_done_notifiers, NULL); -} - static const QEMUOption *lookup_opt(int argc, char **argv, const char **poptarg, int *poptind) { diff --git a/stubs/machine-notify.c b/stubs/machine-notify.c index d164ecccb9..71eba45b0f 100644 --- a/stubs/machine-notify.c +++ b/stubs/machine-notify.c @@ -4,3 +4,7 @@ void qemu_add_machine_init_done_notifier(Notifier *notify) { } + +void qemu_remove_machine_init_done_notifier(Notifier *notify) +{ +} diff --git a/util/machine-notify.c b/util/machine-notify.c new file mode 100644 index 0000000000..718af79335 --- /dev/null +++ b/util/machine-notify.c @@ -0,0 +1,69 @@ +/* + * Machine notifiers. + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "qemu/notify.h" +#include "sysemu/sysemu.h" + +static NotifierList machine_init_done_notifiers = + NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers); + +static NotifierList exit_notifiers = + NOTIFIER_LIST_INITIALIZER(exit_notifiers); + +bool machine_init_done; + +void qemu_add_machine_init_done_notifier(Notifier *notify) +{ + notifier_list_add(&machine_init_done_notifiers, notify); + if (machine_init_done) { + notify->notify(notify, NULL); + } +} + +void qemu_remove_machine_init_done_notifier(Notifier *notify) +{ + notifier_remove(notify); +} + +void qemu_run_machine_init_done_notifiers(void) +{ + machine_init_done = true; + notifier_list_notify(&machine_init_done_notifiers, NULL); +} + +void qemu_add_exit_notifier(Notifier *notify) +{ + notifier_list_add(&exit_notifiers, notify); +} + +void qemu_remove_exit_notifier(Notifier *notify) +{ + notifier_remove(notify); +} + +void qemu_run_exit_notifiers(void) +{ + notifier_list_notify(&exit_notifiers, NULL); +} diff --git a/MAINTAINERS b/MAINTAINERS index 8cbc1fac2b..04b19ac56c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2133,6 +2133,7 @@ F: util/qemu-timer.c F: softmmu/vl.c F: softmmu/main.c F: qapi/run-state.json +F: util/machine-notify.c Human Monitor (HMP) M: Dr. David Alan Gilbert