]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] pktcdvd: Only return -EROFS when appropriate
authorPeter Osterlund <petero2@telia.com>
Tue, 21 Feb 2006 02:28:04 +0000 (18:28 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 21 Feb 2006 04:00:11 +0000 (20:00 -0800)
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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/pktcdvd.c

index eb83197cc36ceacc5f9b1a89e40b27f1e7dc71b2..bc9b2bcd7dba71023824ebb8adc6cbf9e9e0c712 100644 (file)
@@ -1597,7 +1597,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
        }
 
        if (!pkt_writable_disc(pd, &di))
-               return -ENXIO;
+               return -EROFS;
 
        pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR;
 
@@ -1609,7 +1609,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
 
        if (!pkt_writable_track(pd, &ti)) {
                printk("pktcdvd: can't write to this track\n");
-               return -ENXIO;
+               return -EROFS;
        }
 
        /*
@@ -1623,7 +1623,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
        }
        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);
@@ -1665,7 +1665,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
                        break;
                default:
                        printk("pktcdvd: unknown data mode\n");
-                       return 1;
+                       return -EROFS;
        }
        return 0;
 }
@@ -1876,7 +1876,7 @@ static int pkt_open_write(struct pktcdvd_device *pd)
 
        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))) {