summaryrefslogtreecommitdiffstats
path: root/drivers/acorn
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-05 06:47:02 +0000
commit99a7e12f34b3661a0d1354eef83a0eef4df5e34c (patch)
tree3560aca9ca86792f9ab7bd87861ea143a1b3c7a3 /drivers/acorn
parente73a04659c0b8cdee4dd40e58630e2cf63afb316 (diff)
Merge with Linux 2.3.38.
Diffstat (limited to 'drivers/acorn')
-rw-r--r--drivers/acorn/block/fd1772.c40
-rw-r--r--drivers/acorn/block/mfmhd.c19
2 files changed, 12 insertions, 47 deletions
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
index 59030ebd5..cd2513b42 100644
--- a/drivers/acorn/block/fd1772.c
+++ b/drivers/acorn/block/fd1772.c
@@ -1350,10 +1350,6 @@ static int invalidate_drive(int rdev)
static int fd_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long param)
{
-#define IOCTL_MODE_BIT 8
-#define OPEN_WRITE_BIT 16
-#define IOCTL_ALLOWED (filp && (filp->f_mode & IOCTL_MODE_BIT))
-
int drive, device;
device = inode->i_rdev;
@@ -1361,8 +1357,6 @@ static int fd_ioctl(struct inode *inode, struct file *filp,
RO_IOCTLS(inode->i_rdev, param);
}
drive = MINOR(device);
- if (!IOCTL_ALLOWED)
- return -EPERM;
switch (cmd) {
case FDFMTBEG:
return 0;
@@ -1544,12 +1538,6 @@ static int floppy_open(struct inode *inode, struct file *filp)
if (old_dev && old_dev != inode->i_rdev)
invalidate_buffers(old_dev);
- /* Allow ioctls if we have write-permissions even if read-only open */
- if (filp->f_mode & 2 || permission(inode, 2) == 0)
- filp->f_mode |= IOCTL_MODE_BIT;
- if (filp->f_mode & 2)
- filp->f_mode |= OPEN_WRITE_BIT;
-
if (filp->f_flags & O_NDELAY)
return 0;
@@ -1570,12 +1558,9 @@ static void floppy_release(struct inode *inode, struct file *filp)
{
int drive;
- drive = inode->i_rdev & 3;
+ drive = MINOR(inode->i_rdev) & 3;
- if (!filp || (filp->f_mode & (2 | OPEN_WRITE_BIT)))
- /* if the file is mounted OR (writable now AND writable at open
- time) Linus: Does this cover all cases? */
- block_fsync(inode, filp);
+ block_fsync(inode, filp);
if (fd_ref[drive] < 0)
fd_ref[drive] = 0;
@@ -1585,22 +1570,13 @@ static void floppy_release(struct inode *inode, struct file *filp)
}
}
-static struct file_operations floppy_fops =
+static struct block_device_operations floppy_fops =
{
- NULL, /* lseek - default */
- block_read, /* read - general block-dev read */
- block_write, /* write - general block-dev write */
- NULL, /* readdir - bad */
- NULL, /* select */
- fd_ioctl, /* ioctl */
- NULL, /* mmap */
- floppy_open, /* open */
- NULL, /* flush */
- floppy_release, /* release */
- block_fsync, /* fsync */
- NULL, /* fasync */
- check_floppy_change, /* media_change */
- floppy_revalidate, /* revalidate */
+ open: floppy_open,
+ release: floppy_release,
+ ioctl: fd_ioctl,
+ check_media_change: check_floppy_change,
+ revalidate: floppy_revalidate,
};
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
index 7a8ea6f8e..5931e1d93 100644
--- a/drivers/acorn/block/mfmhd.c
+++ b/drivers/acorn/block/mfmhd.c
@@ -1365,22 +1365,11 @@ static void mfm_geninit (struct gendisk *gdev)
hardsect_size[MAJOR_NR] = mfm_sectsizes;
}
-static struct file_operations mfm_fops =
+static struct block_device_operations mfm_fops =
{
- NULL, /* lseek - default */
- block_read, /* read - general block-dev read */
- block_write, /* write - general block-dev write */
- NULL, /* readdir - bad */
- NULL, /* poll */
- mfm_ioctl, /* ioctl */
- NULL, /* mmap */
- mfm_open, /* open */
- NULL, /* flush */
- mfm_release, /* release */
- block_fsync, /* fsync */
- NULL, /* fasync */
- NULL, /* check_media_change */
- NULL /* revalidate */
+ open: mfm_open,
+ release: mfm_release,
+ ioctl: mfm_ioctl,
};