From patchwork Mon Apr 18 13:02:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 715041 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3ID34Gv016360 for ; Mon, 18 Apr 2011 13:03:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751585Ab1DRNDA (ORCPT ); Mon, 18 Apr 2011 09:03:00 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:47254 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356Ab1DRNC5 (ORCPT ); Mon, 18 Apr 2011 09:02:57 -0400 Received: by wwa36 with SMTP id 36so5627667wwa.1 for ; Mon, 18 Apr 2011 06:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=nRasGj3H2l3tEWhuAK82Qy/Mt4S8WeYmUekhHWQ2qQo=; b=oYO6jJov04yUJbL5L6dIlSRUCN/EMhhoublwSNbFSFVTiIC5u4NhEiNwLMLHI8JjKB i8JsTyCt4KFimfCjQMq420opQQ5lugRlcCvVnGtDbqSJo9jpxgH2HDLD0bfiQeA24tAd 05P8SOoSmxlD6qs1W78vmio+qSHqFnfwSIzE8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=l3Dx9GFZViaWCadyj0x3rhcVN09z3n+IiWGYZO9uNLA7bKGPl37JZ04Bx79w1UoUeH aE14EfnOz79472Em6JcbnNlwNesIfdpgzYTtdlDHoN8p6sR7d9owmZqEUvdKlafNta2a udWISSmVdxTr+9FQ+Bcw0c+I9tSYZv7kDiPcA= Received: by 10.216.140.92 with SMTP id d70mr35175wej.105.1303131776667; Mon, 18 Apr 2011 06:02:56 -0700 (PDT) Received: from localhost.localdomain (bzq-79-181-210-229.red.bezeqint.net [79.181.210.229]) by mx.google.com with ESMTPS id f30sm2576031wef.31.2011.04.18.06.02.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Apr 2011 06:02:56 -0700 (PDT) From: Sasha Levin To: penberg@kernel.org Cc: mingo@elte.hu, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com, kvm@vger.kernel.org, Sasha Levin Subject: [PATCH 2/4] kvm tools: Use virtio_blk_parameters to configure virtio-blk Date: Mon, 18 Apr 2011 16:02:32 +0300 Message-Id: <1303131754-25072-2-git-send-email-levinsasha928@gmail.com> X-Mailer: git-send-email 1.7.5.rc1 In-Reply-To: <1303131754-25072-1-git-send-email-levinsasha928@gmail.com> References: <1303131754-25072-1-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 18 Apr 2011 13:03:04 +0000 (UTC) Like in virtio-net, use virtio_blk_parameters to pass configuration parameters Signed-off-by: Sasha Levin --- 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;