mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Leigh Brown <leigh@solinno.co.uk>
To: linux-kernel@vger.kernel.org
Cc: marcelo@conectiva.com.br, viro@math.psu.edu,
	Eddie Bindt <eddieb@xs4all.nl>
Subject: [PATCH] Further change to change_floppy()
Date: 04 Jun 2002 09:42:06 +0100	[thread overview]
Message-ID: <1023180126.20263.18.camel@kettle.solinno.co.uk> (raw)

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);


                 reply	other threads:[~2002-06-04  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1023180126.20263.18.camel@kettle.solinno.co.uk \
    --to=leigh@solinno.co.uk \
    --cc=eddieb@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®