Skip to contentSkip to conversation

usr/include/linux/soundcard.h warnings for 'make headers_check'

DISCUSSION Jaswinder Singh Rajput 5 participants 20 messages Jan 20, 2009 – Feb 9, 2009

lore
Share & tools
lore
#0 lore raw

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
usr/include/linux/soundcard.h:1047: extern's make no sense in userspace usr/include/linux/soundcard.h:1048: extern's make no sense in userspace usr/include/linux/soundcard.h:1049: extern's make no sense in userspace usr/include/linux/soundcard.h:1050: extern's make no sense in userspace usr/include/linux/soundcard.h:1051: extern's make no sense in userspace usr/include/linux/soundcard.h:1053: extern's make no sense in userspace usr/include/linux/soundcard.h:1055: extern's make no sense in userspace usr/include/linux/soundcard.h:1056: extern's make no sense in userspace usr/include/linux/soundcard.h:1061: extern's make no sense in userspace usr/include/linux/soundcard.h:1062: extern's make no sense in userspace usr/include/linux/soundcard.h:1078: extern's make no sense in userspace usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Do we need to fix these warnings.

If yes, then how can we fix these warnings.

Thanks

--
JSR

#1 lore raw

At Tue, 20 Jan 2009 21:08:22 +0530,

Quoted 15 lines · Jaswinder Singh Rajput

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
usr/include/linux/soundcard.h:1047: extern's make no sense in userspace usr/include/linux/soundcard.h:1048: extern's make no sense in userspace usr/include/linux/soundcard.h:1049: extern's make no sense in userspace usr/include/linux/soundcard.h:1050: extern's make no sense in userspace usr/include/linux/soundcard.h:1051: extern's make no sense in userspace usr/include/linux/soundcard.h:1053: extern's make no sense in userspace usr/include/linux/soundcard.h:1055: extern's make no sense in userspace usr/include/linux/soundcard.h:1056: extern's make no sense in userspace usr/include/linux/soundcard.h:1061: extern's make no sense in userspace usr/include/linux/soundcard.h:1062: extern's make no sense in userspace usr/include/linux/soundcard.h:1078: extern's make no sense in userspace usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Quoted 1 line

Do we need to fix these warnings.

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Takashi

#2 lore raw

Hello Sam,

Quoted 17 lines · Takashi Iwai

At Tue, 20 Jan 2009 21:08:22 +0530,

Quoted 15 lines · Jaswinder Singh Rajput

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
usr/include/linux/soundcard.h:1047: extern's make no sense in userspace usr/include/linux/soundcard.h:1048: extern's make no sense in userspace usr/include/linux/soundcard.h:1049: extern's make no sense in userspace usr/include/linux/soundcard.h:1050: extern's make no sense in userspace usr/include/linux/soundcard.h:1051: extern's make no sense in userspace usr/include/linux/soundcard.h:1053: extern's make no sense in userspace usr/include/linux/soundcard.h:1055: extern's make no sense in userspace usr/include/linux/soundcard.h:1056: extern's make no sense in userspace usr/include/linux/soundcard.h:1061: extern's make no sense in userspace usr/include/linux/soundcard.h:1062: extern's make no sense in userspace usr/include/linux/soundcard.h:1078: extern's make no sense in userspace usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Quoted 6 lines
Quoted 1 line

Do we need to fix these warnings.

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Do you have some plan where extern is required like in this case.

--
JSR

#3 lore raw
In reply to Takashi Iwai
Quoted 17 lines · Takashi Iwai

At Tue, 20 Jan 2009 21:08:22 +0530,

Quoted 15 lines · Jaswinder Singh Rajput

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
usr/include/linux/soundcard.h:1047: extern's make no sense in userspace usr/include/linux/soundcard.h:1048: extern's make no sense in userspace usr/include/linux/soundcard.h:1049: extern's make no sense in userspace usr/include/linux/soundcard.h:1050: extern's make no sense in userspace usr/include/linux/soundcard.h:1051: extern's make no sense in userspace usr/include/linux/soundcard.h:1053: extern's make no sense in userspace usr/include/linux/soundcard.h:1055: extern's make no sense in userspace usr/include/linux/soundcard.h:1056: extern's make no sense in userspace usr/include/linux/soundcard.h:1061: extern's make no sense in userspace usr/include/linux/soundcard.h:1062: extern's make no sense in userspace usr/include/linux/soundcard.h:1078: extern's make no sense in userspace usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Quoted 5 lines
Quoted 1 line

