summaryrefslogtreecommitdiffstats
path: root/debian/patches/note-missing-module-pkg-name.diff
blob: eee95aa132596cc67d3e71344e19064abc06f1a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Date: Sun, 22 Aug 2021 15:16:25 +0300
Updated: Thu, 15 Dec 2022 14:23:16 +0300
From: Michael Tokarev <mjt@tls.msk.ru>
Subject: Note missing module package name

Debian ships different modules in different packages.
By default qemu ignores the fact that it can not load
a module, pretending this module never existed.
Give a useful hint about the package where the module
in question resides.

This is a hack, but it makes qemu a bit more user-friendly.

diff --git a/util/module.c b/util/module.c
index 32e263163c..2f3e35f781 100644
--- a/util/module.c
+++ b/util/module.c
@@ -303,6 +303,20 @@ int module_load(const char *prefix, const char *name, Error **errp)
     }
     rv = 0; /* module not found */
 
+    {   /* notify user about extra package to install */
+        const char *pkg = NULL;
+        if (!strcmp(prefix, "block-"))
+           pkg = "qemu-block-extra";
+        else if (!strcmp(prefix, "ui-")
+               || !strcmp(prefix, "audio-")
+               || !strcmp(module_name, "virtio-gpu-gl"))
+           pkg = "qemu-system-gui";
+        if (pkg)
+          fprintf(stderr,
+           "qemu: module %s%s not found, do you want to install %s package?\n",
+                  prefix, module_name, pkg);
+    }
+
 out:
     if (rv <= 0) {
         g_hash_table_remove(loaded_modules, module_name);