aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/cciss.c
diff options
context:
space:
mode:
authorStephen M. Cameron <scameron@beardog.cce.hp.com>2010-08-26 14:56:20 -0400
committerJens Axboe <jaxboe@fusionio.com>2010-09-10 06:12:36 -0400
commit0894b32c5c1444d25f3e988cf03415ce8dfc5142 (patch)
tree525a32e3350db1325e9ec9bdaa12271a15e66e53 /drivers/block/cciss.c
parentc525919ddf0b10ff0e1f528dd50d90edfdee4797 (diff)
cciss: factor out cciss_getluninfo
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/block/cciss.c')
-rw-r--r--drivers/block/cciss.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 71018b988595..5abdce3ef70b 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1382,12 +1382,27 @@ static int cciss_getdrivver(ctlr_info_t *h, void __user *argp)
1382 return 0; 1382 return 0;
1383} 1383}
1384 1384
1385static int cciss_getluninfo(ctlr_info_t *h,
1386 struct gendisk *disk, void __user *argp)
1387{
1388 LogvolInfo_struct luninfo;
1389 drive_info_struct *drv = get_drv(disk);
1390
1391 if (!argp)
1392 return -EINVAL;
1393 memcpy(&luninfo.LunID, drv->LunID, sizeof(luninfo.LunID));
1394 luninfo.num_opens = drv->usage_count;
1395 luninfo.num_parts = 0;
1396 if (copy_to_user(argp, &luninfo, sizeof(LogvolInfo_struct)))
1397 return -EFAULT;
1398 return 0;
1399}
1400
1385static int cciss_ioctl(struct block_device *bdev, fmode_t mode, 1401static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
1386 unsigned int cmd, unsigned long arg) 1402 unsigned int cmd, unsigned long arg)
1387{ 1403{
1388 struct gendisk *disk = bdev->bd_disk; 1404 struct gendisk *disk = bdev->bd_disk;
1389 ctlr_info_t *h = get_host(disk); 1405 ctlr_info_t *h = get_host(disk);
1390 drive_info_struct *drv = get_drv(disk);
1391 void __user *argp = (void __user *)arg; 1406 void __user *argp = (void __user *)arg;
1392 1407
1393 dev_dbg(&h->pdev->dev, "cciss_ioctl: Called with cmd=%x %lx\n", 1408 dev_dbg(&h->pdev->dev, "cciss_ioctl: Called with cmd=%x %lx\n",
@@ -1415,19 +1430,8 @@ static int cciss_ioctl(struct block_device *bdev, fmode_t mode,
1415 case CCISS_REGNEWD: 1430 case CCISS_REGNEWD:
1416 case CCISS_REVALIDVOLS: 1431 case CCISS_REVALIDVOLS:
1417 return rebuild_lun_table(h, 0, 1); 1432 return rebuild_lun_table(h, 0, 1);
1418 1433 case CCISS_GETLUNINFO:
1419 case CCISS_GETLUNINFO:{ 1434 return cciss_getluninfo(h, disk, argp);
1420 LogvolInfo_struct luninfo;
1421
1422 memcpy(&luninfo.LunID, drv->LunID,
1423 sizeof(luninfo.LunID));
1424 luninfo.num_opens = drv->usage_count;
1425 luninfo.num_parts = 0;
1426 if (copy_to_user(argp, &luninfo,
1427 sizeof(LogvolInfo_struct)))
1428 return -EFAULT;
1429 return 0;
1430 }
1431 case CCISS_PASSTHRU: 1435 case CCISS_PASSTHRU:
1432 { 1436 {
1433 IOCTL_Command_struct iocommand; 1437 IOCTL_Command_struct iocommand;