Do we need to fix these warnings.

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

Sam

#4 lore raw
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

	Arnd <><
#5 lore raw
Quoted 35 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

Quoted 4 lines

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

Sam also requested to move this stuff to other place.

We are waiting for Takashi reply.

--
JSR

#6 lore raw

At Wed, 04 Feb 2009 09:34:12 +0530,

Quoted 37 lines · Jaswinder Singh Rajput
Quoted 35 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

Quoted 7 lines
Quoted 4 lines

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for it.

Also giving an error with an ifdef OSSLIB like Arnd suggested would be nice, too. But maybe we need one more ifdef such as

#ifdef OSSLIB
#ifndef _SYS_SOUNDCARD_H
#error ...
#endif
#endif

thanks,

Takashi

#7 lore raw
Quoted 44 lines · Takashi Iwai

At Wed, 04 Feb 2009 09:34:12 +0530,

Quoted 42 lines · Jaswinder Singh Rajput
Quoted 39 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

Quoted 7 lines
Quoted 2 lines

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for it.

We need to fix things in such a way that we can replace:
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef __KERNEL__
and only keep those things in this file which we need in kernel and move
userspace declarations which are not required for kernel to
sys/soundcard.h

Quoted 9 lines

Also giving an error with an ifdef OSSLIB like Arnd suggested would be nice, too. But maybe we need one more ifdef such as

#ifdef OSSLIB
#ifndef _SYS_SOUNDCARD_H
#error ...
#endif
#endif

hmm, so you want to confirm that we only come through sys/soundcard.h for OSSLIB

Thanks,
--
JSR

#8 lore raw

At Wed, 04 Feb 2009 14:04:54 +0530,

Quoted 54 lines · Jaswinder Singh Rajput
Quoted 44 lines · Takashi Iwai

At Wed, 04 Feb 2009 09:34:12 +0530,

Quoted 42 lines · Jaswinder Singh Rajput
Quoted 39 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

Quoted 7 lines
Quoted 2 lines

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for it.

Quoted 7 lines

We need to fix things in such a way that we can replace:
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef __KERNEL__
and only keep those things in this file which we need in kernel and move
userspace declarations which are not required for kernel to
sys/soundcard.h

