Skip to contentSkip to conversation

export bsg.h header to user-mode

PATCH RESEND Applied Boaz Harrosh 5 participants 13 messages Jan 14, 2009 – Mar 8, 2009 SCSI

lore
Share & tools
lore
#0 lore raw

Hi TOMO.

I'm using bsg.ko to submit SG_IO version-4 commands to scsi devices from user-mode application. (version-4 for use of bidi and varlen).

I have not found a bsg.h header in my fedora-10 distribution. Is bsg.h exported in kernel-headers-package in latest Kernels? If not should we, and how to do it?

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

Thanks
Boaz

#1 lore raw
Quoted 8 lines · On Wed, 14 Jan 2009 18:24:54 +0200 Boaz Harrosh <[email protected]> wrote:

Hi TOMO.

I'm using bsg.ko to submit SG_IO version-4 commands to scsi devices from user-mode application. (version-4 for use of bidi and varlen).

I have not found a bsg.h header in my fedora-10 distribution. Is bsg.h exported in kernel-headers-package in latest Kernels? If not should we, and how to do it?

I think that we need to export struct sg_io_v4, BSG_PROTOCOL_SCSI, and BSG_SUB_PROTOCOL_SCSI_*.

We don't install any files in include/scsi/* to userspace.

fujita@viola:~/git/linux-2.6$ cat include/Kbuild
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below

header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/

