]> git.proxmox.com Git - mirror_qemu.git/blobdiff - util/id.c
Merge tag 'pull-request-2023-10-20' of https://gitlab.com/thuth/qemu into staging
[mirror_qemu.git] / util / id.c
index bcc64d836f436b72dd8e35eafc1b027e53dd63a8..ded41c5025e4a0a1c3422469ff723b91d8c210c2 100644 (file)
--- a/util/id.c
+++ b/util/id.c
@@ -10,7 +10,9 @@
  * or later.  See the COPYING.LIB file in the top-level directory.
  */
 
-#include "qemu-common.h"
+#include "qemu/osdep.h"
+#include "qemu/ctype.h"
+#include "qemu/id.h"
 
 bool id_wellformed(const char *id)
 {
@@ -29,9 +31,11 @@ bool id_wellformed(const char *id)
 
 #define ID_SPECIAL_CHAR '#'
 
-static const char *const id_subsys_str[] = {
+static const char *const id_subsys_str[ID_MAX] = {
     [ID_QDEV]  = "qdev",
     [ID_BLOCK] = "block",
+    [ID_CHR] = "chr",
+    [ID_NET] = "net",
 };
 
 /*
@@ -53,7 +57,7 @@ char *id_generate(IdSubSystems id)
     static uint64_t id_counters[ID_MAX];
     uint32_t rnd;
 
-    assert(id < ID_MAX);
+    assert(id < ARRAY_SIZE(id_subsys_str));
     assert(id_subsys_str[id]);
 
     rnd = g_random_int_range(0, 100);