cdrom sane fallback vs 2.4.20-pre1
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +1
-1- if (ret) { + if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) {Do you really need to hardcode this values ?
We have no #defines for the asc and ascq codes (they are interpreted in constants.c but the values are hardcoded in there too). There is a #define for sense_key 0x05 as ILLEGAL_REQUEST in scsi/scsi.h, but these #defines have annoyed a lot of people by being rather namespace polluting.
James
On Tue, 13 Aug 2002, James Bottomley wrote:
| > > - if (ret) {
| > > + if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) {
| >
| > Do you really need to hardcode this values ?
|
| We have no #defines for the asc and ascq codes (they are interpreted in
| constants.c but the values are hardcoded in there too). There is a #define
| for sense_key 0x05 as ILLEGAL_REQUEST in scsi/scsi.h, but these #defines have
| annoyed a lot of people by being rather namespace polluting.and that's precisely the wrong attitude IMO.
I was glad to see that Marcelo asked about the hardcoded values. They hurt.
Signature · 1 line
~Randy
Quoted 12 lines · Randy.Dunlap
On Tue, 13 Aug 2002, James Bottomley wrote:
| > > - if (ret) { | > > + if (ret && sense.sense_key==0x05 && sense.asc==0x20 && sense.ascq==0x00) { | > | > Do you really need to hardcode this values ? | | We have no #defines for the asc and ascq codes (they are interpreted in | constants.c but the values are hardcoded in there too). There is a #define | for sense_key 0x05 as ILLEGAL_REQUEST in scsi/scsi.h, but these #defines have | annoyed a lot of people by being rather namespace polluting.
Quoted 4 lines
and that's precisely the wrong attitude IMO.
I was glad to see that Marcelo asked about the hardcoded values. They hurt.
I usually find it a hell of a lot easier remembering that 5/20/00 is illegal opcode, 5/24/00 is illegal field, etc. There are just too many of these to be named sanely. sense_key can be done, agreed, but asc and ascq just gets silly imo, and it makes it harder to read for those that know the codes. Encouraging others to look up the values (it's not hard, you can see it's asc and ascq and it relates to sense info) does definitely not hurt, they might pick up something else along the way.
Signature · 1 line
Jens Axboe
Quoted 1 line · [email protected] said:
and that's precisely the wrong attitude IMO.
I wasn't expressing an opinion, just stating what could and could not be done in 2.4.
Quoted 2 lines
I was glad to see that Marcelo asked about the hardcoded values. They hurt.
Well, this is a rather big and particularly rancid can of worms. If you look a little further, you'll see that cdrom.h has its own definition of the (effectively SCSI) struct request_sense that sr.c uses, yet the sense key is defined in scsi/scsi.h. Then you notice that cdrom.h also duplicates all of the scsi commands with a GPCMD_ prefix.
If you'd like to take this particular can of worms off somewhere, clean it out and return it neatly labelled, I'd be more than grateful...just don't take the lid off too close to me.
James
On Tue, 13 Aug 2002, James Bottomley wrote:
| [email protected] said: | > and that's precisely the wrong attitude IMO. | | I wasn't expressing an opinion, just stating what could and could not be done | in 2.4.
I guess that at least Jens and I (not trying to speak for Jens) see it as a style issue and somewhat as an education issue. At least we both used /IMO/i.
| > I was glad to see that Marcelo asked about the hardcoded values. They | > hurt. | | Well, this is a rather big and particularly rancid can of worms. If you look | a little further, you'll see that cdrom.h has its own definition of the | (effectively SCSI) struct request_sense that sr.c uses, yet the sense key is | defined in scsi/scsi.h. Then you notice that cdrom.h also duplicates all of | the scsi commands with a GPCMD_ prefix. | | If you'd like to take this particular can of worms off somewhere, clean it out | and return it neatly labelled, I'd be more than grateful...just don't take the | lid off too close to me.
I'm not sure that it could ever get by Jens, but I'll take a look at it.
Signature · 1 line
~Randy
Quoted 11 lines · Randy.Dunlap
On Tue, 13 Aug 2002, James Bottomley wrote:
| [email protected] said: | > and that's precisely the wrong attitude IMO. | | I wasn't expressing an opinion, just stating what could and could not be done | in 2.4.I guess that at least Jens and I (not trying to speak for Jens) see it as a style issue and somewhat as an education issue. At least we both used /IMO/i.
Right!
Quoted 13 lines
| > I was glad to see that Marcelo asked about the hardcoded values. They | > hurt. | | Well, this is a rather big and particularly rancid can of worms. If you look | a little further, you'll see that cdrom.h has its own definition of the | (effectively SCSI) struct request_sense that sr.c uses, yet the sense key is | defined in scsi/scsi.h. Then you notice that cdrom.h also duplicates all of | the scsi commands with a GPCMD_ prefix. | | If you'd like to take this particular can of worms off somewhere, clean it out | and return it neatly labelled, I'd be more than grateful...just don't take the | lid off too close to me.
Quoted 1 line
I'm not sure that it could ever get by Jens, but I'll take a look at it.
You make me sound like an old grump [1] :-)
I wouldn't mind unifying lots of the atapi and cdrom stuff. Most of the stuff I took care off was atapi and scsi cdrom unification, but it could be taken a step further.
GPCMD_ means general packet command, and signifies a command that is the same for atapi and scsi.
Come to think of it, the reason why I didn't completey unify SCSI request sense (eg) with cdrom stuff was that you quickly run into all sorts of ugliness with the various scsi versions, atapi version, reserved fields, added fields, etc. Something that looks good and should be good, suddenly breaks cdrom model XYZ that used to work (perhaps by chance) and still _ought_ to work.
But hey, knock yourself out :-)
[1] I'm not old
Signature · 1 line
Jens Axboe
Quoted 3 lines · [email protected] said:
I wouldn't mind unifying lots of the atapi and cdrom stuff. Most of the stuff I took care off was atapi and scsi cdrom unification, but it could be taken a step further.
Yes, perhaps in conjunction with a rationalisation of command packet interface to struct request and the block queue that made no prejudgement of what actually the command was packetised for. One modification I was thinking of would be simply to make struct_request.cmd a pointer rather than a char array.
That way, the prep functions can allocate it and fill it in with an arbitrary
packet command to be interpreted by the downstream driver (it will also get us out of the command size limitation problem---of course, the SCSI committee would never consider another command size increase...)
Quoted 6 lines
Come to think of it, the reason why I didn't completey unify SCSI request sense (eg) with cdrom stuff was that you quickly run into all sorts of ugliness with the various scsi versions, atapi version, reserved fields, added fields, etc. Something that looks good and should be good, suddenly breaks cdrom model XYZ that used to work (perhaps by chance) and still _ought_ to work.
In fact, it would be a particularly deep and rancid can of worms?
Quoted 1 line
But hey, knock yourself out :-)
Sure, by the time you've got a rational and unified interface that looks good, you'll probably have re-written big chunks of scsi and cdrom. However, if you can come up with a good scheme for the sense codes, it would be nice (the ASC ASCQ code combinations are in a table that covers thirteen pages of close printed type in the SCSI spec---constants.c only has the more frequently used ones).
James