Skip to contentSkip to conversation

fix <scsi/scsi.h> for userland

PATCH Torsten Duwe 1 participant 1 message Dec 2, 2009 2 messages not in the archive SCSI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 8 lines · Greg KH
Quoted 6 lines · Torsten Duwe

Hi Greg!

When I recompiled my system yesterday with includes from the latest stable kernel(s) I found especially CD IO and similar breaking due to <scsi/scsi.h>. At least 2.6.32-rc8 and 2.6.31.6 need fixing. Please apply attached patch or equivalent.

Quoted 4 lines

Is the patch upstream already?

If not, please send this to the scsi maintainer, it needs to be there before I can apply it to the -stable releases.

Given that 2.6.32-rc8 and 2.6.31.6 are affected I don't think so. Resending. linux-scsi, feel free to ignore this if it's already fixed. Otherwise:

include/scsi/scsi.h renamed from include/scsi/scsi.h.orig +6 -4
@@ -142,10 +142,10 @@ struct scsi_cmnd;
 
 /* defined in T10 SCSI Primary Commands-2 (SPC2) */
 struct scsi_varlen_cdb_hdr {
-	u8 opcode;        /* opcode always == VARIABLE_LENGTH_CMD */
-	u8 control;
-	u8 misc[5];
-	u8 additional_cdb_length;         /* total cdb length - 8 */
+	__u8 opcode;        /* opcode always == VARIABLE_LENGTH_CMD */
+	__u8 control;
+	__u8 misc[5];
+	__u8 additional_cdb_length;         /* total cdb length - 8 */
 	__be16 service_action;
 	/* service specific data follows */
 };
@@ -156,6 +156,7 @@ scsi_varlen_cdb_length(const void *hdr)
 	return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
 }
 
+#ifdef __KERNEL__
 extern const unsigned char scsi_command_size_tbl[8];
 #define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
 
@@ -165,6 +166,7 @@ scsi_command_size(const unsigned char *c
 	return (cmnd[0] == VARIABLE_LENGTH_CMD) ?
 		scsi_varlen_cdb_length(cmnd) : COMMAND_SIZE(cmnd[0]);
 }
+#endif
 
 /*
  *  SCSI Architecture Model (SAM) Status codes. Taken from SAM-3 draft