diff mbox series

[v3,3/3] qapi: Define VhostDeviceProtocols and VirtioDeviceFeatures as plain C types

Message ID 4ce51ef3d64fe2b09443cd0529da91115476b35a.1706883915.git.yong.huang@smartx.com
State New
Headers show
Series Adjust the output of x-query-virtio-status | expand

Commit Message

Yong Huang Feb. 2, 2024, 2:32 p.m. UTC
VhostDeviceProtocols and VirtioDeviceFeatures are only used in
virtio-hmp-cmds.c.  So define them as plain C types there, and drop
them from the QAPI schema.

Signed-off-by: Hyman Huang <yong.huang@smartx.com>
---
 hw/virtio/virtio-hmp-cmds.c | 16 +++++++++++++++
 qapi/virtio.json            | 39 -------------------------------------
 2 files changed, 16 insertions(+), 39 deletions(-)

Comments

Markus Armbruster Feb. 19, 2024, 3:33 p.m. UTC | #1
Hyman Huang <yong.huang@smartx.com> writes:

> VhostDeviceProtocols and VirtioDeviceFeatures are only used in
> virtio-hmp-cmds.c.  So define them as plain C types there, and drop
> them from the QAPI schema.
>
> Signed-off-by: Hyman Huang <yong.huang@smartx.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
diff mbox series

Patch

diff --git a/hw/virtio/virtio-hmp-cmds.c b/hw/virtio/virtio-hmp-cmds.c
index f95bad0069..045b472228 100644
--- a/hw/virtio/virtio-hmp-cmds.c
+++ b/hw/virtio/virtio-hmp-cmds.c
@@ -29,6 +29,22 @@ 
 
 #include CONFIG_DEVICES
 
+typedef struct VhostDeviceProtocols VhostDeviceProtocols;
+struct VhostDeviceProtocols {
+    strList *protocols;
+    bool has_unknown_protocols;
+    uint64_t unknown_protocols;
+};
+
+typedef struct VirtioDeviceFeatures VirtioDeviceFeatures;
+struct VirtioDeviceFeatures {
+    strList *transports;
+    bool has_dev_features;
+    strList *dev_features;
+    bool has_unknown_dev_features;
+    uint64_t unknown_dev_features;
+};
+
 #define FEATURE_ENTRY(name, desc) (qmp_virtio_feature_map_t) \
     { .virtio_bit = name, .feature_desc = desc }
 
diff --git a/qapi/virtio.json b/qapi/virtio.json
index 26516fb29c..42dbc87f2f 100644
--- a/qapi/virtio.json
+++ b/qapi/virtio.json
@@ -300,45 +300,6 @@ 
   'data': { 'statuses': [ 'str' ],
             '*unknown-statuses': 'uint8' } }
 
-##
-# @VhostDeviceProtocols:
-#
-# A structure defined to list the vhost user protocol features of a
-# Vhost User device
-#
-# @protocols: List of decoded vhost user protocol features of a vhost
-#     user device
-#
-# @unknown-protocols: Vhost user device protocol features bitmap that
-#     have not been decoded
-#
-# Since: 7.2
-##
-{ 'struct': 'VhostDeviceProtocols',
-  'data': { 'protocols': [ 'str' ],
-            '*unknown-protocols': 'uint64' } }
-
-##
-# @VirtioDeviceFeatures:
-#
-# The common fields that apply to most Virtio devices.  Some devices
-# may not have their own device-specific features (e.g. virtio-rng).
-#
-# @transports: List of transport features of the virtio device
-#
-# @dev-features: List of device-specific features (if the device has
-#     unique features)
-#
-# @unknown-dev-features: Virtio device features bitmap that have not
-#     been decoded
-#
-# Since: 7.2
-##
-{ 'struct': 'VirtioDeviceFeatures',
-  'data': { 'transports': [ 'str' ],
-            '*dev-features': [ 'str' ],
-            '*unknown-dev-features': 'uint64' } }
-
 ##
 # @VirtQueueStatus:
 #