diff options
author | Keith Busch <keith.busch@intel.com> | 2013-10-23 15:07:34 -0400 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2013-12-16 15:49:40 -0500 |
commit | 320a382746e0ab1304476ea7e986a8d416ab99db (patch) | |
tree | bbb40d77dd5f915fbdc87461869526e115f42de0 /drivers/block/nvme-core.c | |
parent | 481e5bad84239b01415b888df2040c1860ae3cfd (diff) |
NVMe: compat SG_IO ioctl
For 32-bit versions of sg3-utils running on a 64-bit system. This is
mostly a copy from the relevent portions of fs/compat_ioctl.c, with
slight modifications for going through block_device_operations.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Vishal Verma <vishal.l.verma@linux.intel.com>
[fixed up CONFIG_COMPAT=n build problems]
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block/nvme-core.c')
-rw-r--r-- | drivers/block/nvme-core.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index df3daeb6227f..e44350de8a21 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1568,10 +1568,26 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, | |||
1568 | } | 1568 | } |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | #ifdef CONFIG_COMPAT | ||
1572 | static int nvme_compat_ioctl(struct block_device *bdev, fmode_t mode, | ||
1573 | unsigned int cmd, unsigned long arg) | ||
1574 | { | ||
1575 | struct nvme_ns *ns = bdev->bd_disk->private_data; | ||
1576 | |||
1577 | switch (cmd) { | ||
1578 | case SG_IO: | ||
1579 | return nvme_sg_io32(ns, arg); | ||
1580 | } | ||
1581 | return nvme_ioctl(bdev, mode, cmd, arg); | ||
1582 | } | ||
1583 | #else | ||
1584 | #define nvme_compat_ioctl NULL | ||
1585 | #endif | ||
1586 | |||
1571 | static const struct block_device_operations nvme_fops = { | 1587 | static const struct block_device_operations nvme_fops = { |
1572 | .owner = THIS_MODULE, | 1588 | .owner = THIS_MODULE, |
1573 | .ioctl = nvme_ioctl, | 1589 | .ioctl = nvme_ioctl, |
1574 | .compat_ioctl = nvme_ioctl, | 1590 | .compat_ioctl = nvme_compat_ioctl, |
1575 | }; | 1591 | }; |
1576 | 1592 | ||
1577 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) | 1593 | static void nvme_resubmit_bios(struct nvme_queue *nvmeq) |