Which means to remove only the OSS-lib part. Some other macros are used in sound/oss/*.c. And, there are cases that apps want to use SEQ* macros without oss-lib (which are actually most cases).

Quoted 10 lines
Quoted 9 lines

Also giving an error with an ifdef OSSLIB like Arnd suggested would be nice, too. But maybe we need one more ifdef such as

#ifdef OSSLIB
#ifndef _SYS_SOUNDCARD_H
#error ...
#endif
#endif

Quoted 2 lines

hmm, so you want to confirm that we only come through sys/soundcard.h for OSSLIB

Yes.

Takashi

#9 lore raw
Quoted 64 lines · Takashi Iwai

At Wed, 04 Feb 2009 14:04:54 +0530,

Quoted 54 lines · Jaswinder Singh Rajput
Quoted 44 lines · Takashi Iwai

At Wed, 04 Feb 2009 09:34:12 +0530,

Quoted 42 lines · Jaswinder Singh Rajput
Quoted 39 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

Quoted 7 lines
Quoted 2 lines

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for it.

Quoted 7 lines

We need to fix things in such a way that we can replace:
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef __KERNEL__
and only keep those things in this file which we need in kernel and move
userspace declarations which are not required for kernel to
sys/soundcard.h

Quoted 4 lines

Which means to remove only the OSS-lib part. Some other macros are used in sound/oss/*.c. And, there are cases that apps want to use SEQ* macros without oss-lib (which are actually most cases).

In kernel space we use USE_SEQ_MACROS in:
sound/oss/mpu401.c
sound/oss/midi_synth.c

so we can replace
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef USE_SEQ_MACROS
and keep SEQ* macros used by above files so we do not break kernel and
move rest of the block in sys/soundcard.h so userspace will be also
happy.

--
JSR

#10 lore raw

At Wed, 04 Feb 2009 16:07:57 +0530,

Quoted 71 lines · Jaswinder Singh Rajput
Quoted 64 lines · Takashi Iwai

At Wed, 04 Feb 2009 14:04:54 +0530,

Quoted 54 lines · Jaswinder Singh Rajput
Quoted 44 lines · Takashi Iwai

At Wed, 04 Feb 2009 09:34:12 +0530,

Quoted 42 lines · Jaswinder Singh Rajput
Quoted 39 lines · Arnd Bergmann
Quoted 5 lines · Sam Ravnborg
Quoted 4 lines

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Quoted 7 lines

But not in the kernel for sure.
I just checked and for example: OSS_init is not used anywhere in the kernel. The kernel headers are not a "dump all your stuff" ground anymore.

So I encourage you to find a better home for the user space library definitons. We can let the definiton stay for a while - but eventually they have to be dropped from the kernel.

The last free version of OSSlib that matches this header is from ~1997, and no current distro appears to be shipping it. All new OSSlib versions (the oldest I found was from ~2003) contain in their documentation:

"Older versions of some OSS include files are distributed
with various operating systems. There is no danger in using them but applications written for more recent OSS versions will not compile with older header files.

The latest versions of these include files (such as soundcard.h) are distributed in ../include/sys. Use the -I/usr/lib/oss/include switch when compiling programs. Alternatively copy these files to /usr/include/sys so that they replace the original ones."

I think it's safe enough to assume that everyone that builds against OSSlib by now also has the correct version of the header installed. Consequently, we should just drop the #ifndef __KERNEL__ section of soundcard.h (all the macros in there depend on the extern declarations), and maybe add an

#ifdef OSSLIB
#error need to use <sys/soundcard.h> from libOSSlib #endif

Quoted 7 lines
Quoted 2 lines

sys/soundcard.h is also pointing to linux/soundcard.h, we need to move all this stuff to sys/soundcard.h.

All which stuff?
If you are referring to OSS-lib stuff in soundcard.h, then I'm for it.

Quoted 7 lines

We need to fix things in such a way that we can replace:
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef __KERNEL__
and only keep those things in this file which we need in kernel and move
userspace declarations which are not required for kernel to
sys/soundcard.h

Quoted 4 lines

Which means to remove only the OSS-lib part. Some other macros are used in sound/oss/*.c. And, there are cases that apps want to use SEQ* macros without oss-lib (which are actually most cases).

Quoted 8 lines

In kernel space we use USE_SEQ_MACROS in:
sound/oss/mpu401.c
sound/oss/midi_synth.c

so we can replace
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef USE_SEQ_MACROS

Then this will break user-space apps. They don't define USE_SEQ_MACROS always.

Takashi

Quoted 3 lines

and keep SEQ* macros used by above files so we do not break kernel and move rest of the block in sys/soundcard.h so userspace will be also happy.

#11 lore raw
Quoted 7 lines · Takashi Iwai

At Wed, 04 Feb 2009 16:07:57 +0530,

Quoted 5 lines · Jaswinder Singh Rajput

In kernel space we use USE_SEQ_MACROS in:
sound/oss/mpu401.c
sound/oss/midi_synth.c

Quoted 8 lines
Quoted 4 lines

so we can replace
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef USE_SEQ_MACROS

Then this will break user-space apps. They don't define USE_SEQ_MACROS always.

If userspace apps are coming through sys/soundcard.h we can define USE_SEQ_MACROS in it
OR
define USE_SEQ_MACROS in linux/soundcard.h for userspace OR
need to redefine better #ifdef

Thanks,
--
JSR

#12 lore raw

At Wed, 04 Feb 2009 17:01:37 +0530,

Quoted 14 lines · Jaswinder Singh Rajput
Quoted 12 lines · Takashi Iwai

At Wed, 04 Feb 2009 16:07:57 +0530,

Quoted 9 lines · Jaswinder Singh Rajput

In kernel space we use USE_SEQ_MACROS in:
sound/oss/mpu401.c
sound/oss/midi_synth.c

so we can replace
#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) with
#ifdef USE_SEQ_MACROS

Quoted 5 lines
Quoted 3 lines

Then this will break user-space apps. They don't define USE_SEQ_MACROS always.

If userspace apps are coming through sys/soundcard.h

It's not always true -- that's the whole problem I'm concerned. Apparently old apps do include linux/soundcard.h.

I agree to remove the stuff causing warnings, i.e. moving oss-lib part to sys/soundcard.h. In this case, the only possible regression is the case where apps use OSS-lib and include linux/soundcard.h. For other cases (use sequencer stuff with linux/soundcard.h but without oss-lib), it will still work.

Takashi

#13 lore raw
Quoted 8 lines · Takashi Iwai

It's not always true -- that's the whole problem I'm concerned. Apparently old apps do include linux/soundcard.h.

I agree to remove the stuff causing warnings, i.e. moving oss-lib part to sys/soundcard.h. In this case, the only possible regression is the case where apps use OSS-lib and include linux/soundcard.h. For other cases (use sequencer stuff with linux/soundcard.h but without oss-lib), it will still work.

You cannot "move" things to <sys/soundcard.h>, because that file is provided by glibc as a simple redirect to <linux/soundcard.h>. The problem there is obviously the compatibility of combinations of kernel and glibc before and after the change.

The use cases I can see include:

1. A simple app that only needs the ioctl definitions in linux/soundcard.h and does not care about all this.

2. A slightly more sophisticated app that uses the !OSSLIB part of <sys/soundcard.h> or <linux/soundcard.h>.

3. A new OSSlib application for OSS-3.9 or OSS-4.x that uses the <sys/soundcard.h> file provided by OSSlib, instead of the one from glibc.

4. A legacy OSSlib application from the last century using either linux/soundcard.h or sys/soundcard.h to get at the macros.

5. An application that gets compiled against <linux/soundcard.h> but linked against OSSlib 3.9 or 4.x.

Removing the macros and extern declarations from linux/soundcard.h will break the final two cases. The only options I can see here are "do nothing" and "screw them".
Both should be fine, because the warning is easy to shut up with a small preprocessor macro #define _SEQ_EXTERN extern, and it's rather unlikely that anyone runs into this problem on a 2.6 kernel in the first place.

	Arnd <><

---
This patch breaks building against OSSlib with the kernel headers instead of its own headers. It should still work with any version of the library from the 2003 onwards which provide their own headers for the latest interface.

include/linux/soundcard.h +12 -50
@@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO		1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
@@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
 
 void seqbuf_dump(void);	/* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char *_seqbuf; \
-		extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char _seqbuf[]; \
-		extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+		_SEQ_EXTERN unsigned char _seqbuf[]; \
+		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
 
 #ifndef USE_SIMPLE_MACROS
 /* Sample seqbuf_dump() implementation:
@@ -1131,7 +1107,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
  */
 #define _SEQ_NEEDBUF(len)	/* empty */
 #endif
