From: Julien Oster <usenet-20040502@usenet.frodoid.org>
To: Peter Osterlund <petero2@telia.com>
Cc: Julien Oster <lkml-7994@mc.frodoid.org>,
Frediano Ziglio <freddyz77@tin.it>,
axboe@suse.de, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@osdl.org>
Subject: Re: Packet writing problems
Date: Wed, 18 Aug 2004 10:38:12 +0200 [thread overview]
Message-ID: <87brh86du3.fsf@killer.ninja.frodoid.org> (raw)
In-Reply-To: <87fz6k6eel.fsf@killer.ninja.frodoid.org> (Julien Oster's message of "Wed, 18 Aug 2004 10:25:54 +0200")
Julien Oster <usenet-20040502@usenet.frodoid.org> writes:
Hello,
> But couldn't you move the "inserted disc is..." messages to
> pkt_good_disc()? In the current source you basically duplicate the
> switch statement which checks the profile. The printks could be in the
> pkt_good_disc() check just as well.
So here's another patch instead which does what I meant.
Additionally, it inverts the return values of pkt_good_disc, so that
the condition later becomes "if (!pkt_good_disc(...))" (because
actually, it is NOT a good disc then)
--- fuzzy-2.6.8.1-orig/drivers/block/pktcdvd.c 2004-08-18 01:22:53.000000000 +0200
+++ fuzzy-2.6.8.1/drivers/block/pktcdvd.c 2004-08-18 10:34:52.239233284 +0200
@@ -1564,15 +1564,40 @@ static int pkt_good_track(track_informat
static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di)
{
switch (pd->mmc3_profile) {
- case 0x0a: /* CD-RW */
- case 0xffff: /* MMC3 not supported */
- break;
- case 0x1a: /* DVD+RW */
- case 0x13: /* DVD-RW */
+ case 0x08: /* CD-ROM */
+ printk("pktcdvd: inserted media is CD-ROM - no packet writing\n");
return 0;
- default:
- printk("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile);
+ case 0x09: /* CD-R */
+ printk("pktcdvd: inserted media is CD-R - no packet writing\n");
+ return 0;
+ case 0x0a: /* CD-RW */
+ printk("pktcdvd: inserted media is CD-RW\n");
+ return 1;
+ case 0x10: /* DVD-ROM */
+ printk("pktcdvd: inserted media is DVD-ROM - no packet writing\n");
+ return 0;
+ case 0x11: /* DVD-R */
+ printk("pktcdvd: inserted media is DVD-R - no packet writing\n");
+ return 0;
+ case 0x12: /* DVD-RAM */
+ printk("pktcdvd: inserted media is DVD-RAM - no packet writing\n");
+ return 0;
+ case 0x13: /* DVD-RW restricted overwrite */
+ printk("pktcdvd: inserted media is DVD-RW with restricted overwrite");
return 1;
+ case 0x14: /* DVD-RW sequential recording */
+ printk("pktcdvd: inserted media is DVD-RW with sequential recording"
+ " - no packet writing\n");
+ return 0;
+ case 0x1a: /* DVD+RW */
+ printk("pktcdvd: inserted media is DVD+RW\n");
+ return 1;
+ case 0xffff: /* unconforming */
+ printk("pktcdvd: inserted media does not conform to a known standard\n");
+ break;
+ default:
+ printk("pktcdvd: inserted media is yet UNKNOWN by pktcdvd\n");
+ return 0;
}
/*
@@ -1581,25 +1606,25 @@ static int pkt_good_disc(struct pktcdvd_
*/
if (di->disc_type == 0xff) {
printk("pktcdvd: Unknown disc. No track?\n");
- return 1;
+ return 0;
}
if (di->disc_type != 0x20 && di->disc_type != 0) {
printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type);
- return 1;
+ return 0;
}
if (di->erasable == 0) {
printk("pktcdvd: Disc not erasable\n");
- return 1;
+ return 0;
}
if (di->border_status == PACKET_SESSION_RESERVED) {
printk("pktcdvd: Can't write to last track (reserved)\n");
- return 1;
+ return 0;
}
- return 0;
+ return 1;
}
static int pkt_probe_settings(struct pktcdvd_device *pd)
@@ -1624,20 +1649,9 @@ static int pkt_probe_settings(struct pkt
return ret;
}
- if (pkt_good_disc(pd, &di))
+ if (!pkt_good_disc(pd, &di))
return -ENXIO;
- switch (pd->mmc3_profile) {
- case 0x1a: /* DVD+RW */
- printk("pktcdvd: inserted media is DVD+RW\n");
- break;
- case 0x13: /* DVD-RW */
- printk("pktcdvd: inserted media is DVD-RW\n");
- break;
- default:
- printk("pktcdvd: inserted media is CD-R%s\n", di.erasable ? "W" : "");
- break;
- }
pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR;
track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */
Regards,
Julien
next prev parent reply other threads:[~2004-08-18 8:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-16 15:16 Packet writing problems Frediano Ziglio
2004-08-16 18:50 ` Peter Osterlund
2004-08-16 19:09 ` Peter Osterlund
2004-08-16 19:51 ` Frediano Ziglio
2004-08-16 19:55 ` Frediano Ziglio
2004-08-17 19:59 ` Peter Osterlund
2004-08-17 20:24 ` Peter Osterlund
2004-08-17 23:31 ` Julien Oster
2004-08-17 23:36 ` Peter Osterlund
2004-08-18 8:25 ` Julien Oster
2004-08-18 8:38 ` Julien Oster [this message]
2004-08-18 8:48 ` Julien Oster
[not found] <20040818125719.GA6021@linux-ari.internal>
2004-08-18 17:08 ` Julien Oster
2004-08-19 6:56 ` Alex Riesen
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=87brh86du3.fsf@killer.ninja.frodoid.org \
--to=usenet-20040502@usenet.frodoid.org \
--cc=akpm@osdl.org \
--cc=axboe@suse.de \
--cc=freddyz77@tin.it \
--cc=linux-kernel@vger.kernel.org \
--cc=lkml-7994@mc.frodoid.org \
--cc=petero2@telia.com \
/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.