I guess that SCSI header files for userspace (/usr/include/scsi/scsi.h, sg.h, etc) come from glibc (but I'm not sure). They are different from those in kernel.

Quoted 10 lines

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

Doug copies bsg.h to his smp_utils. I do the same thing for my own bsg programs. We need glibc (or someone) to install bsg.h properly.

#2 lore raw
Quoted 8 lines · FUJITA Tomonori
Quoted 5 lines · On Wed, 14 Jan 2009 18:24:54 +0200 Boaz Harrosh <[email protected]> wrote:

Hi TOMO.

I'm using bsg.ko to submit SG_IO version-4 commands to scsi devices from user-mode application. (version-4 for use of bidi and varlen).

Quoted 7 lines
Quoted 3 lines

I have not found a bsg.h header in my fedora-10 distribution. Is bsg.h exported in kernel-headers-package in latest Kernels? If not should we, and how to do it?

I think that we need to export struct sg_io_v4, BSG_PROTOCOL_SCSI, and BSG_SUB_PROTOCOL_SCSI_*.

I've tested and linux/bsg.h is perfect for user-mode consumption. It has a few kernel declarations protected by ifdef __KERNEL__ and exactly what you have above. I did not change anything

Quoted 6 lines

We don't install any files in include/scsi/* to userspace.

fujita@viola:~/git/linux-2.6$ cat include/Kbuild
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below
Quoted 8 lines

header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/

But that's fine then since bsg.h is in <linux/bsg.h> not <scsi/bsg.h> what is the problem?

OK But you just explained how to do it patch below ...

Quoted 11 lines

I guess that SCSI header files for userspace (/usr/include/scsi/scsi.h, sg.h, etc) come from glibc (but I'm not sure). They are different from those in kernel.

Quoted 6 lines

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Quoted 7 lines
Quoted 4 lines

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

Doug copies bsg.h to his smp_utils. I do the same thing for my own bsg programs. We need glibc (or someone) to install bsg.h properly.

That is not acceptable for me since I will need to provide an open-osd-devel package to distros and I might need bsg.h, which I cannot supply with my package, what if someone else will need it too then we have a conflict.

I'm sending a patch, please ACK?
Thanks
Boaz

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index 12e9a29..2124c06 100644
@@ -41,6 +41,7 @@ header-y += baycom.h
 header-y += bfs_fs.h
 header-y += blkpg.h
 header-y += bpqether.h
+header-y += bsg.h
 header-y += can.h
 header-y += cdk.h
 header-y += chio.h
Signature · 1 line
1.6.0.1
#3 lore raw
Quoted 19 lines · On Thu, 15 Jan 2009 10:57:13 +0200 Boaz Harrosh <[email protected]> wrote:

I've tested and linux/bsg.h is perfect for user-mode consumption. It has a few kernel declarations protected by ifdef __KERNEL__ and exactly what you have above. I did not change anything

Quoted 6 lines

We don't install any files in include/scsi/* to userspace.

fujita@viola:~/git/linux-2.6$ cat include/Kbuild
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below
Quoted 8 lines

header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/

Quoted 2 lines

But that's fine then since bsg.h is in <linux/bsg.h> not <scsi/bsg.h> what is the problem?

Oops, somehow I placed bsg.h in include/scsi. Ignore the above my comments.

Quoted 21 lines

OK But you just explained how to do it patch below ...

Quoted 11 lines

I guess that SCSI header files for userspace (/usr/include/scsi/scsi.h, sg.h, etc) come from glibc (but I'm not sure). They are different from those in kernel.

Quoted 6 lines

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Quoted 7 lines
Quoted 4 lines

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

Doug copies bsg.h to his smp_utils. I do the same thing for my own bsg programs. We need glibc (or someone) to install bsg.h properly.

Quoted 7 lines

That is not acceptable for me since I will need to provide an open-osd-devel package to distros and I might need bsg.h, which I cannot supply with my package, what if someone else will need it too then we have a conflict.

I'm sending a patch, please ACK?
Thanks
Boaz

As I wrote in the previous mail, exporting some of bsg stuff for userspace is necessary, I think. But I have no idea about the correct way to do it.

Seems the header files in /usr/include/linux/ are different from in kernel source code (pointless __KERNEL__ stuff are stripped):

fujita@viola:~$ diff git/linux-2.6/include/linux/xattr.h /usr/include/linux/xattr.h
16,19d15
< #ifdef  __KERNEL__
<
< #include <linux/types.h>
<
36,37d31
< struct inode;
< struct dentry;
49,53c43,45
< ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
< ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
< ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
< int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
< int vfs_removexattr(struct dentry *, const char *);
---
Quoted 3 lines

ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); int vfs_setxattr(struct dentry *, char *, void *, size_t, int); int vfs_removexattr(struct dentry *, char *);

60,61d51
< #endif /* __KERNEL__ */
<

Your patch does the right thing?

Quoted 42 lines

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index 12e9a29..2124c06 100644
@@ -41,6 +41,7 @@ header-y += baycom.h
 header-y += bfs_fs.h
 header-y += blkpg.h
 header-y += bpqether.h
+header-y += bsg.h
 header-y += can.h
 header-y += cdk.h
 header-y += chio.h
Signature · 11 lines
1.6.0.1

 




--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
Quoted 78 lines · FUJITA Tomonori
Quoted 18 lines · On Thu, 15 Jan 2009 10:57:13 +0200 Boaz Harrosh <[email protected]> wrote:

I've tested and linux/bsg.h is perfect for user-mode consumption. It has a few kernel declarations protected by ifdef __KERNEL__ and exactly what you have above. I did not change anything

Quoted 6 lines

We don't install any files in include/scsi/* to userspace.

fujita@viola:~/git/linux-2.6$ cat include/Kbuild
# Top-level Makefile calls into asm-$(ARCH)
# List only non-arch directories below
Quoted 8 lines

header-y += asm-generic/
header-y += linux/
header-y += sound/
header-y += mtd/
header-y += rdma/
header-y += video/
header-y += drm/

Quoted 2 lines

But that's fine then since bsg.h is in <linux/bsg.h> not <scsi/bsg.h> what is the problem?

Oops, somehow I placed bsg.h in include/scsi. Ignore the above my comments.

Quoted 19 lines

OK But you just explained how to do it patch below ...

Quoted 11 lines

I guess that SCSI header files for userspace (/usr/include/scsi/scsi.h, sg.h, etc) come from glibc (but I'm not sure). They are different from those in kernel.

Quoted 6 lines

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Quoted 6 lines
Quoted 4 lines

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

Doug copies bsg.h to his smp_utils. I do the same thing for my own bsg programs. We need glibc (or someone) to install bsg.h properly.

Quoted 7 lines

That is not acceptable for me since I will need to provide an open-osd-devel package to distros and I might need bsg.h, which I cannot supply with my package, what if someone else will need it too then we have a conflict.

I'm sending a patch, please ACK?
Thanks
Boaz

As I wrote in the previous mail, exporting some of bsg stuff for userspace is necessary, I think. But I have no idea about the correct way to do it.

Seems the header files in /usr/include/linux/ are different from in kernel source code (pointless __KERNEL__ stuff are stripped):

fujita@viola:~$ diff git/linux-2.6/include/linux/xattr.h /usr/include/linux/xattr.h
16,19d15
< #ifdef  __KERNEL__
<
< #include <linux/types.h>
<
36,37d31
< struct inode;
< struct dentry;
49,53c43,45
< ssize_t xattr_getsecurity(struct inode *, const char *, void *, size_t);
< ssize_t vfs_getxattr(struct dentry *, const char *, void *, size_t);
< ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
< int vfs_setxattr(struct dentry *, const char *, const void *, size_t, int);
< int vfs_removexattr(struct dentry *, const char *);
---
Quoted 9 lines
Quoted 3 lines

ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t); int vfs_setxattr(struct dentry *, char *, void *, size_t, int); int vfs_removexattr(struct dentry *, char *);

60,61d51
< #endif /* __KERNEL__ */
<

Your patch does the right thing?

Yes I just checked, the Kernel build system strips out the #ifdef __KERNEL__ sections for the exported headers. (Do "make headers_check" you can see at usr/include/linux/)

Quoted 10 lines
Quoted 10 lines

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Quoted 5 lines
Quoted 5 lines

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

TOMO Please ACK here so Jens can push it through his tree. Also I think we want to:
CC: [email protected]

for 2.6.27.x and 2.6.28.x Because these where shipped with bsg and there is no reason why not have it, lets say in Fedora10 or ubuntu 8.10.

Quoted 8 lines

include/linux/Kbuild

Quoted 8 lines
---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +0 -0
index 12e9a29..2124c06 100644

Thanks
Boaz

#5 lore raw
Quoted 5 lines · On Thu, 15 Jan 2009 14:06:55 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 2 lines

Your patch does the right thing?

Yes I just checked, the Kernel build system strips out the #ifdef __KERNEL__ sections for the exported headers. (Do "make headers_check" you can see at usr/include/linux/)

Thanks, I see.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

TOMO Please ACK here so Jens can push it through his tree.

You can add my ACK.

Quoted 2 lines

Also I think we want to:
CC: [email protected]

It's fine by me.

Quoted 20 lines

for 2.6.27.x and 2.6.28.x Because these where shipped with bsg and there is no reason why not have it, lets say in Fedora10 or ubuntu 8.10.

Quoted 8 lines

include/linux/Kbuild

Quoted 8 lines
---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +0 -0
index 12e9a29..2124c06 100644

Thanks
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 29 lines · On Thu, 15 Jan 2009 21:29:56 +0900 FUJITA Tomonori…
Quoted 5 lines · On Thu, 15 Jan 2009 14:06:55 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 2 lines

Your patch does the right thing?

Yes I just checked, the Kernel build system strips out the #ifdef __KERNEL__ sections for the exported headers. (Do "make headers_check" you can see at usr/include/linux/)

Thanks, I see.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

TOMO Please ACK here so Jens can push it through his tree.

Quoted 8 lines

You can add my ACK.

Quoted 2 lines

Also I think we want to:
CC: [email protected]

It's fine by me.

The patch looks OK to me.

Please resend it with a complete changelog, not this great email mess.

The changelog should clearly explain why the change is needed after the merge window and it should provide justification for backporting it into the -stable kernels.

Please also indicate which -stable kernel versions you believe it should be ported into. "everything", I assume.

#7 lore raw
Quoted 43 lines · Andrew Morton
Quoted 29 lines · On Thu, 15 Jan 2009 21:29:56 +0900 FUJITA Tomonori…
Quoted 5 lines · On Thu, 15 Jan 2009 14:06:55 +0200 Boaz Harrosh <[email protected]> wrote:
Quoted 2 lines

Your patch does the right thing?

Yes I just checked, the Kernel build system strips out the #ifdef __KERNEL__ sections for the exported headers. (Do "make headers_check" you can see at usr/include/linux/)

Thanks, I see.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

---
From: Boaz Harrosh <[email protected]>
Date: Thu, 15 Jan 2009 10:43:17 +0200
Subject: [PATCH] include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Quoted 7 lines
Quoted 5 lines
Quoted 5 lines

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide a libxxx-devel package for distros.

TOMO Please ACK here so Jens can push it through his tree.

Quoted 8 lines

You can add my ACK.

Quoted 2 lines

Also I think we want to:
CC: [email protected]

It's fine by me.

The patch looks OK to me.

Quoted 8 lines

Please resend it with a complete changelog, not this great email mess.

The changelog should clearly explain why the change is needed after the merge window and it should provide justification for backporting it into the -stable kernels.

Please also indicate which -stable kernel versions you believe it should be ported into. "everything", I assume.

Thanks Andrew, I was actually waiting for such a submission :-)

Signature · 1 line
Jens Axboe
#8 lore raw

PATCH RESEND 1/1 include/linux: Add bsg.h to the Kernel exported headers

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide source and devel packages for distros.

This should also be submitted to stable 2.6.28 and 2.6.27 since bsg had a stable API since these Kernels and distro users will need the header for these kernels a swell

---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +1 -0
index 12e9a29..2124c06 100644
@@ -41,6 +41,7 @@ header-y += baycom.h
 header-y += bfs_fs.h
 header-y += blkpg.h
 header-y += bpqether.h
+header-y += bsg.h
 header-y += can.h
 header-y += cdk.h
 header-y += chio.h
Signature · 1 line
1.6.0.1
Acked-by on v1 1/1
#9 lore raw

Re: [PATCH resend] include/linux: Add bsg.h to the Kernel exported headers

Quoted 9 lines · On Sun, 18 Jan 2009 10:23:25 +0200 Boaz Harrosh <[email protected]> wrote:

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide source and devel packages for distros.

Quoted 6 lines

This should also be submitted to stable 2.6.28 and 2.6.27 since bsg had a stable API since these Kernels and distro users will need the header for these kernels a swell

Applied
#10 lore raw

Re: [PATCH resend] include/linux: Add bsg.h to the Kernel exported headers

In reply to Boaz Harrosh
Quoted 25 lines · Boaz Harrosh

bsg.h in current form is perfectly suitable for user-mode consumption. It is needed together with scsi/sg.h for applications that want to interface with the bsg driver.

Currently the few projects that use it would copy it over into the projects. But that is not acceptable for projects that need to provide source and devel packages for distros.

This should also be submitted to stable 2.6.28 and 2.6.27 since bsg had a stable API since these Kernels and distro users will need the header for these kernels a swell

---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/linux/Kbuild +0 -0
index 12e9a29..2124c06 100644

include/linux/Kbuild header-y += baycom.h · line 47

Quoted 7 lines
include/linux/Kbuild +1 -0
@@ -41,6 +41,7 @@ header-y += baycom.h
 header-y += bfs_fs.h
 header-y += blkpg.h
 header-y += bpqether.h
+header-y += bsg.h
 header-y += can.h
 header-y += cdk.h
 header-y += chio.h

Applied

Signature · 1 line
Jens Axboe
#11 lore raw
In reply to Boaz Harrosh
Quoted 12 lines · Boaz Harrosh

Hi TOMO.

I'm using bsg.ko to submit SG_IO version-4 commands to scsi devices from user-mode application. (version-4 for use of bidi and varlen).

I have not found a bsg.h header in my fedora-10 distribution. Is bsg.h exported in kernel-headers-package in latest Kernels? If not should we, and how to do it?

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Quoted 6 lines

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Pete from the OSC osd project has his set of headers and library
which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

I have been trying to incorporate bsg support into sg3_utils and need to cope with the /usr/include/linux/bsg.h header being present or not. It may be present elsewhere (e.g. /lib/modules/<kernel_version>/build/include/linux/bsg.h ). Either way bsg.h is still a pain in the user space. The reason is the kernel's (non standard) "__int" types.

An autotools rule like this to see if linux/bsg.h is present:
AC_CHECK_HEADERS(linux/bsg.h)
creates a lot of noise because it claims bsg.h is not well formed. The reason is those "__int" types. The solution is to add this non obvious rule:
AC_CHECK_HEADERS([linux/types.h linux/bsg.h], [], [],

     [[#ifdef HAVE_LINUX_TYPES_H
     # include <linux/types.h>
     #endif
     ]])

So my suggestion is to add '#include <linux/types.h>' to bsg.h (or clean up the types).

Doug Gilbert

#12 lore raw
Quoted 33 lines · Douglas Gilbert
Quoted 12 lines · Boaz Harrosh

Hi TOMO.

I'm using bsg.ko to submit SG_IO version-4 commands to scsi devices from user-mode application. (version-4 for use of bidi and varlen).

I have not found a bsg.h header in my fedora-10 distribution. Is bsg.h exported in kernel-headers-package in latest Kernels? If not should we, and how to do it?

Meanwhile I will manually copy it to /usr/include/linux/bsg.h and see if I need to fix any thing so it can be compiled from user-mode.

Quoted 7 lines

Also do you have a small libbsg or something to make it easier for use by application? should we maintain such a package?

Pete from the OSC osd project has his set of headers and library which I used now. Should I clean it up and send it? Or should I just keep it as part of the osd project for now? what are the sas and fc guys using?

I have been trying to incorporate bsg support into sg3_utils and need to cope with the /usr/include/linux/bsg.h header being present or not. It may be present elsewhere (e.g. /lib/modules/<kernel_version>/build/include/linux/bsg.h ). Either way bsg.h is still a pain in the user space. The reason is the kernel's (non standard) "__int" types.

An autotools rule like this to see if linux/bsg.h is present:
AC_CHECK_HEADERS(linux/bsg.h)
creates a lot of noise because it claims bsg.h is not well formed. The reason is those "__int" types. The solution is to add this non obvious rule:

Quoted 9 lines
    AC_CHECK_HEADERS([linux/types.h linux/bsg.h], [], [],
      [[#ifdef HAVE_LINUX_TYPES_H
      # include <linux/types.h>
      #endif
      ]])

So my suggestion is to add '#include <linux/types.h>' to bsg.h (or clean up the types).

I agree, bsg.h is missing the '#include <linux/types.h>'.
Do you want to send a patch? I thought 'make check_headers' should warn about that.

Quoted 2 lines

Doug Gilbert

Have you noticed that we added linux/bsg.h to exported headers for 2.6.29 and stable?

Thanks
Boaz