All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Osterlund <petero2@telia.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 5/5] pktcdvd: Only return -EROFS when appropriate
Date: 19 Feb 2006 17:00:13 +0100	[thread overview]
Message-ID: <m3pslj9w4y.fsf_-_@telia.com> (raw)
In-Reply-To: <m3u0av9w83.fsf_-_@telia.com>

When attempting to open the device for writing, only return -EROFS if
the disc appears to be readable but not writable.

Signed-off-by: Peter Osterlund <petero2@telia.com>
---

 drivers/block/pktcdvd.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index dec68d0..772b63c 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -1598,7 +1598,7 @@ static int pkt_probe_settings(struct pkt
 	}
 
 	if (!pkt_writable_disc(pd, &di))
-		return -ENXIO;
+		return -EROFS;
 
 	pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR;
 
@@ -1610,7 +1610,7 @@ static int pkt_probe_settings(struct pkt
 
 	if (!pkt_writable_track(pd, &ti)) {
 		printk("pktcdvd: can't write to this track\n");
-		return -ENXIO;
+		return -EROFS;
 	}
 
 	/*
@@ -1624,7 +1624,7 @@ static int pkt_probe_settings(struct pkt
 	}
 	if (pd->settings.size > PACKET_MAX_SECTORS) {
 		printk("pktcdvd: packet size is too big\n");
-		return -ENXIO;
+		return -EROFS;
 	}
 	pd->settings.fp = ti.fp;
 	pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1);
@@ -1666,7 +1666,7 @@ static int pkt_probe_settings(struct pkt
 			break;
 		default:
 			printk("pktcdvd: unknown data mode\n");
-			return 1;
+			return -EROFS;
 	}
 	return 0;
 }
@@ -1877,7 +1877,7 @@ static int pkt_open_write(struct pktcdvd
 
 	if ((ret = pkt_probe_settings(pd))) {
 		VPRINTK("pktcdvd: %s failed probe\n", pd->name);
-		return -EROFS;
+		return ret;
 	}
 
 	if ((ret = pkt_set_write_settings(pd))) {

-- 
Peter Osterlund - petero2@telia.com
http://web.telia.com/~u89404340

      reply	other threads:[~2006-02-19 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-19 15:50 [PATCH 1/5] pktcdvd: Correctly set rq->cmd_len in pkt_generic_packet() Peter Osterlund
2006-02-19 15:53 ` [PATCH 2/5] pktcdvd: Rename functions and make their return values sane Peter Osterlund
2006-02-19 15:56   ` [PATCH 3/5] pktcdvd: Remove useless printk statements Peter Osterlund
2006-02-19 15:58     ` [PATCH 4/5] pktcdvd: Fix the logic in the pkt_writable_track function Peter Osterlund
2006-02-19 16:00       ` Peter Osterlund [this message]

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=m3pslj9w4y.fsf_-_@telia.com \
    --to=petero2@telia.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.