patch-2.3.37 linux/drivers/block/swim_iop.c

Next file: linux/drivers/block/via82cxxx.c
Previous file: linux/drivers/block/swim3.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.36/linux/drivers/block/swim_iop.c linux/drivers/block/swim_iop.c
@@ -45,9 +45,6 @@
 
 #define MAX_FLOPPIES	4
 
-#define IOCTL_MODE_BIT	8
-#define OPEN_WRITE_BIT	16
-
 enum swim_state {
 	idle,
 	available,
@@ -397,8 +394,7 @@
 	if (devnum >= floppy_count)
 		return -ENODEV;
 		
-	if (((cmd & 0x40) && !(filp && (filp->f_mode & IOCTL_MODE_BIT))) ||
-	    ((cmd & 0x80) && !suser()))
+	if ((cmd & 0x80) && !suser())
 		return -EPERM;
 
 	fs = &floppy_states[devnum];
@@ -451,12 +447,6 @@
 	else
 		++fs->ref_count;
 
-	/* 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;
-
 	return 0;
 }
 
@@ -468,14 +458,7 @@
 	if (devnum >= floppy_count)
 		return -ENODEV;
 
-	/*
-	 * If filp is NULL, we're being called from blkdev_release
-	 * or after a failed mount attempt.  In the former case the
-	 * device has already been sync'ed, and in the latter no
-	 * sync is required.  Otherwise, sync if filp is writable.
-	 */
-	if (filp && (filp->f_mode & (2 | OPEN_WRITE_BIT)))
-		block_fsync (filp, filp->f_dentry);
+	block_fsync (filp, filp->f_dentry);
 
 	fs = &floppy_states[devnum];
 	if (fs->ref_count > 0) fs->ref_count--;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)