Like in virtio-net, use virtio_blk_parameters to pass configuration parameters

Signed-off-by: Sasha Levin <levinsasha...@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(-)

diff --git a/tools/kvm/include/kvm/virtio-blk.h 
b/tools/kvm/include/kvm/virtio-blk.h
index f82bbc7..9e91035 100644
--- a/tools/kvm/include/kvm/virtio-blk.h
+++ b/tools/kvm/include/kvm/virtio-blk.h
@@ -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 */
diff --git a/tools/kvm/kvm-run.c b/tools/kvm/kvm-run.c
index 17fef20..5b71fb4 100644
--- a/tools/kvm/kvm-run.c
+++ b/tools/kvm/kvm-run.c
@@ -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);
 
diff --git a/tools/kvm/virtio-blk.c b/tools/kvm/virtio-blk.c
index 029f753..2470583 100644
--- a/tools/kvm/virtio-blk.c
+++ b/tools/kvm/virtio-blk.c
@@ -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;
 
-- 
1.7.5.rc1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to