diff options
author | john cooper <john.cooper@redhat.com> | 2010-03-25 01:34:02 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-05-19 08:45:40 -0400 |
commit | 234f2725a5d03f78539f1d36cb32f2c4f9b1822c (patch) | |
tree | 583925489f277e88f4326bbb7a22018b1c1ceb01 /drivers/block/virtio_blk.c | |
parent | 4cb2ea28c55cf5e5ef83aec535099ffce3c583df (diff) |
Add virtio disk identification ioctl
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>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/block/virtio_blk.c')
-rw-r--r-- | drivers/block/virtio_blk.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 759dee8330ac..67dcb193ab2e 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -225,6 +225,16 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
225 | struct gendisk *disk = bdev->bd_disk; | 225 | struct gendisk *disk = bdev->bd_disk; |
226 | struct virtio_blk *vblk = disk->private_data; | 226 | struct virtio_blk *vblk = disk->private_data; |
227 | 227 | ||
228 | if (cmd == 'VBID') { | ||
229 | void __user *usr_data = (void __user *)data; | ||
230 | char id_str[VIRTIO_BLK_ID_BYTES]; | ||
231 | int err; | ||
232 | |||
233 | err = virtblk_get_id(disk, id_str); | ||
234 | if (!err && copy_to_user(usr_data, id_str, VIRTIO_BLK_ID_BYTES)) | ||
235 | err = -EFAULT; | ||
236 | return err; | ||
237 | } | ||
228 | /* | 238 | /* |
229 | * Only allow the generic SCSI ioctls if the host can support it. | 239 | * Only allow the generic SCSI ioctls if the host can support it. |
230 | */ | 240 | */ |