From nobody Mon Feb 9 20:34:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623305766; cv=none; d=zohomail.com; s=zohoarc; b=V+og1SkNCUbMwlU+sykA56r1VQC74UF/PmUrti06d80ZuPuAMDA6IFokknJJ0ZpsOcjD1d+5TAtGtCIrM6KWu1XKxqPJJ9CPTpNuPZwzV3mhfEsvGfb4GtfHGpj9GoxkbXe1iY3YhgKznAdNER3gKx5nmP+wJl77V2lyBs4CxBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623305766; 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=PDsz2/JBhn6AS9awptgZrMDUgUROemDrHVxi/sZ1sds=; b=j5OCljKLhyd88/MUKJ+XgQunGTn1S0QE2YTZ45t/AMMQvDpE/cqSmGm4Uuup+uM0rmqY6VUg72GqG4GOyeItQ13wYvg0/u2w1tWZVpU7rXFyvK1vgEwu/xIXV8T9HHas6kHvAP2h64s2o6/BRw6LUAfibG/a3WbG+f3DheqzMr4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623305766753281.6783748053376; Wed, 9 Jun 2021 23:16:06 -0700 (PDT) Received: from localhost ([::1]:59864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrDz3-0006Nw-CK for importer@patchew.org; Thu, 10 Jun 2021 02:16:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrDk2-0006uB-8W for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:00:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:32065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrDk0-000378-5T for qemu-devel@nongnu.org; Thu, 10 Jun 2021 02:00:33 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-ZHvQHjHuNsKZI_ZtDENVdw-1; Thu, 10 Jun 2021 02:00:21 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7588919200C0; Thu, 10 Jun 2021 06:00:20 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-113-69.ams2.redhat.com [10.36.113.69]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C212960C05; Thu, 10 Jun 2021 06:00:03 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 28EDD1801ABD; Thu, 10 Jun 2021 07:57:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623304831; 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=PDsz2/JBhn6AS9awptgZrMDUgUROemDrHVxi/sZ1sds=; b=OZrbOEI2pTITjsVEoTfALcURCt40XazH1+Ws3CthsmLgY9FKNM88DFLMA8Sll2R9F6XX0j Bb2fs91MxutTIDs9cTCJXo3oclEqDeFam0mVnrxQnQgNQjT5VVmrmDO7Wx7tIIUcipDk3T BF0MQxRB1EdliCPkm7BzSqCKgjdeERA= X-MC-Unique: ZHvQHjHuNsKZI_ZtDENVdw-1 From: Gerd Hoffmann To: qemu-devel@nongnu.org Subject: [PATCH v2 16/18] modules: use modinfo for qemu opts load Date: Thu, 10 Jun 2021 07:57:53 +0200 Message-Id: <20210610055755.538119-17-kraxel@redhat.com> In-Reply-To: <20210610055755.538119-1-kraxel@redhat.com> References: <20210610055755.538119-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=kraxel@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.199, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action 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: Kevin Wolf , Thomas Huth , berrange@redhat.com, qemu-block@nongnu.org, "Michael S. Tsirkin" , Michael Roth , Cornelia Huck , Peter Lieven , Markus Armbruster , Max Reitz , Halil Pasic , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , qemu-s390x@nongnu.org, Gerd Hoffmann , Ronnie Sahlberg , Samuel Thibault , Paolo Bonzini , David Hildenbrand , Richard Henderson , Eric Blake , Christian Borntraeger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Use module database to figure which module adds given QemuOpts group. Signed-off-by: Gerd Hoffmann --- softmmu/vl.c | 17 ----------------- stubs/module-opts.c | 4 ---- util/module.c | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index 326c1e908008..ba26a042b284 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -2675,23 +2675,6 @@ void qmp_x_exit_preconfig(Error **errp) } } =20 -#ifdef CONFIG_MODULES -void qemu_load_module_for_opts(const char *group) -{ - static bool spice_tried; - if (g_str_equal(group, "spice") && !spice_tried) { - ui_module_load_one("spice-core"); - spice_tried =3D true; - } - - static bool iscsi_tried; - if (g_str_equal(group, "iscsi") && !iscsi_tried) { - block_module_load_one("iscsi"); - iscsi_tried =3D true; - } -} -#endif - void qemu_init(int argc, char **argv, char **envp) { QemuOpts *opts; diff --git a/stubs/module-opts.c b/stubs/module-opts.c index a7d0e4ad6ead..5412429ea869 100644 --- a/stubs/module-opts.c +++ b/stubs/module-opts.c @@ -1,6 +1,2 @@ #include "qemu/osdep.h" #include "qemu/config-file.h" - -void qemu_load_module_for_opts(const char *group) -{ -} diff --git a/util/module.c b/util/module.c index 46bec1cfbec7..6e4199169c41 100644 --- a/util/module.c +++ b/util/module.c @@ -21,6 +21,7 @@ #include "qemu/module.h" #include "qemu/cutils.h" #include "qemu/error-report.h" +#include "qemu/config-file.h" #ifdef CONFIG_MODULE_UPGRADES #include "qemu-version.h" #endif @@ -381,8 +382,26 @@ void module_load_qom_all(void) module_loaded_qom_all =3D true; } =20 +void qemu_load_module_for_opts(const char *group) +{ + ModuleInfoList *modlist; + + module_load_path_init(); + module_load_modinfo(); + + for (modlist =3D modinfo->list; modlist !=3D NULL; modlist =3D modlist= ->next) { + if (!modlist->value->has_opts) { + continue; + } + if (strcmp(modlist->value->opts, group) =3D=3D 0) { + module_load_one("", modlist->value->name, false); + } + } +} + #else =20 +void qemu_load_module_for_opts(const char *group) {} void module_load_qom_one(const char *type) {} void module_load_qom_all(void) {} =20 --=20 2.31.1