From: john cooper <john.cooper@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: john.cooper@redhat.com, Marc Haber <mh+qemu-devel@zugschlus.de>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 4/4] Add virtio disk identification support
Date: Thu, 25 Mar 2010 01:34:02 -0400 [thread overview]
Message-ID: <4BAAF5CA.2010401@redhat.com> (raw)
Return serial string to the guest application via
ioctl driver call.
Note this form of interface to the guest userland
was the consensus when the prior version using
the ATA_IDENTIFY came under dispute.
Signed-off-by: john cooper <john.cooper@redhat.com>
---
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index cd66806..0954193 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -225,6 +225,21 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode,
struct gendisk *disk = bdev->bd_disk;
struct virtio_blk *vblk = disk->private_data;
+ if (cmd == 'VBID') {
+ void *usr_data = (void __user *)data;
+ char *id_str;
+ int err;
+
+ if (!(id_str = kmalloc(VIRTIO_BLK_ID_BYTES, GFP_KERNEL)))
+ err = -ENOMEM;
+ else if ((err = virtblk_get_id(disk, id_str)))
+ ;
+ else if (copy_to_user(usr_data, id_str, VIRTIO_BLK_ID_BYTES))
+ err = -EFAULT;
+ if (id_str)
+ kfree(id_str);
+ return err;
+ }
/*
* Only allow the generic SCSI ioctls if the host can support it.
*/
--
john.cooper@redhat.com
next reply other threads:[~2010-03-25 5:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 5:34 john cooper [this message]
2010-03-30 5:23 ` [Qemu-devel] Re: [PATCH 4/4] Add virtio disk identification support Rusty Russell
2010-03-30 5:52 ` john cooper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4BAAF5CA.2010401@redhat.com \
--to=john.cooper@redhat.com \
--cc=mh+qemu-devel@zugschlus.de \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.