Skip to contentSkip to conversation

scsi: consistent use of __u8 in scsi/scsi.h

PATCH New Michael S. Tsirkin 1 participant 4 messages Sep 29, 2009 1 message 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]

#1 lore raw

PATCH v2 1/4 scsi: consistent use of __u8 in scsi/scsi.h

scsi/scsi.h is exported to userspace, so it should use __u8 instead of u8 as other userspace-visible headers do.

This fixes the following errors when application includes scsi/scsi.h
generated with make headers_install:
include/scsi/scsi.h:145: error: expected specifier-qualifier-list before ‘u8’ include/scsi/scsi.h: In function ‘scsi_varlen_cdb_length’:
include/scsi/scsi.h:156: error: ‘struct scsi_varlen_cdb_hdr’ has no member named ‘additional_cdb_length’

---
 include/scsi/scsi.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
include/scsi/scsi.h +4 -4
index 084478e..dfcfaab 100644
@@ -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 */
 };
Signature · 1 line
1.6.5.rc2
#2 lore raw

PATCH v2 2/4 scsi: make scsi/scsi.h headers_check clean

In reply to a message not in the archive

place extern declarations in scsi/scsi.h within ifdef __KERNEL__ so that make headers_install strips them out.

---
 include/scsi/scsi.h |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
include/scsi/scsi.h +4 -0
index dfcfaab..418465a 100644
@@ -150,6 +150,7 @@ struct scsi_varlen_cdb_hdr {
 	/* service specific data follows */
 };
 
+#ifdef __KERNEL__
 static inline unsigned
 scsi_varlen_cdb_length(const void *hdr)
 {
@@ -165,6 +166,7 @@ scsi_command_size(const unsigned char *cmnd)
 	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
@@ -281,8 +283,10 @@ enum scsi_protocol {
 	SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
 };
 
+#ifdef __KERNEL__
 /* Returns a human-readable name for the device */
 extern const char * scsi_device_type(unsigned type);
+#endif
 
 /*
  * standard mode-select header prepended to all mode-select commands
Signature · 1 line
1.6.5.rc2
#3 lore raw

PATCH v2 3/4 scsi: export scsi_ioctl.h and sg.h headers

In reply to a message not in the archive

glibc uses scsi/sg.h and scsi/scsi_ioctl.h, so we need to export these headers.

---
 include/scsi/Kbuild |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/scsi/Kbuild +2 -0
index 33b2750..a61932c 100644
@@ -1,3 +1,5 @@
+header-y += sg.h
+header-y += scsi_ioctl.h
 header-y += scsi.h
 header-y += scsi_netlink.h
 header-y += scsi_netlink_fc.h
Signature · 1 line
1.6.5.rc2
#4 lore raw

PATCH v2 4/4 scsi: export scsi_tgt_if.h

In reply to a message not in the archive

The header scsi_tgt_if.h is used by the SCSI target framework (tgt) (http://stgt.berlios.de/).
Export it from kernel.

---
 include/scsi/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/scsi/Kbuild +1 -0
index a61932c..d798db8 100644
@@ -4,3 +4,4 @@ header-y += scsi.h
 header-y += scsi_netlink.h
 header-y += scsi_netlink_fc.h
 header-y += scsi_bsg_fc.h
+header-y += scsi_tgt_if.h
Signature · 1 line
1.6.5.rc2