mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Further change to change_floppy()
@ 2002-06-04  8:42 Leigh Brown
  0 siblings, 0 replies; only message in thread
From: Leigh Brown @ 2002-06-04  8:42 UTC (permalink / raw)
  To: linux-kernel; +Cc: marcelo, viro, Eddie Bindt

Hi, 

The swim3 floppy driver does not let you open the floppy device for
writing (O_RDWR) if the drive contains a write-protected floppy.  Since
the FDEJECT IOCTL works if the device has been opened read only, the
open can safely be changed to use O_RDONLY. 

This patch (against 2.4.19pre9) has been tested on an ANS (swim3), but
has not been tested using the standard floppy driver.  However, there is
a comment in the standard floppy driver code to indicate that it should
work, as shown below: 

/* Allow ioctls if we have write-permissions even if read-only open. 
 * Needed so that programs such as fdrawcmd still can work on write 
 * protected disks */ 
if ((filp->f_mode & 2) || 
    (inode->i_sb && (permission(inode,2) == 0))) 
    filp->private_data = (void*) 8; 

Cheers, 

Leigh. 

diff -ur linux-2.4.19-pre9/init/do_mounts.c linux-2.4.19-pre9-local/init/do_mounts.c
--- linux-2.4.19-pre9/init/do_mounts.c	Fri May 31 09:22:57 2002
+++ linux-2.4.19-pre9-local/init/do_mounts.c	Fri May 31 09:36:00 2002
@@ -388,7 +388,7 @@
 	va_start(args, fmt);
 	vsprintf(buf, fmt, args);
 	va_end(args);
-	fd = open("/dev/root", O_RDWR | O_NDELAY, 0);
+	fd = open("/dev/root", O_RDONLY | O_NDELAY, 0);
 	if (fd >= 0) {
 		sys_ioctl(fd, FDEJECT, 0);
 		close(fd);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-06-04  8:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-04  8:42 [PATCH] Further change to change_floppy() Leigh Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®