Skip to contentSkip to conversation

scsi.h uses "u8" which isn't defined.

PATCH In review Dominik Strasser 3 participants 7 messages Aug 17, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi.h uses "u8" which isn't defined.

scsi.h uses "u8" which doesn't seem to be defined. Better use u_char.

tmp/scsi.h 2003-08-17 14:39:42.000000000 +0200 renamed from include/scsi/scsi.h 2003-08-17 14:36:02.000000000 +0200 +1 -1
@@ -226,7 +226,7 @@
  * ScsiLun: 8 byte LUN.
  */
 typedef struct scsi_lun {
-       u_char scsi_lun[8];
+       u8 scsi_lun[8];
 } ScsiLun;
 
 /*

Dominik

#1 lore raw
Quoted 2 lines · Dominik Strasser

scsi.h uses "u8" which doesn't seem to be defined. Better use u_char.

It's defined in <linux/types.h> as is u_char. But we generally prefer explicitly sized types in Linux - and u_char is a BSDism, the right not explicitly sized type would be unsigned char.

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 2 lines · Dominik Strasser

scsi.h uses "u8" which doesn't seem to be defined. Better use u_char.

It's defined in <linux/types.h> as is u_char. But we generally prefer explicitly sized types in Linux - and u_char is a BSDism, the right not explicitly sized type would be unsigned char.

I am sorry, in 2.6.0-test3 (which I should have mentioned), there is no u8 in liux/types.h. Just a __u8. Nevertheless there is a mixture in scsi.h, some lines above, u_char is used. This is why I chose to use it.

Dominik

#3 lore raw
Quoted 2 lines · Dominik Strasser

I am sorry, in 2.6.0-test3 (which I should have mentioned), there is no u8 in liux/types.h.

u8 is defined in asm/types.h but the proper way to include asm/types.h is through linux/types.h.

Quoted 3 lines

Just a __u8.
Nevertheless there is a mixture in scsi.h, some lines above, u_char is used. This is why I chose to use it.

If you want consistency please convert all u_char to u8 (similar for u_short -> u16 and u_int -> u32)

#4 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 1 line · Dominik Strasser

I am sorry, in 2.6.0-test3 (which I should have mentioned), there is no u8 in liux/types.h.

u8 is defined in asm/types.h but the proper way to include asm/types.h is through linux/types.h.

Quoted 8 lines
Quoted 2 lines

Just a __u8.
Nevertheless there is a mixture in scsi.h, some lines above, u_char is used. This is why I chose to use it.

If you want consistency please convert all u_char to u8 (similar for u_short -> u16 and u_int -> u32)

OK, here we go:

scsi/scsi.h 2003-08-17 15:46:27.000000000 +0200 renamed from tmp/scsi.h 2003-08-17 14:39:42.000000000 +0200 +2 -0
@@ -6,6 +6,8 @@
  * the scsi code for linux.
  */
 
+#include <linux/types.h>
+
 /*
     $Header: /usr/src/linux/include/linux/RCS/scsi.h,v 1.3 1993/09/24 

12:20:33 drew Exp $

@@ -208,18 +210,18 @@

struct ccs_modesel_head
{

-    u_char  _r1;    /* reserved */
-    u_char  medium; /* device-specific medium type */
-    u_char  _r2;    /* reserved */
-    u_char  block_desc_length; /* block descriptor length */
-    u_char  density; /* device-specific density code */
-    u_char  number_blocks_hi; /* number of blocks in this block desc */
-    u_char  number_blocks_med;
-    u_char  number_blocks_lo;
-    u_char  _r3;
-    u_char  block_length_hi; /* block length for blocks in this desc */
-    u_char  block_length_med;
-    u_char  block_length_lo;
+    u8  _r1;    /* reserved */
+    u8  medium; /* device-specific medium type */
+    u8  _r2;    /* reserved */
+    u8  block_desc_length; /* block descriptor length */
+    u8  density; /* device-specific density code */
+    u8  number_blocks_hi; /* number of blocks in this block desc */
+    u8  number_blocks_med;
+    u8  number_blocks_lo;
+    u8  _r3;
+    u8  block_length_hi; /* block length for blocks in this desc */
+    u8  block_length_med;
+    u8  block_length_lo;

};

/*

#5 lore raw
In reply to Dominik Strasser
Quoted 2 lines · Dominik Strasser

I am sorry, in 2.6.0-test3 (which I should have mentioned), there is no u8 in liux/types.h. Just a __u8.

linux/types.h brings in asm/types.h, which (at least on x86) defines u8, ifndef __ASSEMBLY__.

Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org
#6 lore raw
In reply to Dominik Strasser

tmp/scsi.h 2003-08-17 14:39:42.000000000 +0200 line 230

Quoted 12 lines · Dominik Strasser

scsi.h uses "u8" which doesn't seem to be defined. Better use u_char.

tmp/scsi.h 2003-08-17 14:39:42.000000000 +0200 renamed from include/scsi/scsi.h 2003-08-17 14:36:02.000000000 +0200 +1 -1
@@ -226,7 +226,7 @@
  * ScsiLun: 8 byte LUN.
  */
 typedef struct scsi_lun {
-       u_char scsi_lun[8];
+       u8 scsi_lun[8];
 } ScsiLun;

IMO, it's more correct to include <linux/types.h> in scsi.h, which will bring in u8 and make scsi.h compilable on its own (provided __KERNEL__ is defined, as it should be).

Index: include/scsi/scsi.h
===================================================================
RCS file: /home/cvs/linux-2.5/include/scsi/scsi.h,v retrieving revision 1.10

scsi/scsi.h +2 -0
diff -u -r1.10 scsi.h
@@ -14,6 +14,8 @@
 
 */
 
+#include <linux/types.h> 
+
 /*
  * SCSI command lengths
  */
Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org