From nobody Mon Feb 9 14:50:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.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=1565075585; cv=none; d=zoho.com; s=zohoarc; b=CVc3j0LEycD558f1iW2qKYPv91sf7UppJ0Jb7DzBGyWh2S0ZHs/MBPnlLASrcw4UHgTlt+f012HmRyrlpqpMD96v6zoj8UQ2hnLG77gpVexFlcY8JZTXvT9OuxHYJZmQ8CPJkhRfVv50IDpQsQpOUVzI+7EdV2sIuRZhciXZ7Jo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565075585; 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:ARC-Authentication-Results; bh=TcocXI61yPYShryckVHC8C3lt7n1GolpIL0mLOqSWCU=; b=hQJSF07Qwgw9Zugh2CKq5xIvFWcbYkoejt/pZG2huDx0tpmJX81EGs1n15H9h+yGyvA9MvfHNjTQe8LQVIsFjg63d/JW5HTrUKv/9gJQroGtgdhv+Z7R0NC/D6Ct6LG3SkAhA1JthXJq37Kj8NPppbLwM3T4BzegjMvPppedfuI= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.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 1565075585070178.96039772910444; Tue, 6 Aug 2019 00:13:05 -0700 (PDT) Received: from localhost ([::1]:59376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hutea-0000vM-2T for importer@patchew.org; Tue, 06 Aug 2019 03:13:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39666) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hutcm-0005tH-HY for qemu-devel@nongnu.org; Tue, 06 Aug 2019 03:11:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hutcl-0002Gp-EH for qemu-devel@nongnu.org; Tue, 06 Aug 2019 03:11:12 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:40800) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hutcl-0002G1-7g for qemu-devel@nongnu.org; Tue, 06 Aug 2019 03:11:11 -0400 Received: by mail-wm1-x344.google.com with SMTP id v19so75314301wmj.5 for ; Tue, 06 Aug 2019 00:11:11 -0700 (PDT) Received: from 640k.localdomain.com ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id z6sm74944037wrw.2.2019.08.06.00.11.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 00:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TcocXI61yPYShryckVHC8C3lt7n1GolpIL0mLOqSWCU=; b=WkaeL0TIQfvhMzvxXoGIj/J1yCIQuDdTAJhsZstex0fUQgLKLA2ZbUIgb+CnVvRQ9M AZdgU1ob/jHy+cj6UQkCwngnufzW3TM85D2stPb5Dw/kVTb0Wi8OEt9wNW5RcQ2846Zk Opz2PjMeURcS36k0Rr1nH7rmMpysETph5PSdV6vQ/fZ2PgjFqd5CL/11hW5YFJvCyQDR rMR7Aq/zbKx2iQGRX2QZElCdzm0C6v0y1O4vZFnVbocUl78ZoSgpMM3CP0hu0Z1rJkzR cx63Wvhhl/j9DYuNZ8rgucwfwVyExVyeIsrMEc7ODN/6PhhI9t67JGhiIGXo6h34BdrM Pt6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=TcocXI61yPYShryckVHC8C3lt7n1GolpIL0mLOqSWCU=; b=FcriZyq2L9NM7Q5y5wK0WXNmHv9AdYuAmCdhlJFh5AMWSmp2UVcBrpoUXZ5N5YH9pV Fj2r9kODd+3qc5SD5O2hmOCrcOgM50yJGt7SaMRm3iBaKP9mzoNk7hyrJTwswHESy6CA LXFUOtENU8wecKdNA7+z/z/ccpRDhj5YMo3cBGSK+G2RPvxm2ONOAEjvKSDmiGXAhyP4 r8KJfxEjfDrfcsa7GuIMWUATbph6yh/7w9pun+xxNRBzbkEUTUrzmNw4eQUyhYPQZOqP LMKmpe+cxZTw7JMQvBm0mUNaOEcNo4x8s1BHQqxLhNo/ffTKb64tvuZkuCwt5GhT8h7R 79Ag== X-Gm-Message-State: APjAAAWGTEyoEMz3r3u2Qc9GGu66JN1jE20K1DAgSlVQ+gfTm0mSjBgG b7he4LhkE9SM+cQCr5M86NLM3q3l X-Google-Smtp-Source: APXvYqyBUz87UAYiwQNFN/4eRs+JrTcPSyaIRear8F61tCtyzL9CwqQeIjQ1uf51KbTg3udN+r5oNg== X-Received: by 2002:a1c:7e85:: with SMTP id z127mr2884825wmc.95.1565075469998; Tue, 06 Aug 2019 00:11:09 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 6 Aug 2019 09:11:05 +0200 Message-Id: <1565075466-14943-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1565075466-14943-1-git-send-email-pbonzini@redhat.com> References: <1565075466-14943-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PATCH 2/3] module: return success on module load 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , armbru@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marc-Andr=C3=A9 Lureau Let the caller know of load success. Note that this also changes slightly the behaviour of the function to try loading on subsequent calls if the previous ones failed. Signed-off-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- include/qemu/module.h | 2 +- util/module.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/qemu/module.h b/include/qemu/module.h index db30653..65ba596 100644 --- a/include/qemu/module.h +++ b/include/qemu/module.h @@ -65,6 +65,6 @@ void register_module_init(void (*fn)(void), module_init_t= ype type); void register_dso_module_init(void (*fn)(void), module_init_type type); =20 void module_call_init(module_init_type type); -void module_load_one(const char *prefix, const char *lib_name); +bool module_load_one(const char *prefix, const char *lib_name); =20 #endif diff --git a/util/module.c b/util/module.c index ca9885c..e9fe3e5 100644 --- a/util/module.c +++ b/util/module.c @@ -156,8 +156,10 @@ out: } #endif =20 -void module_load_one(const char *prefix, const char *lib_name) +bool module_load_one(const char *prefix, const char *lib_name) { + bool success =3D false; + #ifdef CONFIG_MODULES char *fname =3D NULL; char *exec_dir; @@ -170,7 +172,7 @@ void module_load_one(const char *prefix, const char *li= b_name) =20 if (!g_module_supported()) { fprintf(stderr, "Module is not supported by system.\n"); - return; + return false; } =20 if (!loaded_modules) { @@ -181,7 +183,7 @@ void module_load_one(const char *prefix, const char *li= b_name) =20 if (!g_hash_table_add(loaded_modules, module_name)) { g_free(module_name); - return; + return true; } =20 exec_dir =3D qemu_get_exec_dir(); @@ -205,13 +207,19 @@ void module_load_one(const char *prefix, const char *= lib_name) fname =3D NULL; /* Try loading until loaded a module file */ if (!ret) { + success =3D true; break; } } =20 + if (!success) { + g_hash_table_remove(loaded_modules, module_name); + } + for (i =3D 0; i < n_dirs; i++) { g_free(dirs[i]); } =20 #endif + return success; } --=20 1.8.3.1