@@ -3,6 +3,10 @@
struct kvm;
-void virtio_blk__init(struct kvm *self);
+struct virtio_blk_parameters {
+ struct kvm *self;
+};
+
+void virtio_blk__init(struct virtio_blk_parameters *params);
#endif /* KVM__BLK_VIRTIO_H */
@@ -220,6 +220,7 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
int exit_code = 0;
int i;
struct virtio_net_parameters net_params;
+ struct virtio_blk_parameters blk_params;
signal(SIGALRM, handle_sigalrm);
signal(SIGQUIT, handle_sigquit);
@@ -317,7 +318,11 @@ int kvm_cmd_run(int argc, const char **argv, const char *prefix)
pci__init();
- virtio_blk__init(kvm);
+ blk_params = (struct virtio_blk_parameters) {
+ .self = kvm
+ };
+
+ virtio_blk__init(&blk_params);
virtio_console__init(kvm);
@@ -286,8 +286,10 @@ static struct pci_device_header virtio_blk_pci_device = {
#define PCI_VIRTIO_BLK_DEVNUM 1
-void virtio_blk__init(struct kvm *self)
+void virtio_blk__init(struct virtio_blk_parameters *params)
{
+ struct kvm *self = params->self;
+
if (!self->disk_image)
return;
Like in virtio-net, use virtio_blk_parameters to pass configuration parameters Signed-off-by: Sasha Levin <levinsasha928@gmail.com> --- tools/kvm/include/kvm/virtio-blk.h | 6 +++++- tools/kvm/kvm-run.c | 7 ++++++- tools/kvm/virtio-blk.c | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-)