Skip to contentSkip to conversation

aic94xx: new driver

SCSI David Woodhouse 3 participants 6 messages Aug 10, 2007 – Aug 11, 2007 1 message not in the archive

lore
Share & tools
lore

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

#1 lore raw

include/scsi/scsi.h #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 · line 438

Quoted 13 lines · Linux Kernel Mailing List
include/scsi/scsi.h +6 -0
@@ -429,4 +429,10 @@ #define SCSI_IOCTL_GET_BUS_NUMBER  0x5386
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI             0x5387
 
+/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
+static inline u32 scsi_to_u32(u8 *ptr)
+{
+       return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
+}
+
 #endif /* _SCSI_SCSI_H */ 

Please explain why it's necessary to export this to userspace.

The files in /usr/include/scsi are actually shipped by glibc, and most distributions use glibc's version instead of the one from the kernel -- so this additional userspace interface is automatically incompatible with most people's installations.

It would perhaps make sense to stop glibc providing these files, and let distributions use the version from the kernel -- but that's a separate issue. And still doesn't seem to justify the addition of the above function.

Signature · 1 line
dwmw2
#2 lore raw
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Linux Kernel Mailing List
include/scsi/scsi.h +0 -0
@@ -429,4 +429,10 @@ #define SCSI_IOCTL_GET_BUS_NUMBER  0x5386
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI             0x5387
 
Quoted 9 lines

include/scsi/scsi.h #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 · line 438

Quoted 7 lines
include/scsi/scsi.h +6 -0
+/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
+static inline u32 scsi_to_u32(u8 *ptr)
+{
+       return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
+}
+
 #endif /* _SCSI_SCSI_H */ 

Please explain why it's necessary to export this to userspace.

Er it's not ... but then it's not necessary to export this entire file, either.

Quoted 11 lines

The files in /usr/include/scsi are actually shipped by glibc, and most distributions use glibc's version instead of the one from the kernel -- so this additional userspace interface is automatically incompatible with most people's installations.

It would perhaps make sense to stop glibc providing these files, and let distributions use the version from the kernel -- but that's a separate issue. And still doesn't seem to justify the addition of the above function.

From the SCSI point of view, the function definitely belongs in that

file because it's an accessor to facilitate the processing of commands and their replies, which is what that file contains ... in fact it contains a lot of the internal mechanics of the SCSI layer that the user shouldn't necessarily be seeing.

James

#3 lore raw
Quoted 18 lines · James Bottomley
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Linux Kernel Mailing List
include/scsi/scsi.h +0 -0
@@ -429,4 +429,10 @@ #define SCSI_IOCTL_GET_BUS_NUMBER  0x5386
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI             0x5387
 
Quoted 9 lines

include/scsi/scsi.h #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 · line 438

Quoted 7 lines
include/scsi/scsi.h +6 -0
+/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
+static inline u32 scsi_to_u32(u8 *ptr)
+{
+       return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
+}
+
 #endif /* _SCSI_SCSI_H */ 

Please explain why it's necessary to export this to userspace.

Quoted 2 lines

Er it's not ... but then it's not necessary to export this entire file, either.

That's an acceptable answer, I suppose, given that glibc ships its own copy of the file in question.

But it does contain ioctl definitions, and if we ever added any new ioctls presumably they'd be added there too? It does seem to be the kind of thing we _do_ want to export from the kernel, surely?

Quoted 5 lines

From the SCSI point of view, the function definitely belongs in that file because it's an accessor to facilitate the processing of commands and their replies, which is what that file contains ... in fact it contains a lot of the internal mechanics of the SCSI layer that the user shouldn't necessarily be seeing.

All the more reason for us to export it for ourselves and exert some editorial control, perhaps?

Signature · 1 line
dwmw2
#4 lore raw
Quoted 22 lines · David Woodhouse
Quoted 18 lines · James Bottomley
Quoted 7 lines · David Woodhouse
Quoted 6 lines · Linux Kernel Mailing List
include/scsi/scsi.h +0 -0
@@ -429,4 +429,10 @@ #define SCSI_IOCTL_GET_BUS_NUMBER  0x5386
 /* Used to obtain the PCI location of a device */
 #define SCSI_IOCTL_GET_PCI             0x5387
 
Quoted 9 lines

include/scsi/scsi.h #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 · line 438

Quoted 7 lines
include/scsi/scsi.h +6 -0
+/* Pull a u32 out of a SCSI message (using BE SCSI conventions) */
+static inline u32 scsi_to_u32(u8 *ptr)
+{
+       return (ptr[0]<<24) + (ptr[1]<<16) + (ptr[2]<<8) + ptr[3];
+}
+
 #endif /* _SCSI_SCSI_H */ 

Please explain why it's necessary to export this to userspace.

Quoted 2 lines

Er it's not ... but then it's not necessary to export this entire file, either.

Quoted 6 lines

That's an acceptable answer, I suppose, given that glibc ships its own copy of the file in question.

But it does contain ioctl definitions, and if we ever added any new ioctls presumably they'd be added there too? It does seem to be the kind of thing we _do_ want to export from the kernel, surely?

Oh .. I thought we'd already got around that one by duplicating the ioctls? Those five are all deprecated, but if that's what you want exporting, we could separate them into a new file.

Quoted 8 lines
Quoted 5 lines

From the SCSI point of view, the function definitely belongs in that file because it's an accessor to facilitate the processing of commands and their replies, which is what that file contains ... in fact it contains a lot of the internal mechanics of the SCSI layer that the user shouldn't necessarily be seeing.

All the more reason for us to export it for ourselves and exert some editorial control, perhaps?

Even if I'd known it was exported, I'm still not sure I'd have noticed why or what the issues are.

James

#5 lore raw
In reply to David Woodhouse
Quoted 4 lines · David Woodhouse

The files in /usr/include/scsi are actually shipped by glibc, and most distributions use glibc's version instead of the one from the kernel -- so this additional userspace interface is automatically incompatible with most people's installations.

Stop here right now. You just noticed the real bug, and that's exporting scsi.h at all. I think Olaf sent a patch to fix this already.

#6 lore raw
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · David Woodhouse

The files in /usr/include/scsi are actually shipped by glibc, and most distributions use glibc's version instead of the one from the kernel -- so this additional userspace interface is automatically incompatible with most people's installations.

Stop here right now. You just noticed the real bug, and that's exporting scsi.h at all. I think Olaf sent a patch to fix this already.

That's a good enough answer for me, certainly.

Signature · 1 line
dwmw2