* or has the same number as an existing one
* 0: all OK.
*/
-int add_partition(kdev_t dev, struct blkpg_partition *p)
+int add_partition(struct block_device *bdev, struct blkpg_partition *p)
{
struct gendisk *g;
long long ppstart, pplength;
long pstart, plength;
int i, drive, first_minor, end_minor, minor;
+ kdev_t dev = to_kdev_t(bdev->bd_dev);
/* convert bytes to sectors, check for fit in a hd_struct */
ppstart = (p->start >> 9);
*
* Note that the dev argument refers to the entire disk, not the partition.
*/
-int del_partition(kdev_t dev, struct blkpg_partition *p)
+int del_partition(struct block_device *bdev, struct blkpg_partition *p)
{
+ kdev_t dev = to_kdev_t(bdev->bd_dev);
struct gendisk *g;
kdev_t devp;
int drive, first_minor, minor;
return 0;
}
-int blkpg_ioctl(kdev_t dev, struct blkpg_ioctl_arg *arg)
+int blkpg_ioctl(struct block_device *bdev, struct blkpg_ioctl_arg *arg)
{
struct blkpg_ioctl_arg a;
struct blkpg_partition p;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (a.op == BLKPG_ADD_PARTITION)
- return add_partition(dev, &p);
+ return add_partition(bdev, &p);
else
- return del_partition(dev, &p);
+ return del_partition(bdev, &p);
default:
return -EINVAL;
}
#endif
case BLKPG:
- return blkpg_ioctl(dev, (struct blkpg_ioctl_arg *) arg);
+ return blkpg_ioctl(bdev, (struct blkpg_ioctl_arg *) arg);
/*
* deprecated, use the /proc/iosched interface instead