* [PATCH 0/3] hw/virtio: Constify VirtIOFeature
@ 2021-05-11 10:41 Philippe Mathieu-Daudé
2021-05-11 10:41 ` [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument Philippe Mathieu-Daudé
` (6 more replies)
0 siblings, 7 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-11 10:41 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi,
Philippe Mathieu-Daudé
Trivial patches to keep VirtIOFeature arrays read-only
(better safe than sorry).
Philippe Mathieu-Daudé (3):
hw/virtio: Pass virtio_feature_get_config_size() a const argument
virtio-blk: Constify VirtIOFeature feature_sizes[]
virtio-net: Constify VirtIOFeature feature_sizes[]
include/hw/virtio/virtio.h | 2 +-
hw/block/virtio-blk.c | 2 +-
hw/net/virtio-net.c | 2 +-
hw/virtio/virtio.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
--
2.26.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
@ 2021-05-11 10:41 ` Philippe Mathieu-Daudé
2021-05-12 2:55 ` Jason Wang
2021-05-11 10:41 ` [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[] Philippe Mathieu-Daudé
` (5 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-11 10:41 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi,
Philippe Mathieu-Daudé
The VirtIOFeature structure isn't modified, mark it const.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
include/hw/virtio/virtio.h | 2 +-
hw/virtio/virtio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index b7ece7a6a89..8bab9cfb750 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -43,7 +43,7 @@ typedef struct VirtIOFeature {
size_t end;
} VirtIOFeature;
-size_t virtio_feature_get_config_size(VirtIOFeature *features,
+size_t virtio_feature_get_config_size(const VirtIOFeature *features,
uint64_t host_features);
typedef struct VirtQueue VirtQueue;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9e13cb9e3ad..e02544b2df7 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2981,7 +2981,7 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
return ret;
}
-size_t virtio_feature_get_config_size(VirtIOFeature *feature_sizes,
+size_t virtio_feature_get_config_size(const VirtIOFeature *feature_sizes,
uint64_t host_features)
{
size_t config_size = 0;
--
2.26.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[]
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
2021-05-11 10:41 ` [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument Philippe Mathieu-Daudé
@ 2021-05-11 10:41 ` Philippe Mathieu-Daudé
2021-05-12 2:56 ` Jason Wang
2021-05-11 10:41 ` [PATCH 3/3] virtio-net: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-11 10:41 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/block/virtio-blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index d28979efb8d..f139cd7cc9c 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -40,7 +40,7 @@
* Starting from the discard feature, we can use this array to properly
* set the config size depending on the features enabled.
*/
-static VirtIOFeature feature_sizes[] = {
+static const VirtIOFeature feature_sizes[] = {
{.flags = 1ULL << VIRTIO_BLK_F_DISCARD,
.end = endof(struct virtio_blk_config, discard_sector_alignment)},
{.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES,
--
2.26.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] virtio-net: Constify VirtIOFeature feature_sizes[]
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
2021-05-11 10:41 ` [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument Philippe Mathieu-Daudé
2021-05-11 10:41 ` [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[] Philippe Mathieu-Daudé
@ 2021-05-11 10:41 ` Philippe Mathieu-Daudé
2021-05-12 2:57 ` Jason Wang
2021-05-11 16:54 ` [PATCH 0/3] hw/virtio: Constify VirtIOFeature Richard Henderson
` (3 subsequent siblings)
6 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-05-11 10:41 UTC (permalink / raw)
To: qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi,
Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/net/virtio-net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 66b9ff45118..6b7e8dd04ef 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -89,7 +89,7 @@
VIRTIO_NET_RSS_HASH_TYPE_TCP_EX | \
VIRTIO_NET_RSS_HASH_TYPE_UDP_EX)
-static VirtIOFeature feature_sizes[] = {
+static const VirtIOFeature feature_sizes[] = {
{.flags = 1ULL << VIRTIO_NET_F_MAC,
.end = endof(struct virtio_net_config, mac)},
{.flags = 1ULL << VIRTIO_NET_F_STATUS,
--
2.26.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] hw/virtio: Constify VirtIOFeature
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2021-05-11 10:41 ` [PATCH 3/3] virtio-net: " Philippe Mathieu-Daudé
@ 2021-05-11 16:54 ` Richard Henderson
2021-05-12 7:13 ` Stefano Garzarella
` (2 subsequent siblings)
6 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2021-05-11 16:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi
On 5/11/21 5:41 AM, Philippe Mathieu-Daudé wrote:
> Philippe Mathieu-Daudé (3):
> hw/virtio: Pass virtio_feature_get_config_size() a const argument
> virtio-blk: Constify VirtIOFeature feature_sizes[]
> virtio-net: Constify VirtIOFeature feature_sizes[]
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument
2021-05-11 10:41 ` [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument Philippe Mathieu-Daudé
@ 2021-05-12 2:55 ` Jason Wang
0 siblings, 0 replies; 11+ messages in thread
From: Jason Wang @ 2021-05-12 2:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Max Reitz, Stefan Hajnoczi
在 2021/5/11 下午6:41, Philippe Mathieu-Daudé 写道:
> The VirtIOFeature structure isn't modified, mark it const.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
> ---
> include/hw/virtio/virtio.h | 2 +-
> hw/virtio/virtio.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
> index b7ece7a6a89..8bab9cfb750 100644
> --- a/include/hw/virtio/virtio.h
> +++ b/include/hw/virtio/virtio.h
> @@ -43,7 +43,7 @@ typedef struct VirtIOFeature {
> size_t end;
> } VirtIOFeature;
>
> -size_t virtio_feature_get_config_size(VirtIOFeature *features,
> +size_t virtio_feature_get_config_size(const VirtIOFeature *features,
> uint64_t host_features);
>
> typedef struct VirtQueue VirtQueue;
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index 9e13cb9e3ad..e02544b2df7 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -2981,7 +2981,7 @@ int virtio_set_features(VirtIODevice *vdev, uint64_t val)
> return ret;
> }
>
> -size_t virtio_feature_get_config_size(VirtIOFeature *feature_sizes,
> +size_t virtio_feature_get_config_size(const VirtIOFeature *feature_sizes,
> uint64_t host_features)
> {
> size_t config_size = 0;
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[]
2021-05-11 10:41 ` [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[] Philippe Mathieu-Daudé
@ 2021-05-12 2:56 ` Jason Wang
0 siblings, 0 replies; 11+ messages in thread
From: Jason Wang @ 2021-05-12 2:56 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Max Reitz, Stefan Hajnoczi
在 2021/5/11 下午6:41, Philippe Mathieu-Daudé 写道:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/block/virtio-blk.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index d28979efb8d..f139cd7cc9c 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -40,7 +40,7 @@
> * Starting from the discard feature, we can use this array to properly
> * set the config size depending on the features enabled.
> */
> -static VirtIOFeature feature_sizes[] = {
> +static const VirtIOFeature feature_sizes[] = {
> {.flags = 1ULL << VIRTIO_BLK_F_DISCARD,
> .end = endof(struct virtio_blk_config, discard_sector_alignment)},
> {.flags = 1ULL << VIRTIO_BLK_F_WRITE_ZEROES,
Acked-by: Jason Wang <jasowang@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/3] virtio-net: Constify VirtIOFeature feature_sizes[]
2021-05-11 10:41 ` [PATCH 3/3] virtio-net: " Philippe Mathieu-Daudé
@ 2021-05-12 2:57 ` Jason Wang
0 siblings, 0 replies; 11+ messages in thread
From: Jason Wang @ 2021-05-12 2:57 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Max Reitz, Stefan Hajnoczi
在 2021/5/11 下午6:41, Philippe Mathieu-Daudé 写道:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/net/virtio-net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 66b9ff45118..6b7e8dd04ef 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -89,7 +89,7 @@
> VIRTIO_NET_RSS_HASH_TYPE_TCP_EX | \
> VIRTIO_NET_RSS_HASH_TYPE_UDP_EX)
>
> -static VirtIOFeature feature_sizes[] = {
> +static const VirtIOFeature feature_sizes[] = {
> {.flags = 1ULL << VIRTIO_NET_F_MAC,
> .end = endof(struct virtio_net_config, mac)},
> {.flags = 1ULL << VIRTIO_NET_F_STATUS,
Acked-by: Jason Wang <jasowang@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] hw/virtio: Constify VirtIOFeature
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2021-05-11 16:54 ` [PATCH 0/3] hw/virtio: Constify VirtIOFeature Richard Henderson
@ 2021-05-12 7:13 ` Stefano Garzarella
2021-05-12 15:54 ` Stefan Hajnoczi
2021-05-13 15:46 ` Laurent Vivier
6 siblings, 0 replies; 11+ messages in thread
From: Stefano Garzarella @ 2021-05-12 7:13 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, qemu-devel, Max Reitz, Stefan Hajnoczi
On Tue, May 11, 2021 at 12:41:54PM +0200, Philippe Mathieu-Daudé wrote:
>Trivial patches to keep VirtIOFeature arrays read-only
>(better safe than sorry).
>
>Philippe Mathieu-Daudé (3):
> hw/virtio: Pass virtio_feature_get_config_size() a const argument
> virtio-blk: Constify VirtIOFeature feature_sizes[]
> virtio-net: Constify VirtIOFeature feature_sizes[]
>
> include/hw/virtio/virtio.h | 2 +-
> hw/block/virtio-blk.c | 2 +-
> hw/net/virtio-net.c | 2 +-
> hw/virtio/virtio.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] hw/virtio: Constify VirtIOFeature
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2021-05-12 7:13 ` Stefano Garzarella
@ 2021-05-12 15:54 ` Stefan Hajnoczi
2021-05-13 15:46 ` Laurent Vivier
6 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2021-05-12 15:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, qemu-devel, Max Reitz
[-- Attachment #1: Type: text/plain, Size: 670 bytes --]
On Tue, May 11, 2021 at 12:41:54PM +0200, Philippe Mathieu-Daudé wrote:
> Trivial patches to keep VirtIOFeature arrays read-only
> (better safe than sorry).
>
> Philippe Mathieu-Daudé (3):
> hw/virtio: Pass virtio_feature_get_config_size() a const argument
> virtio-blk: Constify VirtIOFeature feature_sizes[]
> virtio-net: Constify VirtIOFeature feature_sizes[]
>
> include/hw/virtio/virtio.h | 2 +-
> hw/block/virtio-blk.c | 2 +-
> hw/net/virtio-net.c | 2 +-
> hw/virtio/virtio.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
> --
> 2.26.3
>
>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 484 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/3] hw/virtio: Constify VirtIOFeature
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2021-05-12 15:54 ` Stefan Hajnoczi
@ 2021-05-13 15:46 ` Laurent Vivier
6 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2021-05-13 15:46 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Kevin Wolf, qemu-block, Michael S. Tsirkin, qemu-trivial,
Jason Wang, Max Reitz, Stefan Hajnoczi
Le 11/05/2021 à 12:41, Philippe Mathieu-Daudé a écrit :
> Trivial patches to keep VirtIOFeature arrays read-only
> (better safe than sorry).
>
> Philippe Mathieu-Daudé (3):
> hw/virtio: Pass virtio_feature_get_config_size() a const argument
> virtio-blk: Constify VirtIOFeature feature_sizes[]
> virtio-net: Constify VirtIOFeature feature_sizes[]
>
> include/hw/virtio/virtio.h | 2 +-
> hw/block/virtio-blk.c | 2 +-
> hw/net/virtio-net.c | 2 +-
> hw/virtio/virtio.c | 2 +-
> 4 files changed, 4 insertions(+), 4 deletions(-)
>
Series applied to my trivial-patches branch.
Thanks,
Laurent
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-05-13 15:47 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 10:41 [PATCH 0/3] hw/virtio: Constify VirtIOFeature Philippe Mathieu-Daudé
2021-05-11 10:41 ` [PATCH 1/3] hw/virtio: Pass virtio_feature_get_config_size() a const argument Philippe Mathieu-Daudé
2021-05-12 2:55 ` Jason Wang
2021-05-11 10:41 ` [PATCH 2/3] virtio-blk: Constify VirtIOFeature feature_sizes[] Philippe Mathieu-Daudé
2021-05-12 2:56 ` Jason Wang
2021-05-11 10:41 ` [PATCH 3/3] virtio-net: " Philippe Mathieu-Daudé
2021-05-12 2:57 ` Jason Wang
2021-05-11 16:54 ` [PATCH 0/3] hw/virtio: Constify VirtIOFeature Richard Henderson
2021-05-12 7:13 ` Stefano Garzarella
2021-05-12 15:54 ` Stefan Hajnoczi
2021-05-13 15:46 ` Laurent Vivier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).