-#endif /* !OSSLIB */
 
 #define SEQ_VOLUME_MODE(dev, mode)	{_SEQ_NEEDBUF(8);\
 					_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
@@ -1215,14 +1190,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 		_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
 
 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-		{OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
-		 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
+#define SEQ_PGM_CHANGE(dev, chn, patch) \
 		_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
 
 #define SEQ_CONTROL(dev, chn, controller, value) \
 		_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
@@ -1300,19 +1269,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 /*
  * Patch loading.
  */
-#ifdef OSSLIB
-#   define SEQ_WRPATCH(patchx, len) \
-		OSS_write_patch(seqfd, (char*)(patchx), len)
-#   define SEQ_WRPATCH2(patchx, len) \
-		OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-#   define SEQ_WRPATCH(patchx, len) \
+#define SEQ_WRPATCH(patchx, len) \
 		{if (_seqbufptr) SEQ_DUMPBUF();\
 		 if (write(seqfd, (char*)(patchx), len)==-1) \
 		    perror("Write patch: /dev/sequencer");}
-#   define SEQ_WRPATCH2(patchx, len) \
+#define SEQ_WRPATCH2(patchx, len) \
 		(SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
 
 #endif
 #endif
Acked-by
#14 lore raw

At Wed, 4 Feb 2009 13:51:17 +0100,

Quoted 12 lines · Arnd Bergmann
Quoted 8 lines · Takashi Iwai

It's not always true -- that's the whole problem I'm concerned. Apparently old apps do include linux/soundcard.h.

I agree to remove the stuff causing warnings, i.e. moving oss-lib part to sys/soundcard.h. In this case, the only possible regression is the case where apps use OSS-lib and include linux/soundcard.h. For other cases (use sequencer stuff with linux/soundcard.h but without oss-lib), it will still work.

Quoted 4 lines

You cannot "move" things to <sys/soundcard.h>, because that file is provided by glibc as a simple redirect to <linux/soundcard.h>. The problem there is obviously the compatibility of combinations of kernel and glibc before and after the change.

Ah right.

Quoted 28 lines

The use cases I can see include:

1. A simple app that only needs the ioctl definitions in linux/soundcard.h and does not care about all this.

2. A slightly more sophisticated app that uses the !OSSLIB part of <sys/soundcard.h> or <linux/soundcard.h>.

3. A new OSSlib application for OSS-3.9 or OSS-4.x that uses the <sys/soundcard.h> file provided by OSSlib, instead of the one from glibc.

4. A legacy OSSlib application from the last century using either linux/soundcard.h or sys/soundcard.h to get at the macros.

5. An application that gets compiled against <linux/soundcard.h> but linked against OSSlib 3.9 or 4.x.

Removing the macros and extern declarations from linux/soundcard.h will break the final two cases. The only options I can see here are "do nothing" and "screw them".
Both should be fine, because the warning is easy to shut up with a small preprocessor macro #define _SEQ_EXTERN extern, and it's rather unlikely that anyone runs into this problem on a 2.6 kernel in the first place.

	Arnd <><
Quoted 7 lines

---
This patch breaks building against OSSlib with the kernel headers instead of its own headers. It should still work with any version of the library from the 2003 onwards which provide their own headers for the latest interface.

The patch looks reasonable to me.

Or, I'll include the patch later to sound git tree unless any objection comes up.

thanks,

Takashi

Quoted 107 lines
include/linux/soundcard.h +12 -50
@@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO		1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
@@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
 
 void seqbuf_dump(void);	/* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char *_seqbuf; \
-		extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char _seqbuf[]; \
-		extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+		_SEQ_EXTERN unsigned char _seqbuf[]; \
+		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr
 
 #ifndef USE_SIMPLE_MACROS
 /* Sample seqbuf_dump() implementation:
@@ -1131,7 +1107,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
  */
 #define _SEQ_NEEDBUF(len)	/* empty */
 #endif
-#endif /* !OSSLIB */
 
 #define SEQ_VOLUME_MODE(dev, mode)	{_SEQ_NEEDBUF(8);\
 					_seqbuf[_seqbufptr] = SEQ_EXTENDED;\
@@ -1215,14 +1190,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 		_CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
 
 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-		{OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
-		 _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
+#define SEQ_PGM_CHANGE(dev, chn, patch) \
 		_CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
 
 #define SEQ_CONTROL(dev, chn, controller, value) \
 		_CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
@@ -1300,19 +1269,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 /*
  * Patch loading.
  */
-#ifdef OSSLIB
-#   define SEQ_WRPATCH(patchx, len) \
-		OSS_write_patch(seqfd, (char*)(patchx), len)
-#   define SEQ_WRPATCH2(patchx, len) \
-		OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-#   define SEQ_WRPATCH(patchx, len) \
+#define SEQ_WRPATCH(patchx, len) \
 		{if (_seqbufptr) SEQ_DUMPBUF();\
 		 if (write(seqfd, (char*)(patchx), len)==-1) \
 		    perror("Write patch: /dev/sequencer");}
-#   define SEQ_WRPATCH2(patchx, len) \
+#define SEQ_WRPATCH2(patchx, len) \
 		(SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
 
 #endif
 #endif
#15 lore raw
In reply to Arnd Bergmann
Quoted 54 lines · Arnd Bergmann

---
This patch breaks building against OSSlib with the kernel headers instead of its own headers. It should still work with any version of the library from the 2003 onwards which provide their own headers for the latest interface.

include/linux/soundcard.h +1 -31
@@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO		1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
@@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
 
 void seqbuf_dump(void);	/* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char *_seqbuf; \
-		extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \

include/linux/soundcard.h typedef struct mixer_vol_table { · line 1067

Quoted 10 lines
include/linux/soundcard.h +8 -2
-		extern unsigned char _seqbuf[]; \
-		extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+		_SEQ_EXTERN unsigned char _seqbuf[]; \
+		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr

hmm, you rename snake as rope, but actually snake is still there ;-)

--
JSR

#16 lore raw

At Wed, 04 Feb 2009 19:14:22 +0530,

Quoted 61 lines · Jaswinder Singh Rajput
Quoted 58 lines · Arnd Bergmann

---
This patch breaks building against OSSlib with the kernel headers instead of its own headers. It should still work with any version of the library from the 2003 onwards which provide their own headers for the latest interface.

include/linux/soundcard.h +3 -33
@@ -1045,7 +1045,7 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO		1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
@@ -1056,39 +1056,15 @@ typedef struct mixer_vol_table {
 
 void seqbuf_dump(void);	/* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-			      int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char *_seqbuf; \
-		extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-		OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-		OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-		extern unsigned char _seqbuf[]; \
-		extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
Quoted 8 lines

include/linux/soundcard.h typedef struct mixer_vol_table { · line 1067

Quoted 6 lines
include/linux/soundcard.h +6 -0
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+		_SEQ_EXTERN unsigned char _seqbuf[]; \
+		_SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr

hmm, you rename snake as rope, but actually snake is still there ;-)

Yep just because the API requires a snake anyway :)

Takashi

#17 lore raw
In reply to Jaswinder Singh Rajput
Quoted 6 lines · Jaswinder Singh Rajput

Review

Quoted 4 lines
(quoted diff) +4 -0
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+             _SEQ_EXTERN unsigned char _seqbuf[]; \
+             _SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr

hmm, you rename snake as rope, but actually snake is still there ;-)

Yes, that's true.

The alternative would be to remove all those macros entirely, breaking also the applications from number 2 in my list.

I see this header as another example of the byteorder.h type where a kernel header provides functionality that is used by existing applications. While it should have been part of a library to start with, we cannot change it any more now without breaking stuff.

Maybe a comment should be added to clarify this.

	Arnd <><
include/linux/soundcard.h +11 -1
@@ -1050,7 +1050,17 @@ typedef struct mixer_vol_table {
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
  *
- *	These macros define the API which should be used when possible.
+ *	This is a legacy interface for applications written against
+ *	the OSSlib-3.8 style interface. It is no longer possible
+ *	to actually link against OSSlib with this header, but we
+ *	still provide these macros for programs using them.
+ *
+ *	If you want to use OSSlib, it is recommended that you get
+ *	the GPL version of OSS-4.x and build against that version
+ *	of the header.
+ *
+ *	We redefine the extern keyword so that make headers_check
+ *	does not complain about SEQ_USE_EXTBUF.
  */
 #define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF()
 
#18 lore raw

At Wed, 4 Feb 2009 15:02:07 +0100,

Quoted 14 lines · Arnd Bergmann
Quoted 6 lines · Jaswinder Singh Rajput

Review

Quoted 4 lines
(quoted diff) +4 -0
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+             _SEQ_EXTERN unsigned char _seqbuf[]; \
+             _SEQ_EXTERN int _seqbuflen;_SEQ_EXTERN int _seqbufptr

hmm, you rename snake as rope, but actually snake is still there ;-)

Yes, that's true.

The alternative would be to remove all those macros entirely, breaking also the applications from number 2 in my list.

Quoted 6 lines

I see this header as another example of the byteorder.h type where a kernel header provides functionality that is used by existing applications. While it should have been part of a library to start with, we cannot change it any more now without breaking stuff.

Maybe a comment should be added to clarify this.

Yes, that should help understanding, at least.

I applied your previous patch with this change now no sound git tree, and will include it in the next pull request.

Thanks!

Takashi

Quoted 25 lines
	Arnd <><
include/linux/soundcard.h +11 -1
@@ -1050,7 +1050,17 @@ typedef struct mixer_vol_table {
  *	Some convenience macros to simplify programming of the
  *	/dev/sequencer interface
  *
- *	These macros define the API which should be used when possible.
+ *	This is a legacy interface for applications written against
+ *	the OSSlib-3.8 style interface. It is no longer possible
+ *	to actually link against OSSlib with this header, but we
+ *	still provide these macros for programs using them.
+ *
+ *	If you want to use OSSlib, it is recommended that you get
+ *	the GPL version of OSS-4.x and build against that version
+ *	of the header.
+ *
+ *	We redefine the extern keyword so that make headers_check
+ *	does not complain about SEQ_USE_EXTBUF.
  */
 #define SEQ_DECLAREBUF()		SEQ_USE_EXTBUF()
 
#19 lore raw
In reply to Takashi Iwai
Quoted 17 lines · Takashi Iwai

At Tue, 20 Jan 2009 21:08:22 +0530,

Quoted 15 lines · Jaswinder Singh Rajput

usr/include/linux/soundcard.h is giving following warnings for 'make headers_check':
usr/include/linux/soundcard.h:1047: extern's make no sense in userspace usr/include/linux/soundcard.h:1048: extern's make no sense in userspace usr/include/linux/soundcard.h:1049: extern's make no sense in userspace usr/include/linux/soundcard.h:1050: extern's make no sense in userspace usr/include/linux/soundcard.h:1051: extern's make no sense in userspace usr/include/linux/soundcard.h:1053: extern's make no sense in userspace usr/include/linux/soundcard.h:1055: extern's make no sense in userspace usr/include/linux/soundcard.h:1056: extern's make no sense in userspace usr/include/linux/soundcard.h:1061: extern's make no sense in userspace usr/include/linux/soundcard.h:1062: extern's make no sense in userspace usr/include/linux/soundcard.h:1078: extern's make no sense in userspace usr/include/linux/soundcard.h:1079: extern's make no sense in userspace

Quoted 6 lines
Quoted 1 line

Do we need to fix these warnings.

No, these are declarations for OSS-lib.
It doesn't belong to kernel, but it's better to keep it for compatibility in some way.

Do you find some better place for:

void seqbuf_dump(void); /* This function must be provided by programs */

extern int OSS_init(int seqfd, int buflen);
extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen); extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen); extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen); extern void OSS_patch_caching(int dev, int chn, int patch,

                              int fd, unsigned char *buf, int buflen);
extern void OSS_drum_caching(int dev, int chn, int patch,
                              int fd, unsigned char *buf, int buflen);

extern void OSS_write_patch(int fd, unsigned char *buf, int len); extern int OSS_write_patch2(int fd, unsigned char *buf, int len); ..

#ifdef OSSLIB
# define SEQ_USE_EXTBUF() \
extern unsigned char *_seqbuf; \
extern int _seqbuflen;extern int _seqbufptr
# define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len

#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)

# define SEQ_LOAD_GMINSTR(dev, instr) \
OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
# define SEQ_LOAD_GMDRUM(dev, drum) \
OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
#else /* !OSSLIB */

# define SEQ_LOAD_GMINSTR(dev, instr)
# define SEQ_LOAD_GMDRUM(dev, drum)

# define SEQ_USE_EXTBUF() \
extern unsigned char _seqbuf[]; \
extern int _seqbuflen;extern int _seqbufptr

..

what are your plans.

--
JSR