|
38 | 38 | #include <linux/interrupt.h>
|
39 | 39 | #include <linux/blkdev.h>
|
40 | 40 | #include <linux/hdreg.h>
|
| 41 | +#include <linux/cdrom.h> |
41 | 42 | #include <linux/module.h>
|
42 | 43 |
|
43 | 44 | #include <xen/xenbus.h>
|
@@ -153,6 +154,40 @@ static int blkif_getgeo(struct block_device *bd, struct hd_geometry *hg)
|
153 | 154 | return 0;
|
154 | 155 | }
|
155 | 156 |
|
| 157 | +int blkif_ioctl(struct inode *inode, struct file *filep, |
| 158 | + unsigned command, unsigned long argument) |
| 159 | +{ |
| 160 | + struct blkfront_info *info = |
| 161 | + inode->i_bdev->bd_disk->private_data; |
| 162 | + int i; |
| 163 | + |
| 164 | + dev_dbg(&info->xbdev->dev, "command: 0x%x, argument: 0x%lx\n", |
| 165 | + command, (long)argument); |
| 166 | + |
| 167 | + switch (command) { |
| 168 | + case CDROMMULTISESSION: |
| 169 | + dev_dbg(&info->xbdev->dev, "FIXME: support multisession CDs later\n"); |
| 170 | + for (i = 0; i < sizeof(struct cdrom_multisession); i++) |
| 171 | + if (put_user(0, (char __user *)(argument + i))) |
| 172 | + return -EFAULT; |
| 173 | + return 0; |
| 174 | + |
| 175 | + case CDROM_GET_CAPABILITY: { |
| 176 | + struct gendisk *gd = info->gd; |
| 177 | + if (gd->flags & GENHD_FL_CD) |
| 178 | + return 0; |
| 179 | + return -EINVAL; |
| 180 | + } |
| 181 | + |
| 182 | + default: |
| 183 | + /*printk(KERN_ALERT "ioctl %08x not supported by Xen blkdev\n", |
| 184 | + command);*/ |
| 185 | + return -EINVAL; /* same return as native Linux */ |
| 186 | + } |
| 187 | + |
| 188 | + return 0; |
| 189 | +} |
| 190 | + |
156 | 191 | /*
|
157 | 192 | * blkif_queue_request
|
158 | 193 | *
|
@@ -974,6 +1009,7 @@ static struct block_device_operations xlvbd_block_fops =
|
974 | 1009 | .open = blkif_open,
|
975 | 1010 | .release = blkif_release,
|
976 | 1011 | .getgeo = blkif_getgeo,
|
| 1012 | + .ioctl = blkif_ioctl, |
977 | 1013 | };
|
978 | 1014 |
|
979 | 1015 |
|
|
0 commit comments