Commit 1f8547ed authored by Alexander Viro's avatar Alexander Viro Committed by Andy Grover

[PATCH] bd_dev cleanups

Eliminated several gratitious ->bd_dev uses.
parent bb05e1aa
......@@ -1299,14 +1299,15 @@ static void do_fd_request(request_queue_t* q)
}
static int invalidate_drive(int rdev)
static int invalidate_drive(struct block_device *bdev)
{
struct archy_floppy_struct *p = bdev->bd_disk->private_data;
/* invalidate the buffer track to force a reread */
#ifdef TRACKBUFFER
BufferDrive = -1;
#endif
set_bit(rdev & 3, &fake_change);
set_bit(p - unit, &fake_change);
return 0;
}
......@@ -1314,12 +1315,11 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long param)
{
struct block_device *bdev = inode->i_bdev;
int drive = MINOR(bdev->bd_dev);
switch (cmd) {
case FDFMTEND:
case FDFLUSH:
invalidate_drive(drive);
invalidate_drive(bdev);
check_disk_change(bdev);
case FDFMTBEG:
return 0;
......
......@@ -2913,7 +2913,7 @@ static inline void DAC960_ProcessCompletedBuffer(BufferHeader_T *BufferHeader,
static inline int DAC960_PartitionByCommand(DAC960_Command_T *Command)
{
return DAC960_PartitionNumber(to_kdev_t(Command->BufferHeader->bi_bdev->bd_dev));
return (int)Command->BufferHeader->bi_bdev->bd_disk->private_data;
}
/*
......
......@@ -3299,7 +3299,7 @@ static int raw_cmd_ioctl(int cmd, void *param)
static int invalidate_drive(struct block_device *bdev)
{
/* invalidate the buffer track to force a reread */
set_bit(DRIVE(to_kdev_t(bdev->bd_dev)), &fake_change);
set_bit((int)bdev->bd_disk->private_data, &fake_change);
process_fd_request();
check_disk_change(bdev);
return 0;
......
......@@ -178,14 +178,12 @@ raw_ctl_ioctl(struct inode *inode, struct file *filp,
up(&raw_mutex);
} else {
struct block_device *bdev;
kdev_t dev;
down(&raw_mutex);
bdev = rawdev->binding;
if (bdev) {
dev = to_kdev_t(bdev->bd_dev);
rq.block_major = major(dev);
rq.block_minor = minor(dev);
rq.block_major = MAJOR(bdev->bd_dev);
rq.block_minor = MINOR(bdev->bd_dev);
} else {
rq.block_major = rq.block_minor = 0;
}
......
......@@ -1127,7 +1127,7 @@ static int __init init_blkmtd(void)
return 1;
}
/* get the block device */
bdev = bdget(kdev_t_to_nr(mk_kdev(maj, min)));
bdev = bdget(rdev);
err = blkdev_get(bdev, mode, 0, BDEV_RAW);
if (err)
return 1;
......
......@@ -241,14 +241,13 @@ dasd_ioctl_format(struct block_device *bdev, int no, long args)
dasd_devmap_t *devmap;
dasd_device_t *device;
format_data_t fdata;
int partn, rc;
int rc;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (!args)
return -EINVAL;
/* fdata == NULL is no longer a valid arg to dasd_format ! */
partn = MINOR(bdev->bd_dev) & DASD_PARTN_MASK;
devmap = dasd_devmap_from_bdev(bdev);
device = (devmap != NULL) ?
dasd_get_device(devmap) : ERR_PTR(-ENODEV);
......@@ -260,7 +259,7 @@ dasd_ioctl_format(struct block_device *bdev, int no, long args)
rc = -EROFS;
else if (copy_from_user(&fdata, (void *) args, sizeof (format_data_t)))
rc = -EFAULT;
else if (partn != 0) {
else if (bdev != bdev->bd_contains) {
DEV_MESSAGE(KERN_WARNING, device, "%s",
"Cannot low-level format a partition");
rc = -EINVAL;
......@@ -428,7 +427,7 @@ dasd_ioctl_set_ro(struct block_device *bdev, int no, long args)
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (MINOR(bdev->bd_dev) & DASD_PARTN_MASK)
if (bdev != bdev->bd_contains)
// ro setting is not allowed for partitions
return -EINVAL;
if (get_user(intval, (int *) args))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment