Skip to content

Commit

Permalink
Add virtio disk identification ioctl
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
john cooper authored and Rusty Russell committed May 19, 2010
1 parent 4cb2ea2 commit 234f272
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/block/virtio_blk.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ 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 __user *usr_data = (void __user *)data;
char id_str[VIRTIO_BLK_ID_BYTES];
int err;

err = virtblk_get_id(disk, id_str);
if (!err && copy_to_user(usr_data, id_str, VIRTIO_BLK_ID_BYTES))
err = -EFAULT;
return err;
}
/*
* Only allow the generic SCSI ioctls if the host can support it.
*/
Expand Down

0 comments on commit 234f272

Please sign in to comment.