* feeding back pkgsrc changs @ 2016-02-18 15:47 Thomas Klausner 2016-02-18 15:51 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-18 15:47 UTC (permalink / raw) To: alsa-devel Hi! I've just updated the pkgsrc packages for alsa-lib, alsa-utils and alsa-plugins to 1.1.0 and noticed that there are quite a number of local patches we have. I'd like to get them integrated. When I visited the alsa-projects web page, I noticed that the link to the bug tracker is dead. What is the recommended method to provide the patches? Thanks, Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: feeding back pkgsrc changs 2016-02-18 15:47 feeding back pkgsrc changs Thomas Klausner @ 2016-02-18 15:51 ` Takashi Iwai 2016-02-23 14:09 ` portability patch: EBADF [was Re: feeding back pkgsrc changs] Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-02-18 15:51 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 18 Feb 2016 16:47:44 +0100, Thomas Klausner wrote: > > Hi! > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and > alsa-plugins to 1.1.0 and noticed that there are quite a number of > local patches we have. I'd like to get them integrated. > > When I visited the alsa-projects web page, I noticed that the link to > the bug tracker is dead. > > What is the recommended method to provide the patches? Just submit your patches to alsa-devel ML. That's the best way to review and get merged. thanks, Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* portability patch: EBADF [was Re: feeding back pkgsrc changs] 2016-02-18 15:51 ` Takashi Iwai @ 2016-02-23 14:09 ` Thomas Klausner 2016-02-23 15:53 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-23 14:09 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 908 bytes --] Hi Takashi! Thanks for the answer. On Thu, Feb 18, 2016 at 04:51:15PM +0100, Takashi Iwai wrote: > On Thu, 18 Feb 2016 16:47:44 +0100, > Thomas Klausner wrote: > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and > > alsa-plugins to 1.1.0 and noticed that there are quite a number of > > local patches we have. I'd like to get them integrated. > > > > When I visited the alsa-projects web page, I noticed that the link to > > the bug tracker is dead. > > > > What is the recommended method to provide the patches? > > Just submit your patches to alsa-devel ML. That's the best way to > review and get merged. I'll start with a straightforward one. Some operating systems don't provide an errno 'EBADFD'; let's use EBADF there instead. This patch adds the define in all files that need it, but if you prefer to add it to a central place instead, please suggest one. Thanks, Thomas [-- Attachment #2: 0001-Define-EBADFD-in-terms-of-EBADF-if-it-doesn-t-exist.patch --] [-- Type: text/plain, Size: 5126 bytes --] >From e72e16bcb9bd2ddff2624fdb57a96fad6b3cf5bb Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Tue, 23 Feb 2016 15:05:47 +0100 Subject: [PATCH] Define EBADFD in terms of EBADF if it doesn't exist. For portability on FreeBSD, NetBSD and probably others. --- aserver/aserver.c | 4 ++++ src/control/control_shm.c | 4 ++++ src/pcm/pcm.c | 4 ++++ src/pcm/pcm_dmix.c | 4 ++++ src/pcm/pcm_dshare.c | 4 ++++ src/pcm/pcm_dsnoop.c | 4 ++++ src/pcm/pcm_hw.c | 4 ++++ src/pcm/pcm_ioplug.c | 4 ++++ src/pcm/pcm_null.c | 4 ++++ src/pcm/pcm_rate.c | 4 ++++ src/pcm/pcm_share.c | 4 ++++ src/pcm/pcm_shm.c | 4 ++++ src/pcm/pcm_simple.c | 4 ++++ 13 files changed, 52 insertions(+) diff --git a/aserver/aserver.c b/aserver/aserver.c index ac20706..88995cf 100644 --- a/aserver/aserver.c +++ b/aserver/aserver.c @@ -35,6 +35,10 @@ #include "aserver.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + char *command; #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) diff --git a/src/control/control_shm.c b/src/control/control_shm.c index bd07d4a..618ef39 100644 --- a/src/control/control_shm.c +++ b/src/control/control_shm.c @@ -35,6 +35,10 @@ #include <netdb.h> #include "aserver.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_control_shm = ""; diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 203e7a5..6d40171 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -639,6 +639,10 @@ playback devices. #include <limits.h> #include "pcm_local.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + /** * \brief get identifier of PCM handle * \param pcm PCM handle diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c index b26a5c7..ba65cad 100644 --- a/src/pcm/pcm_dmix.c +++ b/src/pcm/pcm_dmix.c @@ -45,6 +45,10 @@ #include <sys/mman.h> #include "pcm_direct.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_dmix = ""; diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c index 58e47bb..2556a30 100644 --- a/src/pcm/pcm_dshare.c +++ b/src/pcm/pcm_dshare.c @@ -45,6 +45,10 @@ #include <sys/mman.h> #include "pcm_direct.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_dshare = ""; diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c index 576c35b..26b6f5c 100644 --- a/src/pcm/pcm_dsnoop.c +++ b/src/pcm/pcm_dsnoop.c @@ -45,6 +45,10 @@ #include <sys/mman.h> #include "pcm_direct.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_dsnoop = ""; diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index 4f4b84b..de9f9d5 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -40,6 +40,10 @@ #include "../control/control_local.h" #include "../timer/timer_local.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + //#define DEBUG_RW /* use to debug readi/writei/readn/writen */ //#define DEBUG_MMAP /* debug mmap_commit */ diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c index 43550c0..bed1c97 100644 --- a/src/pcm/pcm_ioplug.c +++ b/src/pcm/pcm_ioplug.c @@ -31,6 +31,10 @@ #include "pcm_ext_parm.h" #include "pcm_generic.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_ioplug = ""; diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index 5e63caa..9fe3c82 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -31,6 +31,10 @@ #include "pcm_local.h" #include "pcm_plugin.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_null = ""; diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index c76db25..c08a2e8 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -36,6 +36,10 @@ #include "plugin_ops.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #if 0 #define DEBUG_REFINE #endif diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c index 5d8aaf2..9fe8dc1 100644 --- a/src/pcm/pcm_share.c +++ b/src/pcm/pcm_share.c @@ -38,6 +38,10 @@ #include <pthread.h> #include "pcm_local.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_share = ""; diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c index a815ac6..242b26e 100644 --- a/src/pcm/pcm_shm.c +++ b/src/pcm/pcm_shm.c @@ -45,6 +45,10 @@ #include <netdb.h> #include "aserver.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifndef PIC /* entry for static linking */ const char *_snd_module_pcm_shm = ""; diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c index ce11083..99ba1c3 100644 --- a/src/pcm/pcm_simple.c +++ b/src/pcm/pcm_simple.c @@ -25,6 +25,10 @@ #include "pcm_local.h" +#ifndef EBADFD +#define EBADFD EBADF +#endif + static int set_buffer_time(snd_spcm_latency_t latency, unsigned int *buffer_time) { -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: portability patch: EBADF [was Re: feeding back pkgsrc changs] 2016-02-23 14:09 ` portability patch: EBADF [was Re: feeding back pkgsrc changs] Thomas Klausner @ 2016-02-23 15:53 ` Takashi Iwai 2016-02-24 13:16 ` Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-02-23 15:53 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Tue, 23 Feb 2016 15:09:06 +0100, Thomas Klausner wrote: > > Hi Takashi! > > Thanks for the answer. > > On Thu, Feb 18, 2016 at 04:51:15PM +0100, Takashi Iwai wrote: > > On Thu, 18 Feb 2016 16:47:44 +0100, > > Thomas Klausner wrote: > > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and > > > alsa-plugins to 1.1.0 and noticed that there are quite a number of > > > local patches we have. I'd like to get them integrated. > > > > > > When I visited the alsa-projects web page, I noticed that the link to > > > the bug tracker is dead. > > > > > > What is the recommended method to provide the patches? > > > > Just submit your patches to alsa-devel ML. That's the best way to > > review and get merged. > > I'll start with a straightforward one. Some operating systems don't > provide an errno 'EBADFD'; let's use EBADF there instead. > > This patch adds the define in all files that need it, but if you > prefer to add it to a central place instead, please suggest one. How about put this in include/local.h instead? Then we need to put it only in one place, as this is supposed to be included by all codes. Takashi > > Thanks, > Thomas > >From e72e16bcb9bd2ddff2624fdb57a96fad6b3cf5bb Mon Sep 17 00:00:00 2001 > From: Thomas Klausner <wiz@NetBSD.org> > Date: Tue, 23 Feb 2016 15:05:47 +0100 > Subject: [PATCH] Define EBADFD in terms of EBADF if it doesn't exist. > > For portability on FreeBSD, NetBSD and probably others. > --- > aserver/aserver.c | 4 ++++ > src/control/control_shm.c | 4 ++++ > src/pcm/pcm.c | 4 ++++ > src/pcm/pcm_dmix.c | 4 ++++ > src/pcm/pcm_dshare.c | 4 ++++ > src/pcm/pcm_dsnoop.c | 4 ++++ > src/pcm/pcm_hw.c | 4 ++++ > src/pcm/pcm_ioplug.c | 4 ++++ > src/pcm/pcm_null.c | 4 ++++ > src/pcm/pcm_rate.c | 4 ++++ > src/pcm/pcm_share.c | 4 ++++ > src/pcm/pcm_shm.c | 4 ++++ > src/pcm/pcm_simple.c | 4 ++++ > 13 files changed, 52 insertions(+) > > diff --git a/aserver/aserver.c b/aserver/aserver.c > index ac20706..88995cf 100644 > --- a/aserver/aserver.c > +++ b/aserver/aserver.c > @@ -35,6 +35,10 @@ > > #include "aserver.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > char *command; > > #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) > diff --git a/src/control/control_shm.c b/src/control/control_shm.c > index bd07d4a..618ef39 100644 > --- a/src/control/control_shm.c > +++ b/src/control/control_shm.c > @@ -35,6 +35,10 @@ > #include <netdb.h> > #include "aserver.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_control_shm = ""; > diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c > index 203e7a5..6d40171 100644 > --- a/src/pcm/pcm.c > +++ b/src/pcm/pcm.c > @@ -639,6 +639,10 @@ playback devices. > #include <limits.h> > #include "pcm_local.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > /** > * \brief get identifier of PCM handle > * \param pcm PCM handle > diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c > index b26a5c7..ba65cad 100644 > --- a/src/pcm/pcm_dmix.c > +++ b/src/pcm/pcm_dmix.c > @@ -45,6 +45,10 @@ > #include <sys/mman.h> > #include "pcm_direct.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_dmix = ""; > diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c > index 58e47bb..2556a30 100644 > --- a/src/pcm/pcm_dshare.c > +++ b/src/pcm/pcm_dshare.c > @@ -45,6 +45,10 @@ > #include <sys/mman.h> > #include "pcm_direct.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_dshare = ""; > diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c > index 576c35b..26b6f5c 100644 > --- a/src/pcm/pcm_dsnoop.c > +++ b/src/pcm/pcm_dsnoop.c > @@ -45,6 +45,10 @@ > #include <sys/mman.h> > #include "pcm_direct.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_dsnoop = ""; > diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c > index 4f4b84b..de9f9d5 100644 > --- a/src/pcm/pcm_hw.c > +++ b/src/pcm/pcm_hw.c > @@ -40,6 +40,10 @@ > #include "../control/control_local.h" > #include "../timer/timer_local.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > //#define DEBUG_RW /* use to debug readi/writei/readn/writen */ > //#define DEBUG_MMAP /* debug mmap_commit */ > > diff --git a/src/pcm/pcm_ioplug.c b/src/pcm/pcm_ioplug.c > index 43550c0..bed1c97 100644 > --- a/src/pcm/pcm_ioplug.c > +++ b/src/pcm/pcm_ioplug.c > @@ -31,6 +31,10 @@ > #include "pcm_ext_parm.h" > #include "pcm_generic.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_ioplug = ""; > diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c > index 5e63caa..9fe3c82 100644 > --- a/src/pcm/pcm_null.c > +++ b/src/pcm/pcm_null.c > @@ -31,6 +31,10 @@ > #include "pcm_local.h" > #include "pcm_plugin.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_null = ""; > diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c > index c76db25..c08a2e8 100644 > --- a/src/pcm/pcm_rate.c > +++ b/src/pcm/pcm_rate.c > @@ -36,6 +36,10 @@ > > #include "plugin_ops.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #if 0 > #define DEBUG_REFINE > #endif > diff --git a/src/pcm/pcm_share.c b/src/pcm/pcm_share.c > index 5d8aaf2..9fe8dc1 100644 > --- a/src/pcm/pcm_share.c > +++ b/src/pcm/pcm_share.c > @@ -38,6 +38,10 @@ > #include <pthread.h> > #include "pcm_local.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_share = ""; > diff --git a/src/pcm/pcm_shm.c b/src/pcm/pcm_shm.c > index a815ac6..242b26e 100644 > --- a/src/pcm/pcm_shm.c > +++ b/src/pcm/pcm_shm.c > @@ -45,6 +45,10 @@ > #include <netdb.h> > #include "aserver.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > #ifndef PIC > /* entry for static linking */ > const char *_snd_module_pcm_shm = ""; > diff --git a/src/pcm/pcm_simple.c b/src/pcm/pcm_simple.c > index ce11083..99ba1c3 100644 > --- a/src/pcm/pcm_simple.c > +++ b/src/pcm/pcm_simple.c > @@ -25,6 +25,10 @@ > > #include "pcm_local.h" > > +#ifndef EBADFD > +#define EBADFD EBADF > +#endif > + > static int set_buffer_time(snd_spcm_latency_t latency, > unsigned int *buffer_time) > { > -- > 2.7.1 > ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: portability patch: EBADF [was Re: feeding back pkgsrc changs] 2016-02-23 15:53 ` Takashi Iwai @ 2016-02-24 13:16 ` Thomas Klausner 2016-02-24 15:36 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-24 13:16 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 1289 bytes --] On Tue, Feb 23, 2016 at 04:53:51PM +0100, Takashi Iwai wrote: > On Tue, 23 Feb 2016 15:09:06 +0100, > Thomas Klausner wrote: > > Thanks for the answer. > > > > On Thu, Feb 18, 2016 at 04:51:15PM +0100, Takashi Iwai wrote: > > > On Thu, 18 Feb 2016 16:47:44 +0100, > > > Thomas Klausner wrote: > > > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and > > > > alsa-plugins to 1.1.0 and noticed that there are quite a number of > > > > local patches we have. I'd like to get them integrated. > > > > > > > > When I visited the alsa-projects web page, I noticed that the link to > > > > the bug tracker is dead. > > > > > > > > What is the recommended method to provide the patches? > > > > > > Just submit your patches to alsa-devel ML. That's the best way to > > > review and get merged. > > > > I'll start with a straightforward one. Some operating systems don't > > provide an errno 'EBADFD'; let's use EBADF there instead. > > > > This patch adds the define in all files that need it, but if you > > prefer to add it to a central place instead, please suggest one. > > How about put this in include/local.h instead? Then we need to put it > only in one place, as this is supposed to be included by all codes. Sounds good and works. New patch attached. Thomas [-- Attachment #2: 0001-Define-EBADFD-in-terms-of-EBADF-if-it-doesn-t-exist.patch --] [-- Type: text/plain, Size: 645 bytes --] >From ac054d580a774344adf2dcf198b50100a3f2967d Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Wed, 24 Feb 2016 14:15:10 +0100 Subject: [PATCH] Define EBADFD in terms of EBADF if it doesn't exist. For portability on FreeBSD, NetBSD and probably others. --- include/local.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/local.h b/include/local.h index b429f5d..28ed106 100644 --- a/include/local.h +++ b/include/local.h @@ -53,6 +53,10 @@ #include <linux/types.h> #include <linux/ioctl.h> +#ifndef EBADFD +#define EBADFD EBADF +#endif + #ifdef SUPPORT_RESMGR #include <resmgr.h> #endif -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: portability patch: EBADF [was Re: feeding back pkgsrc changs] 2016-02-24 13:16 ` Thomas Klausner @ 2016-02-24 15:36 ` Takashi Iwai 2016-02-25 23:31 ` portability: types Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-02-24 15:36 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Wed, 24 Feb 2016 14:16:55 +0100, Thomas Klausner wrote: > > On Tue, Feb 23, 2016 at 04:53:51PM +0100, Takashi Iwai wrote: > > On Tue, 23 Feb 2016 15:09:06 +0100, > > Thomas Klausner wrote: > > > Thanks for the answer. > > > > > > On Thu, Feb 18, 2016 at 04:51:15PM +0100, Takashi Iwai wrote: > > > > On Thu, 18 Feb 2016 16:47:44 +0100, > > > > Thomas Klausner wrote: > > > > > I've just updated the pkgsrc packages for alsa-lib, alsa-utils and > > > > > alsa-plugins to 1.1.0 and noticed that there are quite a number of > > > > > local patches we have. I'd like to get them integrated. > > > > > > > > > > When I visited the alsa-projects web page, I noticed that the link to > > > > > the bug tracker is dead. > > > > > > > > > > What is the recommended method to provide the patches? > > > > > > > > Just submit your patches to alsa-devel ML. That's the best way to > > > > review and get merged. > > > > > > I'll start with a straightforward one. Some operating systems don't > > > provide an errno 'EBADFD'; let's use EBADF there instead. > > > > > > This patch adds the define in all files that need it, but if you > > > prefer to add it to a central place instead, please suggest one. > > > > How about put this in include/local.h instead? Then we need to put it > > only in one place, as this is supposed to be included by all codes. > > Sounds good and works. New patch attached. Applied now. Thanks. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* portability: types 2016-02-24 15:36 ` Takashi Iwai @ 2016-02-25 23:31 ` Thomas Klausner 2016-02-26 8:45 ` Clemens Ladisch 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-25 23:31 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel On Wed, Feb 24, 2016 at 04:36:36PM +0100, Takashi Iwai wrote: > Applied now. Thanks. Thank you. The next big issue is that multiple places include Linux specific header files, easily recognizable by the path linux/*.h. I think these are used to define unusual types like __u32, __u64, __kernel_off_t, __kernel_pid_t. There are also a number of cases of u_xxx_t (which don't exist on Solaris) vs. the uxxx_t defined in C99. Many of these types have POSIX equivalents, like uint32_t, uint64_t, off_t, pid_t. Would it be better to switch to those, or should we define compat #typedefs or #defines in local.h? Cheers, Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: portability: types 2016-02-25 23:31 ` portability: types Thomas Klausner @ 2016-02-26 8:45 ` Clemens Ladisch 2016-02-29 15:05 ` [PATCH 1/3] Use POSIX uint*_t instead of u_int*_t Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Clemens Ladisch @ 2016-02-26 8:45 UTC (permalink / raw) To: Thomas Klausner, Takashi Iwai; +Cc: alsa-devel Thomas Klausner wrote: > The next big issue is that multiple places include Linux specific > header files, easily recognizable by the path linux/*.h. Once upon a time, alsa-lib was used only on Linux (and also on old versions such as 2.2.x). > I think these are used to define unusual types like __u32, __u64, > __kernel_off_t, __kernel_pid_t. There are also a number of cases of > u_xxx_t (which don't exist on Solaris) vs. the uxxx_t defined in C99. > > Many of these types have POSIX equivalents, like uint32_t, uint64_t, > off_t, pid_t. > > Would it be better to switch to those, or should we define compat > #typedefs or #defines in local.h? Linux-specific types should be used only in code that actually is Linux specific (i.e., the xxx_hw plugins). Regards, Clemens ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 1/3] Use POSIX uint*_t instead of u_int*_t. 2016-02-26 8:45 ` Clemens Ladisch @ 2016-02-29 15:05 ` Thomas Klausner 2016-02-29 15:05 ` [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability Thomas Klausner 2016-02-29 15:05 ` [PATCH 3/3] Use uint*_t instead of __le* Thomas Klausner 0 siblings, 2 replies; 30+ messages in thread From: Thomas Klausner @ 2016-02-29 15:05 UTC (permalink / raw) To: alsa-devel; +Cc: Thomas Klausner From: Thomas Klausner <wiz@NetBSD.org> This helps in particular for Solaris portability. --- include/pcm.h | 8 +- src/pcm/interval.c | 4 +- src/pcm/mask_inline.h | 6 +- src/pcm/pcm.c | 26 +++---- src/pcm/pcm_iec958.c | 12 +-- src/pcm/pcm_linear.c | 2 +- src/pcm/pcm_misc.c | 42 +++++------ src/pcm/pcm_rate_linear.c | 4 +- src/pcm/pcm_route.c | 2 +- src/pcm/plugin_ops.h | 182 +++++++++++++++++++++++----------------------- 10 files changed, 144 insertions(+), 144 deletions(-) diff --git a/include/pcm.h b/include/pcm.h index 0be1a32..d4f1543 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -1108,10 +1108,10 @@ int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian); ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format); -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format); -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format); -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format); +uint8_t snd_pcm_format_silence(snd_pcm_format_t format); +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format); +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format); +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format); int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples); snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes); diff --git a/src/pcm/interval.c b/src/pcm/interval.c index 6e39808..74ec320 100644 --- a/src/pcm/interval.c +++ b/src/pcm/interval.c @@ -26,7 +26,7 @@ #include <limits.h> #include "pcm_local.h" -static inline void div64_32(u_int64_t *n, u_int32_t d, u_int32_t *rem) +static inline void div64_32(uint64_t *n, uint32_t d, uint32_t *rem) { *rem = *n % d; *n /= d; @@ -88,7 +88,7 @@ static inline unsigned int sub(unsigned int a, unsigned int b) static inline unsigned int muldiv32(unsigned int a, unsigned int b, unsigned int c, unsigned int *r) { - u_int64_t n = (u_int64_t) a * b; + uint64_t n = (uint64_t) a * b; if (c == 0) { assert(n > 0); *r = 0; diff --git a/src/pcm/mask_inline.h b/src/pcm/mask_inline.h index f656568..04c7ee6 100644 --- a/src/pcm/mask_inline.h +++ b/src/pcm/mask_inline.h @@ -29,7 +29,7 @@ #define MASK_OFS(i) ((i) >> 5) #define MASK_BIT(i) (1U << ((i) & 31)) -MASK_INLINE unsigned int ld2(u_int32_t v) +MASK_INLINE unsigned int ld2(uint32_t v) { unsigned r = 0; @@ -54,7 +54,7 @@ MASK_INLINE unsigned int ld2(u_int32_t v) return r; } -MASK_INLINE unsigned int hweight32(u_int32_t v) +MASK_INLINE unsigned int hweight32(uint32_t v) { v = (v & 0x55555555) + ((v >> 1) & 0x55555555); v = (v & 0x33333333) + ((v >> 2) & 0x33333333); @@ -75,7 +75,7 @@ MASK_INLINE void snd_mask_none(snd_mask_t *mask) MASK_INLINE void snd_mask_any(snd_mask_t *mask) { - memset(mask, 0xff, MASK_SIZE * sizeof(u_int32_t)); + memset(mask, 0xff, MASK_SIZE * sizeof(uint32_t)); } MASK_INLINE int snd_mask_empty(const snd_mask_t *mask) diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 203e7a5..3fe3b39 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -2584,7 +2584,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes char *dst; unsigned int dst_step; int width; - u_int64_t silence; + uint64_t silence; if (!dst_area->addr) return 0; dst = snd_pcm_channel_area_addr(dst_area, dst_offset); @@ -2592,7 +2592,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes silence = snd_pcm_format_silence_64(format); if (dst_area->step == (unsigned int) width) { unsigned int dwords = samples * width / 64; - u_int64_t *dstp = (u_int64_t *)dst; + uint64_t *dstp = (uint64_t *)dst; samples -= dwords * 64 / width; while (dwords-- > 0) *dstp++ = silence; @@ -2602,8 +2602,8 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes dst_step = dst_area->step / 8; switch (width) { case 4: { - u_int8_t s0 = silence & 0xf0; - u_int8_t s1 = silence & 0x0f; + uint8_t s0 = silence & 0xf0; + uint8_t s1 = silence & 0x0f; int dstbit = dst_area->first % 8; int dstbit_step = dst_area->step % 8; while (samples-- > 0) { @@ -2624,7 +2624,7 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes break; } case 8: { - u_int8_t sil = silence; + uint8_t sil = silence; while (samples-- > 0) { *dst = sil; dst += dst_step; @@ -2632,9 +2632,9 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes break; } case 16: { - u_int16_t sil = silence; + uint16_t sil = silence; while (samples-- > 0) { - *(u_int16_t*)dst = sil; + *(uint16_t*)dst = sil; dst += dst_step; } break; @@ -2651,16 +2651,16 @@ int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes #endif break; case 32: { - u_int32_t sil = silence; + uint32_t sil = silence; while (samples-- > 0) { - *(u_int32_t*)dst = sil; + *(uint32_t*)dst = sil; dst += dst_step; } break; } case 64: { while (samples-- > 0) { - *(u_int64_t*)dst = silence; + *(uint64_t*)dst = silence; dst += dst_step; } break; @@ -2804,7 +2804,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t } case 16: { while (samples-- > 0) { - *(u_int16_t*)dst = *(const u_int16_t*)src; + *(uint16_t*)dst = *(const uint16_t*)src; src += src_step; dst += dst_step; } @@ -2821,7 +2821,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t break; case 32: { while (samples-- > 0) { - *(u_int32_t*)dst = *(const u_int32_t*)src; + *(uint32_t*)dst = *(const uint32_t*)src; src += src_step; dst += dst_step; } @@ -2829,7 +2829,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t } case 64: { while (samples-- > 0) { - *(u_int64_t*)dst = *(const u_int64_t*)src; + *(uint64_t*)dst = *(const uint64_t*)src; src += src_step; dst += dst_step; } diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 38c4ce7..a7fe0d7 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -102,7 +102,7 @@ static unsigned int iec958_parity(unsigned int data) * 31 = parity */ -static inline u_int32_t iec958_subframe(snd_pcm_iec958_t *iec, u_int32_t data, int channel) +static inline uint32_t iec958_subframe(snd_pcm_iec958_t *iec, uint32_t data, int channel) { unsigned int byte = iec->counter >> 3; unsigned int mask = 1 << (iec->counter - (byte << 3)); @@ -132,7 +132,7 @@ static inline u_int32_t iec958_subframe(snd_pcm_iec958_t *iec, u_int32_t data, i return data; } -static inline int32_t iec958_to_s32(snd_pcm_iec958_t *iec, u_int32_t data) +static inline int32_t iec958_to_s32(snd_pcm_iec958_t *iec, uint32_t data) { if (iec->byteswap) data = bswap_32(data); @@ -155,7 +155,7 @@ static void snd_pcm_iec958_decode(snd_pcm_iec958_t *iec, void *put = put32_labels[iec->getput_idx]; unsigned int channel; for (channel = 0; channel < channels; ++channel) { - const u_int32_t *src; + const uint32_t *src; char *dst; int src_step, dst_step; snd_pcm_uframes_t frames1; @@ -163,7 +163,7 @@ static void snd_pcm_iec958_decode(snd_pcm_iec958_t *iec, const snd_pcm_channel_area_t *dst_area = &dst_areas[channel]; src = snd_pcm_channel_area_addr(src_area, src_offset); dst = snd_pcm_channel_area_addr(dst_area, dst_offset); - src_step = snd_pcm_channel_area_step(src_area) / sizeof(u_int32_t); + src_step = snd_pcm_channel_area_step(src_area) / sizeof(uint32_t); dst_step = snd_pcm_channel_area_step(dst_area); frames1 = frames; while (frames1-- > 0) { @@ -195,7 +195,7 @@ static void snd_pcm_iec958_encode(snd_pcm_iec958_t *iec, int counter = iec->counter; for (channel = 0; channel < channels; ++channel) { const char *src; - u_int32_t *dst; + uint32_t *dst; int src_step, dst_step; snd_pcm_uframes_t frames1; const snd_pcm_channel_area_t *src_area = &src_areas[channel]; @@ -203,7 +203,7 @@ static void snd_pcm_iec958_encode(snd_pcm_iec958_t *iec, src = snd_pcm_channel_area_addr(src_area, src_offset); dst = snd_pcm_channel_area_addr(dst_area, dst_offset); src_step = snd_pcm_channel_area_step(src_area); - dst_step = snd_pcm_channel_area_step(dst_area) / sizeof(u_int32_t); + dst_step = snd_pcm_channel_area_step(dst_area) / sizeof(uint32_t); frames1 = frames; iec->counter = counter; while (frames1-- > 0) { diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 9a92abd..8b21049 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -183,7 +183,7 @@ void snd_pcm_linear_getput(const snd_pcm_channel_area_t *dst_areas, snd_pcm_ufra void *get = get32_labels[get_idx]; void *put = put32_labels[put_idx]; unsigned int channel; - u_int32_t sample = 0; + uint32_t sample = 0; for (channel = 0; channel < channels; ++channel) { const char *src; char *dst; diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c index 5870f82..83e7c79 100644 --- a/src/pcm/pcm_misc.c +++ b/src/pcm/pcm_misc.c @@ -387,7 +387,7 @@ ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples) * \param format Sample format * \return silence 64 bit word */ -u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) +uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format) { switch (format) { case SNDRV_PCM_FORMAT_S8: @@ -467,7 +467,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) { union { float f[2]; - u_int64_t i; + uint64_t i; } u; u.f[0] = u.f[1] = 0.0; #ifdef SNDRV_LITTLE_ENDIAN @@ -480,7 +480,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) { union { double f; - u_int64_t i; + uint64_t i; } u; u.f = 0.0; #ifdef SNDRV_LITTLE_ENDIAN @@ -493,7 +493,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) { union { float f[2]; - u_int64_t i; + uint64_t i; } u; u.f[0] = u.f[1] = 0.0; #ifdef SNDRV_LITTLE_ENDIAN @@ -506,7 +506,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) { union { double f; - u_int64_t i; + uint64_t i; } u; u.f = 0.0; #ifdef SNDRV_LITTLE_ENDIAN @@ -539,10 +539,10 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format) * \param format Sample format * \return silence 32 bit word */ -u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format) +uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format) { assert(snd_pcm_format_physical_width(format) <= 32); - return (u_int32_t)snd_pcm_format_silence_64(format); + return (uint32_t)snd_pcm_format_silence_64(format); } /** @@ -550,10 +550,10 @@ u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format) * \param format Sample format * \return silence 16 bit word */ -u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format) +uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format) { assert(snd_pcm_format_physical_width(format) <= 16); - return (u_int16_t)snd_pcm_format_silence_64(format); + return (uint16_t)snd_pcm_format_silence_64(format); } /** @@ -561,10 +561,10 @@ u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format) * \param format Sample format * \return silence 8 bit word */ -u_int8_t snd_pcm_format_silence(snd_pcm_format_t format) +uint8_t snd_pcm_format_silence(snd_pcm_format_t format) { assert(snd_pcm_format_physical_width(format) <= 8); - return (u_int8_t)snd_pcm_format_silence_64(format); + return (uint8_t)snd_pcm_format_silence_64(format); } /** @@ -580,7 +580,7 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int return 0; switch (snd_pcm_format_physical_width(format)) { case 4: { - u_int8_t silence = snd_pcm_format_silence_64(format); + uint8_t silence = snd_pcm_format_silence_64(format); unsigned int samples1; if (samples % 2 != 0) return -EINVAL; @@ -589,13 +589,13 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int break; } case 8: { - u_int8_t silence = snd_pcm_format_silence_64(format); + uint8_t silence = snd_pcm_format_silence_64(format); memset(data, silence, samples); break; } case 16: { - u_int16_t silence = snd_pcm_format_silence_64(format); - u_int16_t *pdata = (u_int16_t *)data; + uint16_t silence = snd_pcm_format_silence_64(format); + uint16_t *pdata = (uint16_t *)data; if (! silence) memset(data, 0, samples * 2); else { @@ -605,8 +605,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int break; } case 24: { - u_int32_t silence = snd_pcm_format_silence_64(format); - u_int8_t *pdata = (u_int8_t *)data; + uint32_t silence = snd_pcm_format_silence_64(format); + uint8_t *pdata = (uint8_t *)data; if (! silence) memset(data, 0, samples * 3); else { @@ -625,8 +625,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int break; } case 32: { - u_int32_t silence = snd_pcm_format_silence_64(format); - u_int32_t *pdata = (u_int32_t *)data; + uint32_t silence = snd_pcm_format_silence_64(format); + uint32_t *pdata = (uint32_t *)data; if (! silence) memset(data, 0, samples * 4); else { @@ -636,8 +636,8 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int break; } case 64: { - u_int64_t silence = snd_pcm_format_silence_64(format); - u_int64_t *pdata = (u_int64_t *)data; + uint64_t silence = snd_pcm_format_silence_64(format); + uint64_t *pdata = (uint64_t *)data; if (! silence) memset(data, 0, samples * 8); else { diff --git a/src/pcm/pcm_rate_linear.c b/src/pcm/pcm_rate_linear.c index 7481b38..4863938 100644 --- a/src/pcm/pcm_rate_linear.c +++ b/src/pcm/pcm_rate_linear.c @@ -346,7 +346,7 @@ static int linear_init(void *obj, snd_pcm_rate_info_t *info) rate->func = linear_shrink; /* pitch is get_increment */ } - rate->pitch = (((u_int64_t)info->out.rate * LINEAR_DIV) + + rate->pitch = (((uint64_t)info->out.rate * LINEAR_DIV) + (info->in.rate / 2)) / info->in.rate; rate->channels = info->channels; @@ -363,7 +363,7 @@ static int linear_adjust_pitch(void *obj, snd_pcm_rate_info_t *info) struct rate_linear *rate = obj; snd_pcm_uframes_t cframes; - rate->pitch = (((u_int64_t)info->out.period_size * LINEAR_DIV) + + rate->pitch = (((uint64_t)info->out.period_size * LINEAR_DIV) + (info->in.period_size/2) ) / info->in.period_size; cframes = input_frames(rate, info->out.period_size); diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 646517d..c8e752f 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -190,7 +190,7 @@ static void snd_pcm_route_convert1_one_getput(const snd_pcm_channel_area_t *dst_ const char *src; char *dst; int src_step, dst_step; - u_int32_t sample = 0; + uint32_t sample = 0; for (srcidx = 0; srcidx < ttable->nsrcs && srcidx < src_channels; ++srcidx) { unsigned int channel = ttable->srcs[srcidx].channel; if (channel >= src_channels) diff --git a/src/pcm/plugin_ops.h b/src/pcm/plugin_ops.h index eb8c2c4..69e7f2c 100644 --- a/src/pcm/plugin_ops.h +++ b/src/pcm/plugin_ops.h @@ -21,13 +21,13 @@ #ifndef SX_INLINES #define SX_INLINES -static inline u_int32_t sx24(u_int32_t x) +static inline uint32_t sx24(uint32_t x) { if(x&0x00800000) return x|0xFF000000; return x&0x00FFFFFF; } -static inline u_int32_t sx24s(u_int32_t x) +static inline uint32_t sx24s(uint32_t x) { if(x&0x00008000) return x|0x000000FF; @@ -35,10 +35,10 @@ static inline u_int32_t sx24s(u_int32_t x) } #endif -#define as_u8(ptr) (*(u_int8_t*)(ptr)) -#define as_u16(ptr) (*(u_int16_t*)(ptr)) -#define as_u32(ptr) (*(u_int32_t*)(ptr)) -#define as_u64(ptr) (*(u_int64_t*)(ptr)) +#define as_u8(ptr) (*(uint8_t*)(ptr)) +#define as_u16(ptr) (*(uint16_t*)(ptr)) +#define as_u32(ptr) (*(uint32_t*)(ptr)) +#define as_u64(ptr) (*(uint64_t*)(ptr)) #define as_s8(ptr) (*(int8_t*)(ptr)) #define as_s16(ptr) (*(int16_t*)(ptr)) #define as_s32(ptr) (*(int32_t*)(ptr)) @@ -46,10 +46,10 @@ static inline u_int32_t sx24s(u_int32_t x) #define as_float(ptr) (*(float_t*)(ptr)) #define as_double(ptr) (*(double_t*)(ptr)) -#define as_u8c(ptr) (*(const u_int8_t*)(ptr)) -#define as_u16c(ptr) (*(const u_int16_t*)(ptr)) -#define as_u32c(ptr) (*(const u_int32_t*)(ptr)) -#define as_u64c(ptr) (*(const u_int64_t*)(ptr)) +#define as_u8c(ptr) (*(const uint8_t*)(ptr)) +#define as_u16c(ptr) (*(const uint16_t*)(ptr)) +#define as_u32c(ptr) (*(const uint32_t*)(ptr)) +#define as_u64c(ptr) (*(const uint64_t*)(ptr)) #define as_s8c(ptr) (*(const int8_t*)(ptr)) #define as_s16c(ptr) (*(const int16_t*)(ptr)) #define as_s32c(ptr) (*(const int32_t*)(ptr)) @@ -57,18 +57,18 @@ static inline u_int32_t sx24s(u_int32_t x) #define as_floatc(ptr) (*(const float_t*)(ptr)) #define as_doublec(ptr) (*(const double_t*)(ptr)) -#define _get_triple_le(ptr) (*(u_int8_t*)(ptr) | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | (u_int32_t)*((u_int8_t*)(ptr) + 2) << 16) -#define _get_triple_be(ptr) ((u_int32_t)*(u_int8_t*)(ptr) << 16 | (u_int32_t)*((u_int8_t*)(ptr) + 1) << 8 | *((u_int8_t*)(ptr) + 2)) +#define _get_triple_le(ptr) (*(uint8_t*)(ptr) | (uint32_t)*((uint8_t*)(ptr) + 1) << 8 | (uint32_t)*((uint8_t*)(ptr) + 2) << 16) +#define _get_triple_be(ptr) ((uint32_t)*(uint8_t*)(ptr) << 16 | (uint32_t)*((uint8_t*)(ptr) + 1) << 8 | *((uint8_t*)(ptr) + 2)) #define _put_triple_le(ptr,val) do { \ - u_int8_t *_tmp = (u_int8_t *)(ptr); \ - u_int32_t _val = (val); \ + uint8_t *_tmp = (uint8_t *)(ptr); \ + uint32_t _val = (val); \ _tmp[0] = _val; \ _tmp[1] = _val >> 8; \ _tmp[2] = _val >> 16; \ } while(0) #define _put_triple_be(ptr,val) do { \ - u_int8_t *_tmp = (u_int8_t *)(ptr); \ - u_int32_t _val = (val); \ + uint8_t *_tmp = (uint8_t *)(ptr); \ + uint32_t _val = (val); \ _tmp[0] = _val >> 16; \ _tmp[1] = _val >> 8; \ _tmp[2] = _val; \ @@ -243,45 +243,45 @@ static void *const conv_labels[4 * 2 * 2 * 4 * 2] = { #ifdef CONV_END while(0) { conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END; -conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END; -conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END; -conv_xxx1_x100: as_u32(dst) = sx24((u_int32_t)as_u8c(src) << 16); goto CONV_END; -conv_xxx1_001x: as_u32(dst) = sx24s((u_int32_t)as_u8c(src) << 8); goto CONV_END; -conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END; -conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END; +conv_xxx1_xx10: as_u16(dst) = (uint16_t)as_u8c(src) << 8; goto CONV_END; +conv_xxx1_xx01: as_u16(dst) = (uint16_t)as_u8c(src); goto CONV_END; +conv_xxx1_x100: as_u32(dst) = sx24((uint32_t)as_u8c(src) << 16); goto CONV_END; +conv_xxx1_001x: as_u32(dst) = sx24s((uint32_t)as_u8c(src) << 8); goto CONV_END; +conv_xxx1_1000: as_u32(dst) = (uint32_t)as_u8c(src) << 24; goto CONV_END; +conv_xxx1_0001: as_u32(dst) = (uint32_t)as_u8c(src); goto CONV_END; conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END; -conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END; -conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END; -conv_xxx1_x900: as_u32(dst) = sx24((u_int32_t)(as_u8c(src) ^ 0x80) << 16); goto CONV_END; -conv_xxx1_009x: as_u32(dst) = sx24s((u_int32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END; -conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END; -conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END; +conv_xxx1_xx90: as_u16(dst) = (uint16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END; +conv_xxx1_xx09: as_u16(dst) = (uint16_t)(as_u8c(src) ^ 0x80); goto CONV_END; +conv_xxx1_x900: as_u32(dst) = sx24((uint32_t)(as_u8c(src) ^ 0x80) << 16); goto CONV_END; +conv_xxx1_009x: as_u32(dst) = sx24s((uint32_t)(as_u8c(src) ^ 0x80) << 8); goto CONV_END; +conv_xxx1_9000: as_u32(dst) = (uint32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END; +conv_xxx1_0009: as_u32(dst) = (uint32_t)(as_u8c(src) ^ 0x80); goto CONV_END; conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END; conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END; conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END; -conv_xx12_x120: as_u32(dst) = sx24((u_int32_t)as_u16c(src) << 8); goto CONV_END; -conv_xx12_021x: as_u32(dst) = sx24s((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END; -conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END; -conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END; +conv_xx12_x120: as_u32(dst) = sx24((uint32_t)as_u16c(src) << 8); goto CONV_END; +conv_xx12_021x: as_u32(dst) = sx24s((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END; +conv_xx12_1200: as_u32(dst) = (uint32_t)as_u16c(src) << 16; goto CONV_END; +conv_xx12_0021: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)); goto CONV_END; conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END; conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END; conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END; -conv_xx12_x920: as_u32(dst) = sx24((u_int32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END; -conv_xx12_029x: as_u32(dst) = sx24s((u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8); goto CONV_END; -conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END; -conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END; +conv_xx12_x920: as_u32(dst) = sx24((uint32_t)(as_u16c(src) ^ 0x8000) << 8); goto CONV_END; +conv_xx12_029x: as_u32(dst) = sx24s((uint32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8); goto CONV_END; +conv_xx12_9200: as_u32(dst) = (uint32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END; +conv_xx12_0029: as_u32(dst) = (uint32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END; conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END; -conv_xx12_x210: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END; -conv_xx12_012x: as_u32(dst) = sx24s((u_int32_t)as_u16c(src) << 8); goto CONV_END; -conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END; -conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END; +conv_xx12_x210: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src)) << 8); goto CONV_END; +conv_xx12_012x: as_u32(dst) = sx24s((uint32_t)as_u16c(src) << 8); goto CONV_END; +conv_xx12_2100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END; +conv_xx12_0012: as_u32(dst) = (uint32_t)as_u16c(src); goto CONV_END; conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END; conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END; conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END; -conv_xx12_xA10: as_u32(dst) = sx24((u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8); goto CONV_END; -conv_xx12_01Ax: as_u32(dst) = sx24s((u_int32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END; -conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END; -conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END; +conv_xx12_xA10: as_u32(dst) = sx24((uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 8); goto CONV_END; +conv_xx12_01Ax: as_u32(dst) = sx24s((uint32_t)(as_u16c(src) ^ 0x80) << 8); goto CONV_END; +conv_xx12_A100: as_u32(dst) = (uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END; +conv_xx12_001A: as_u32(dst) = (uint32_t)(as_u16c(src) ^ 0x80); goto CONV_END; conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END; conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END; conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END; @@ -376,8 +376,8 @@ static void *const get16_labels[4 * 2 * 2 + 4 * 3] = { #ifdef GET16_END while(0) { -get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END; -get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END; +get16_1_10: sample = (uint16_t)as_u8c(src) << 8; goto GET16_END; +get16_1_90: sample = (uint16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END; get16_12_12: sample = as_u16c(src); goto GET16_END; get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END; get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END; @@ -448,26 +448,26 @@ put16_12_12: as_u16(dst) = sample; goto PUT16_END; put16_12_92: as_u16(dst) = sample ^ 0x8000; goto PUT16_END; put16_12_21: as_u16(dst) = bswap_16(sample); goto PUT16_END; put16_12_29: as_u16(dst) = bswap_16(sample) ^ 0x80; goto PUT16_END; -put16_12_0120: as_u32(dst) = sx24((u_int32_t)sample << 8); goto PUT16_END; -put16_12_0920: as_u32(dst) = sx24((u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END; -put16_12_0210: as_u32(dst) = sx24s((u_int32_t)bswap_16(sample) << 8); goto PUT16_END; -put16_12_0290: as_u32(dst) = sx24s((u_int32_t)(bswap_16(sample) ^ 0x80) << 8); goto PUT16_END; -put16_12_1200: as_u32(dst) = (u_int32_t)sample << 16; goto PUT16_END; -put16_12_9200: as_u32(dst) = (u_int32_t)(sample ^ 0x8000) << 16; goto PUT16_END; -put16_12_0021: as_u32(dst) = (u_int32_t)bswap_16(sample); goto PUT16_END; -put16_12_0029: as_u32(dst) = (u_int32_t)bswap_16(sample) ^ 0x80; goto PUT16_END; -put16_12_120: _put_triple(dst, (u_int32_t)sample << 8); goto PUT16_END; -put16_12_920: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END; -put16_12_021: _put_triple_s(dst, (u_int32_t)sample << 8); goto PUT16_END; -put16_12_029: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 8); goto PUT16_END; -put16_12_120_20: _put_triple(dst, (u_int32_t)sample << 4); goto PUT16_END; -put16_12_920_20: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 4); goto PUT16_END; -put16_12_021_20: _put_triple_s(dst, (u_int32_t)sample << 4); goto PUT16_END; -put16_12_029_20: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 4); goto PUT16_END; -put16_12_120_18: _put_triple(dst, (u_int32_t)sample << 2); goto PUT16_END; -put16_12_920_18: _put_triple(dst, (u_int32_t)(sample ^ 0x8000) << 2); goto PUT16_END; -put16_12_021_18: _put_triple_s(dst, (u_int32_t)sample << 2); goto PUT16_END; -put16_12_029_18: _put_triple_s(dst, (u_int32_t)(sample ^ 0x8000) << 2); goto PUT16_END; +put16_12_0120: as_u32(dst) = sx24((uint32_t)sample << 8); goto PUT16_END; +put16_12_0920: as_u32(dst) = sx24((uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END; +put16_12_0210: as_u32(dst) = sx24s((uint32_t)bswap_16(sample) << 8); goto PUT16_END; +put16_12_0290: as_u32(dst) = sx24s((uint32_t)(bswap_16(sample) ^ 0x80) << 8); goto PUT16_END; +put16_12_1200: as_u32(dst) = (uint32_t)sample << 16; goto PUT16_END; +put16_12_9200: as_u32(dst) = (uint32_t)(sample ^ 0x8000) << 16; goto PUT16_END; +put16_12_0021: as_u32(dst) = (uint32_t)bswap_16(sample); goto PUT16_END; +put16_12_0029: as_u32(dst) = (uint32_t)bswap_16(sample) ^ 0x80; goto PUT16_END; +put16_12_120: _put_triple(dst, (uint32_t)sample << 8); goto PUT16_END; +put16_12_920: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END; +put16_12_021: _put_triple_s(dst, (uint32_t)sample << 8); goto PUT16_END; +put16_12_029: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 8); goto PUT16_END; +put16_12_120_20: _put_triple(dst, (uint32_t)sample << 4); goto PUT16_END; +put16_12_920_20: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 4); goto PUT16_END; +put16_12_021_20: _put_triple_s(dst, (uint32_t)sample << 4); goto PUT16_END; +put16_12_029_20: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 4); goto PUT16_END; +put16_12_120_18: _put_triple(dst, (uint32_t)sample << 2); goto PUT16_END; +put16_12_920_18: _put_triple(dst, (uint32_t)(sample ^ 0x8000) << 2); goto PUT16_END; +put16_12_021_18: _put_triple_s(dst, (uint32_t)sample << 2); goto PUT16_END; +put16_12_029_18: _put_triple_s(dst, (uint32_t)(sample ^ 0x8000) << 2); goto PUT16_END; } #endif @@ -517,12 +517,12 @@ static void *const get32_labels[4 * 2 * 2 + 4 * 3] = { #ifdef GET32_END while (0) { -get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END; -get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END; -get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END; -get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END; -get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END; -get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END; +get32_1_1000: sample = (uint32_t)as_u8c(src) << 24; goto GET32_END; +get32_1_9000: sample = (uint32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END; +get32_12_1200: sample = (uint32_t)as_u16c(src) << 16; goto GET32_END; +get32_12_9200: sample = (uint32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END; +get32_12_2100: sample = (uint32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END; +get32_12_A100: sample = (uint32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END; get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END; get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END; get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END; @@ -786,18 +786,18 @@ static inline void _norms(const void *src, void *dst, s += (1U << (dst_wid - 1)); switch (dst_wid) { case 8: - *(u_int8_t*)dst = s; + *(uint8_t*)dst = s; break; case 16: if (dst_end) s = bswap_16(s); - *(u_int16_t*)dst = s; + *(uint16_t*)dst = s; break; case 24: case 32: if (dst_end) s = bswap_32(s); - *(u_int32_t*)dst = s; + *(uint32_t*)dst = s; break; } return; @@ -806,27 +806,27 @@ static inline void _norms(const void *src, void *dst, switch (dst_wid) { case 8: if (dst_sign) - *(u_int8_t*)dst = 0x80; + *(uint8_t*)dst = 0x80; else - *(u_int8_t*)dst = 0; + *(uint8_t*)dst = 0; break; case 16: if (dst_sign) - *(u_int16_t*)dst = dst_end ? 0x0080 : 0x8000; + *(uint16_t*)dst = dst_end ? 0x0080 : 0x8000; else - *(u_int16_t*)dst = 0; + *(uint16_t*)dst = 0; break; case 24: if (dst_sign) - *(u_int32_t*)dst = dst_end ? 0x00008000 : 0x00800000; + *(uint32_t*)dst = dst_end ? 0x00008000 : 0x00800000; else - *(u_int32_t*)dst = 0; + *(uint32_t*)dst = 0; break; case 32: if (dst_sign) - *(u_int32_t*)dst = dst_end ? 0x00000080 : 0x80000000; + *(uint32_t*)dst = dst_end ? 0x00000080 : 0x80000000; else - *(u_int32_t*)dst = 0; + *(uint32_t*)dst = 0; break; default: assert(0); @@ -838,27 +838,27 @@ static inline void _norms(const void *src, void *dst, switch (dst_wid) { case 8: if (dst_sign) - *(u_int8_t*)dst = 0x7f; + *(uint8_t*)dst = 0x7f; else - *(u_int8_t*)dst = 0xff; + *(uint8_t*)dst = 0xff; break; case 16: if (dst_sign) - *(u_int16_t*)dst = dst_end ? 0xff7f : 0x7fff; + *(uint16_t*)dst = dst_end ? 0xff7f : 0x7fff; else - *(u_int16_t*)dst = 0; + *(uint16_t*)dst = 0; break; case 24: if (dst_sign) - *(u_int32_t*)dst = dst_end ? 0xffff7f00 : 0x007fffff; + *(uint32_t*)dst = dst_end ? 0xffff7f00 : 0x007fffff; else - *(u_int32_t*)dst = 0; + *(uint32_t*)dst = 0; break; case 32: if (dst_sign) - *(u_int32_t*)dst = dst_end ? 0xffffff7f : 0x7fffffff; + *(uint32_t*)dst = dst_end ? 0xffffff7f : 0x7fffffff; else - *(u_int32_t*)dst = 0; + *(uint32_t*)dst = 0; break; default: assert(0); -- 2.7.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability. 2016-02-29 15:05 ` [PATCH 1/3] Use POSIX uint*_t instead of u_int*_t Thomas Klausner @ 2016-02-29 15:05 ` Thomas Klausner 2016-02-29 16:10 ` Takashi Iwai 2016-02-29 15:05 ` [PATCH 3/3] Use uint*_t instead of __le* Thomas Klausner 1 sibling, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-29 15:05 UTC (permalink / raw) To: alsa-devel; +Cc: Thomas Klausner From: Thomas Klausner <wiz@NetBSD.org> --- include/sound/asound.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sound/asound.h b/include/sound/asound.h index a82108e..4f2202f 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -415,7 +415,7 @@ struct snd_pcm_sw_params { struct snd_pcm_channel_info { unsigned int channel; - __kernel_off_t offset; /* mmap offset */ + off_t offset; /* mmap offset */ unsigned int first; /* offset to first sample in bits */ unsigned int step; /* samples distance in bits */ }; @@ -884,7 +884,7 @@ struct snd_ctl_elem_info { snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ unsigned int count; /* count of values */ - __kernel_pid_t owner; /* owner's PID of this control */ + pid_t owner; /* owner's PID of this control */ union { struct { long min; /* R: minimum value */ -- 2.7.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability. 2016-02-29 15:05 ` [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability Thomas Klausner @ 2016-02-29 16:10 ` Takashi Iwai 2016-03-02 22:14 ` [PATCH] define more missing types for non-Linux Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-02-29 16:10 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel, Thomas Klausner On Mon, 29 Feb 2016 16:05:20 +0100, Thomas Klausner wrote: > > From: Thomas Klausner <wiz@NetBSD.org> > > --- > include/sound/asound.h | 4 ++-- Sorry, this is no-go. The files in include/sound/* are basically copies of Linux ABI. So, all these files must not be modified in alsa-lib side. And, using __kernel_off_t there is in purpose -- to distinguish from the user-space off_t. That said, the best workaround for these files are to provide the compatible typedefs. OTOH, the code changes in include/pcm.h and src/pcm/* are acceptable, in general, but I still hesitate to apply it, so far. If it's only about portability, we may wrap it with a few typedefs instead of touching so many lines. And it would bring any other real benefit? It's the question... thanks, Takashi > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/sound/asound.h b/include/sound/asound.h > index a82108e..4f2202f 100644 > --- a/include/sound/asound.h > +++ b/include/sound/asound.h > @@ -415,7 +415,7 @@ struct snd_pcm_sw_params { > > struct snd_pcm_channel_info { > unsigned int channel; > - __kernel_off_t offset; /* mmap offset */ > + off_t offset; /* mmap offset */ > unsigned int first; /* offset to first sample in bits */ > unsigned int step; /* samples distance in bits */ > }; > @@ -884,7 +884,7 @@ struct snd_ctl_elem_info { > snd_ctl_elem_type_t type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */ > unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */ > unsigned int count; /* count of values */ > - __kernel_pid_t owner; /* owner's PID of this control */ > + pid_t owner; /* owner's PID of this control */ > union { > struct { > long min; /* R: minimum value */ > -- > 2.7.1 > > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel > ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH] define more missing types for non-Linux 2016-02-29 16:10 ` Takashi Iwai @ 2016-03-02 22:14 ` Thomas Klausner 2016-03-03 9:32 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-02 22:14 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 1054 bytes --] Hi! On Mon, Feb 29, 2016 at 05:10:34PM +0100, Takashi Iwai wrote: > On Mon, 29 Feb 2016 16:05:20 +0100, > Thomas Klausner wrote: > > > > From: Thomas Klausner <wiz@NetBSD.org> > > > > --- > > include/sound/asound.h | 4 ++-- > > Sorry, this is no-go. The files in include/sound/* are basically > copies of Linux ABI. So, all these files must not be modified in > alsa-lib side. And, using __kernel_off_t there is in purpose -- to > distinguish from the user-space off_t. > > That said, the best workaround for these files are to provide the > compatible typedefs. So how about the attached patch instead? > OTOH, the code changes in include/pcm.h and src/pcm/* are acceptable, > in general, but I still hesitate to apply it, so far. If it's only > about portability, we may wrap it with a few typedefs instead of > touching so many lines. And it would bring any other real benefit? > It's the question... I still prefer uint* to u_int* because uint* is in POSIX and u_int* is not, but I added the necessary defines in the new patch. Thomas [-- Attachment #2: 0001-Define-some-types-if-missing.patch --] [-- Type: text/plain, Size: 1402 bytes --] >From 634255a4d87a12132bb65868f5658fd14cd2bfd7 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Wed, 2 Mar 2016 23:11:54 +0100 Subject: [PATCH] Define some types if missing. For portability with non-Linux. Include Linux header on Linux only. --- include/local.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/include/local.h b/include/local.h index 28ed106..9728598 100644 --- a/include/local.h +++ b/include/local.h @@ -50,13 +50,52 @@ #include <sys/poll.h> #include <sys/types.h> #include <errno.h> +#if defined(__linux__) #include <linux/types.h> #include <linux/ioctl.h> +#endif #ifndef EBADFD #define EBADFD EBADF #endif +#ifndef __u16 +#define __u16 uint16_t +#endif +#ifndef __u32 +#define __u32 uint32_t +#endif +#ifndef __u64 +#define __u64 uint64_t +#endif +#ifndef __le16 +#define __le16 uint16_t +#endif +#ifndef __le32 +#define __le32 uint32_t +#endif +#ifndef __le64 +#define __le64 uint64_t +#endif +#ifndef u_int8_t +#define u_int8_t uint8_t +#endif +#ifndef u_int16_t +#define u_int16_t uint16_t +#endif +#ifndef u_int32_t +#define u_int32_t uint32_t +#endif +#ifndef u_int32_t +#define u_int32_t uint64_t +#endif +#ifndef __kernel_pid_t +#define __kernel_pid_t pid_t +#endif +#ifndef __kernel_off_t +#define __kernel_off_t off_t +#endif + #ifdef SUPPORT_RESMGR #include <resmgr.h> #endif -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-02 22:14 ` [PATCH] define more missing types for non-Linux Thomas Klausner @ 2016-03-03 9:32 ` Takashi Iwai 2016-03-03 9:50 ` Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 9:32 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Wed, 02 Mar 2016 23:14:54 +0100, Thomas Klausner wrote: > > >From 634255a4d87a12132bb65868f5658fd14cd2bfd7 Mon Sep 17 00:00:00 2001 > From: Thomas Klausner <wiz@NetBSD.org> > Date: Wed, 2 Mar 2016 23:11:54 +0100 > Subject: [PATCH] Define some types if missing. > > For portability with non-Linux. > > Include Linux header on Linux only. > --- > include/local.h | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/include/local.h b/include/local.h > index 28ed106..9728598 100644 > --- a/include/local.h > +++ b/include/local.h > @@ -50,13 +50,52 @@ > #include <sys/poll.h> > #include <sys/types.h> > #include <errno.h> > +#if defined(__linux__) > #include <linux/types.h> > #include <linux/ioctl.h> > +#endif > > #ifndef EBADFD > #define EBADFD EBADF > #endif > > +#ifndef __u16 > +#define __u16 uint16_t > +#endif > +#ifndef __u32 > +#define __u32 uint32_t > +#endif > +#ifndef __u64 > +#define __u64 uint64_t > +#endif > +#ifndef __le16 > +#define __le16 uint16_t > +#endif > +#ifndef __le32 > +#define __le32 uint32_t > +#endif > +#ifndef __le64 > +#define __le64 uint64_t > +#endif > +#ifndef u_int8_t > +#define u_int8_t uint8_t > +#endif > +#ifndef u_int16_t > +#define u_int16_t uint16_t > +#endif > +#ifndef u_int32_t > +#define u_int32_t uint32_t > +#endif > +#ifndef u_int32_t > +#define u_int32_t uint64_t > +#endif > +#ifndef __kernel_pid_t > +#define __kernel_pid_t pid_t > +#endif > +#ifndef __kernel_off_t > +#define __kernel_off_t off_t > +#endif Can we put this in include/type_compat.h or something like that, and include it in #else block of #ifdef __linux__? As a bonus, the EBADFD definition can also go to there, too. thanks, Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-03 9:32 ` Takashi Iwai @ 2016-03-03 9:50 ` Thomas Klausner 2016-03-03 9:53 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 9:50 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 277 bytes --] On Thu, Mar 03, 2016 at 10:32:04AM +0100, Takashi Iwai wrote: > Can we put this in include/type_compat.h or something like that, and > include it in #else block of #ifdef __linux__? > > As a bonus, the EBADFD definition can also go to there, too. Sure, see attached. Thomas [-- Attachment #2: 0001-Define-some-types-if-missing.patch --] [-- Type: text/plain, Size: 2697 bytes --] >From c68bfda4e5198b50b32937de669155afb423d726 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Wed, 2 Mar 2016 23:11:54 +0100 Subject: [PATCH] Define some types if missing. For portability with non-Linux. Include Linux headers on Linux only. --- include/local.h | 6 ++--- include/type_compat.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 include/type_compat.h diff --git a/include/local.h b/include/local.h index 28ed106..317f2e3 100644 --- a/include/local.h +++ b/include/local.h @@ -50,11 +50,11 @@ #include <sys/poll.h> #include <sys/types.h> #include <errno.h> +#if defined(__linux__) #include <linux/types.h> #include <linux/ioctl.h> - -#ifndef EBADFD -#define EBADFD EBADF +#else +#include "type_compat.h" #endif #ifdef SUPPORT_RESMGR diff --git a/include/type_compat.h b/include/type_compat.h new file mode 100644 index 0000000..9cc209f --- /dev/null +++ b/include/type_compat.h @@ -0,0 +1,66 @@ +/* + * ALSA lib - compatibility header to be included by local.h + * Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org> + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __TYPE_COMPAT_H +#define __TYPE_COMPAT_H + +#ifndef EBADFD +#define EBADFD EBADF +#endif + +#ifndef __u16 +#define __u16 uint16_t +#endif +#ifndef __u32 +#define __u32 uint32_t +#endif +#ifndef __u64 +#define __u64 uint64_t +#endif +#ifndef __le16 +#define __le16 uint16_t +#endif +#ifndef __le32 +#define __le32 uint32_t +#endif +#ifndef __le64 +#define __le64 uint64_t +#endif +#ifndef u_int8_t +#define u_int8_t uint8_t +#endif +#ifndef u_int16_t +#define u_int16_t uint16_t +#endif +#ifndef u_int32_t +#define u_int32_t uint32_t +#endif +#ifndef u_int32_t +#define u_int32_t uint64_t +#endif +#ifndef __kernel_pid_t +#define __kernel_pid_t pid_t +#endif +#ifndef __kernel_off_t +#define __kernel_off_t off_t +#endif + +#endif -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-03 9:50 ` Thomas Klausner @ 2016-03-03 9:53 ` Takashi Iwai 2016-03-03 9:55 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 9:53 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 10:50:41 +0100, Thomas Klausner wrote: > > On Thu, Mar 03, 2016 at 10:32:04AM +0100, Takashi Iwai wrote: > > Can we put this in include/type_compat.h or something like that, and > > include it in #else block of #ifdef __linux__? > > > > As a bonus, the EBADFD definition can also go to there, too. > > Sure, see attached. > Thomas > >From c68bfda4e5198b50b32937de669155afb423d726 Mon Sep 17 00:00:00 2001 > From: Thomas Klausner <wiz@NetBSD.org> > Date: Wed, 2 Mar 2016 23:11:54 +0100 > Subject: [PATCH] Define some types if missing. > > For portability with non-Linux. > > Include Linux headers on Linux only. > --- > include/local.h | 6 ++--- > include/type_compat.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 69 insertions(+), 3 deletions(-) > create mode 100644 include/type_compat.h You need to add it in include/Makefile.am, too. Otherwise it'll slip from the tarball. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-03 9:53 ` Takashi Iwai @ 2016-03-03 9:55 ` Takashi Iwai 2016-03-03 9:58 ` Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 9:55 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 10:53:46 +0100, Takashi Iwai wrote: > > On Thu, 03 Mar 2016 10:50:41 +0100, > Thomas Klausner wrote: > > > > On Thu, Mar 03, 2016 at 10:32:04AM +0100, Takashi Iwai wrote: > > > Can we put this in include/type_compat.h or something like that, and > > > include it in #else block of #ifdef __linux__? > > > > > > As a bonus, the EBADFD definition can also go to there, too. > > > > Sure, see attached. > > Thomas > > >From c68bfda4e5198b50b32937de669155afb423d726 Mon Sep 17 00:00:00 2001 > > From: Thomas Klausner <wiz@NetBSD.org> > > Date: Wed, 2 Mar 2016 23:11:54 +0100 > > Subject: [PATCH] Define some types if missing. > > > > For portability with non-Linux. > > > > Include Linux headers on Linux only. > > --- > > include/local.h | 6 ++--- > > include/type_compat.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ > > 2 files changed, 69 insertions(+), 3 deletions(-) > > create mode 100644 include/type_compat.h > > You need to add it in include/Makefile.am, too. > Otherwise it'll slip from the tarball. Oh, also it'd be good if you give your sign-off, too. For user-space, I accept the patches without sign-off as long as they are trivial enough. But this kind of change is preferred with a proper sign off, of course. thanks, Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-03 9:55 ` Takashi Iwai @ 2016-03-03 9:58 ` Thomas Klausner 2016-03-03 10:01 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 9:58 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 478 bytes --] On Thu, Mar 03, 2016 at 10:55:01AM +0100, Takashi Iwai wrote: > On Thu, 03 Mar 2016 10:53:46 +0100, > Takashi Iwai wrote: > > You need to add it in include/Makefile.am, too. > > Otherwise it'll slip from the tarball. Good catch, added. > Oh, also it'd be good if you give your sign-off, too. > For user-space, I accept the patches without sign-off as long as they > are trivial enough. But this kind of change is preferred with a > proper sign off, of course. Sure! Thomas [-- Attachment #2: 0001-Define-some-types-if-missing.patch --] [-- Type: text/plain, Size: 3195 bytes --] >From 0d0a1408432a27cfa1908373bccbb66ac413fc5d Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Wed, 2 Mar 2016 23:11:54 +0100 Subject: [PATCH] Define some types if missing. Include Linux headers on Linux only. For portability with non-Linux. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> --- include/Makefile.am | 2 +- include/local.h | 6 ++--- include/type_compat.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 include/type_compat.h diff --git a/include/Makefile.am b/include/Makefile.am index ff931fd..8c83c11 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -59,7 +59,7 @@ alsainclude_HEADERS += alisp.h endif noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \ - asoundlib-head.h asoundlib-tail.h + asoundlib-head.h asoundlib-tail.h type_compat.h DISTCLEANFILES = stamp-vh version.h alsa asoundlib.h diff --git a/include/local.h b/include/local.h index 28ed106..317f2e3 100644 --- a/include/local.h +++ b/include/local.h @@ -50,11 +50,11 @@ #include <sys/poll.h> #include <sys/types.h> #include <errno.h> +#if defined(__linux__) #include <linux/types.h> #include <linux/ioctl.h> - -#ifndef EBADFD -#define EBADFD EBADF +#else +#include "type_compat.h" #endif #ifdef SUPPORT_RESMGR diff --git a/include/type_compat.h b/include/type_compat.h new file mode 100644 index 0000000..9cc209f --- /dev/null +++ b/include/type_compat.h @@ -0,0 +1,66 @@ +/* + * ALSA lib - compatibility header to be included by local.h + * Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org> + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __TYPE_COMPAT_H +#define __TYPE_COMPAT_H + +#ifndef EBADFD +#define EBADFD EBADF +#endif + +#ifndef __u16 +#define __u16 uint16_t +#endif +#ifndef __u32 +#define __u32 uint32_t +#endif +#ifndef __u64 +#define __u64 uint64_t +#endif +#ifndef __le16 +#define __le16 uint16_t +#endif +#ifndef __le32 +#define __le32 uint32_t +#endif +#ifndef __le64 +#define __le64 uint64_t +#endif +#ifndef u_int8_t +#define u_int8_t uint8_t +#endif +#ifndef u_int16_t +#define u_int16_t uint16_t +#endif +#ifndef u_int32_t +#define u_int32_t uint32_t +#endif +#ifndef u_int32_t +#define u_int32_t uint64_t +#endif +#ifndef __kernel_pid_t +#define __kernel_pid_t pid_t +#endif +#ifndef __kernel_off_t +#define __kernel_off_t off_t +#endif + +#endif -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: [PATCH] define more missing types for non-Linux 2016-03-03 9:58 ` Thomas Klausner @ 2016-03-03 10:01 ` Takashi Iwai 2016-03-03 10:10 ` byteswap.h Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 10:01 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 10:58:52 +0100, Thomas Klausner wrote: > > On Thu, Mar 03, 2016 at 10:55:01AM +0100, Takashi Iwai wrote: > > On Thu, 03 Mar 2016 10:53:46 +0100, > > Takashi Iwai wrote: > > > You need to add it in include/Makefile.am, too. > > > Otherwise it'll slip from the tarball. > > Good catch, added. > > > Oh, also it'd be good if you give your sign-off, too. > > For user-space, I accept the patches without sign-off as long as they > > are trivial enough. But this kind of change is preferred with a > > proper sign off, of course. > > Sure! Applied now. Thanks. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* byteswap.h 2016-03-03 10:01 ` Takashi Iwai @ 2016-03-03 10:10 ` Thomas Klausner 2016-03-03 10:21 ` byteswap.h Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 10:10 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel On Thu, Mar 03, 2016 at 11:01:23AM +0100, Takashi Iwai wrote: > Applied now. Thanks. Thank you! Next big issue: Many places include byteswap.h to get bswap_16, bswap_32, bswap_64. This header does not exist on *BSD or Solaris. However, all of these provide similar macros under different names, from different header files (bswap16 etc, or BSWAP_16). Do you want a compat header, e.g. include/bswap.h that takes care of this and is included by local.h, or do you prefer a different solution? Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: byteswap.h 2016-03-03 10:10 ` byteswap.h Thomas Klausner @ 2016-03-03 10:21 ` Takashi Iwai 2016-03-03 11:18 ` byteswap.h Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 10:21 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 11:10:05 +0100, Thomas Klausner wrote: > > On Thu, Mar 03, 2016 at 11:01:23AM +0100, Takashi Iwai wrote: > > Applied now. Thanks. > > Thank you! > > Next big issue: Many places include byteswap.h to get bswap_16, > bswap_32, bswap_64. > > This header does not exist on *BSD or Solaris. > > However, all of these provide similar macros under different names, > from different header files (bswap16 etc, or BSWAP_16). > > Do you want a compat header, e.g. include/bswap.h that takes care of > this and is included by local.h, or do you prefer a different > solution? bswap.h looks better ATM. Let's see. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: byteswap.h 2016-03-03 10:21 ` byteswap.h Takashi Iwai @ 2016-03-03 11:18 ` Thomas Klausner 2016-03-03 11:37 ` byteswap.h Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 11:18 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 805 bytes --] On Thu, Mar 03, 2016 at 11:21:05AM +0100, Takashi Iwai wrote: > On Thu, 03 Mar 2016 11:10:05 +0100, > Thomas Klausner wrote: > > > > On Thu, Mar 03, 2016 at 11:01:23AM +0100, Takashi Iwai wrote: > > > Applied now. Thanks. > > > > Thank you! > > > > Next big issue: Many places include byteswap.h to get bswap_16, > > bswap_32, bswap_64. > > > > This header does not exist on *BSD or Solaris. > > > > However, all of these provide similar macros under different names, > > from different header files (bswap16 etc, or BSWAP_16). > > > > Do you want a compat header, e.g. include/bswap.h that takes care of > > this and is included by local.h, or do you prefer a different > > solution? > > bswap.h looks better ATM. Let's see. Ok, here's my try for a version of bswap.h. Does it look ok? Thomas [-- Attachment #2: 0001-Introduce-bswap.h-for-portable-definitions-of-byte-s.patch --] [-- Type: text/plain, Size: 7699 bytes --] >From 03185793bc290ad2de4506a553f9855ff7241fa0 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Thu, 3 Mar 2016 12:16:57 +0100 Subject: [PATCH] Introduce bswap.h for portable definitions of byte swap macros. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> --- include/Makefile.am | 2 +- include/bswap.h | 39 +++++++++++++++++++++++++++++++++++++++ src/pcm/pcm_adpcm.c | 2 +- src/pcm/pcm_alaw.c | 2 +- src/pcm/pcm_copy.c | 2 +- src/pcm/pcm_dmix_generic.c | 2 +- src/pcm/pcm_file.c | 2 +- src/pcm/pcm_iec958.c | 2 +- src/pcm/pcm_lfloat.c | 2 +- src/pcm/pcm_linear.c | 2 +- src/pcm/pcm_meter.c | 2 +- src/pcm/pcm_misc.c | 2 +- src/pcm/pcm_mulaw.c | 2 +- src/pcm/pcm_null.c | 2 +- src/pcm/pcm_rate.c | 2 +- src/pcm/pcm_rate_linear.c | 2 +- src/pcm/pcm_route.c | 2 +- src/pcm/pcm_softvol.c | 2 +- 18 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 include/bswap.h diff --git a/include/Makefile.am b/include/Makefile.am index 8c83c11..31a3f74 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -59,7 +59,7 @@ alsainclude_HEADERS += alisp.h endif noinst_HEADERS = alsa sys.h search.h list.h aserver.h local.h alsa-symbols.h \ - asoundlib-head.h asoundlib-tail.h type_compat.h + asoundlib-head.h asoundlib-tail.h bswap.h type_compat.h DISTCLEANFILES = stamp-vh version.h alsa asoundlib.h diff --git a/include/bswap.h b/include/bswap.h new file mode 100644 index 0000000..68adce3 --- /dev/null +++ b/include/bswap.h @@ -0,0 +1,39 @@ +/* + * ALSA lib - compatibility header for providing byte swapping macros + * Copyright (c) 2016 by Thomas Klausner <wiz@NetBSD.org> + * + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __BSWAP_H +#define __BSWAP_H + +#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) +#include <sys/endian.h> +#define bswap_16 bswap16 +#define bswap_32 bswap32 +#define bswap_64 bswap64 +#elif defined (__sun) +#include <sys/byteorder.h> +#define bswap_16 BSWAP_16 +#define bswap_32 BSWAP_32 +#define bswap_64 BSWAP_64 +#else +#include <byteswap.h> +#endif + +#endif diff --git a/src/pcm/pcm_adpcm.c b/src/pcm/pcm_adpcm.c index 1a83c5a..1c88c83 100644 --- a/src/pcm/pcm_adpcm.c +++ b/src/pcm/pcm_adpcm.c @@ -56,7 +56,7 @@ IMA compatibility project proceedings, Vol 2, Issue 2, May 1992. come across a good description of XA yet. */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_alaw.c b/src/pcm/pcm_alaw.c index db759e3..fa58441 100644 --- a/src/pcm/pcm_alaw.c +++ b/src/pcm/pcm_alaw.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_copy.c b/src/pcm/pcm_copy.c index 66d3a47..0dbd5bd 100644 --- a/src/pcm/pcm_copy.c +++ b/src/pcm/pcm_copy.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_dmix_generic.c b/src/pcm/pcm_dmix_generic.c index 9e9d3c3..40c0874 100644 --- a/src/pcm/pcm_dmix_generic.c +++ b/src/pcm/pcm_dmix_generic.c @@ -125,7 +125,7 @@ static void mix_select_callbacks(snd_pcm_direct_t *dmix) (1ULL << SND_PCM_FORMAT_S24_LE) | (1ULL << SND_PCM_FORMAT_S24_3LE) | \ (1ULL << SND_PCM_FORMAT_U8)) -#include <byteswap.h> +#include "bswap.h" static void generic_mix_areas_16_native(unsigned int size, volatile signed short *dst, diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 9ab6964..92eb072 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include <ctype.h> #include <string.h> #include "pcm_local.h" diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c index 38c4ce7..86ac9cf 100644 --- a/src/pcm/pcm_iec958.c +++ b/src/pcm/pcm_iec958.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_lfloat.c b/src/pcm/pcm_lfloat.c index 2f3e578..22201f8 100644 --- a/src/pcm/pcm_lfloat.c +++ b/src/pcm/pcm_lfloat.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_linear.c b/src/pcm/pcm_linear.c index 9a92abd..50df779 100644 --- a/src/pcm/pcm_linear.c +++ b/src/pcm/pcm_linear.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_meter.c b/src/pcm/pcm_meter.c index 034f582..1b0ccb4 100644 --- a/src/pcm/pcm_meter.c +++ b/src/pcm/pcm_meter.c @@ -27,7 +27,7 @@ */ -#include <byteswap.h> +#include "bswap.h" #include <time.h> #include <pthread.h> #include <dlfcn.h> diff --git a/src/pcm/pcm_misc.c b/src/pcm/pcm_misc.c index 5870f82..7d2b05d 100644 --- a/src/pcm/pcm_misc.c +++ b/src/pcm/pcm_misc.c @@ -23,7 +23,7 @@ #include <stdlib.h> #include <unistd.h> #include <string.h> -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" diff --git a/src/pcm/pcm_mulaw.c b/src/pcm/pcm_mulaw.c index 011b2a5..15dbdc1 100644 --- a/src/pcm/pcm_mulaw.c +++ b/src/pcm/pcm_mulaw.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_null.c b/src/pcm/pcm_null.c index 5e63caa..685618e 100644 --- a/src/pcm/pcm_null.c +++ b/src/pcm/pcm_null.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include <limits.h> #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index c76db25..41bddac 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -28,7 +28,7 @@ * */ #include <inttypes.h> -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" #include "pcm_rate.h" diff --git a/src/pcm/pcm_rate_linear.c b/src/pcm/pcm_rate_linear.c index 7481b38..70399e0 100644 --- a/src/pcm/pcm_rate_linear.c +++ b/src/pcm/pcm_rate_linear.c @@ -21,7 +21,7 @@ */ #include <inttypes.h> -#include <byteswap.h> +#include "bswap.h" #include "pcm_local.h" #include "pcm_plugin.h" #include "pcm_rate.h" diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c index 646517d..3611603 100644 --- a/src/pcm/pcm_route.c +++ b/src/pcm/pcm_route.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include <math.h> #include "pcm_local.h" #include "pcm_plugin.h" diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c index c6cfd88..802aa4b 100644 --- a/src/pcm/pcm_softvol.c +++ b/src/pcm/pcm_softvol.c @@ -26,7 +26,7 @@ * */ -#include <byteswap.h> +#include "bswap.h" #include <math.h> #include "pcm_local.h" #include "pcm_plugin.h" -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: byteswap.h 2016-03-03 11:18 ` byteswap.h Thomas Klausner @ 2016-03-03 11:37 ` Takashi Iwai 2016-03-03 11:39 ` byteswap.h Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 11:37 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 12:18:40 +0100, Thomas Klausner wrote: > > On Thu, Mar 03, 2016 at 11:21:05AM +0100, Takashi Iwai wrote: > > On Thu, 03 Mar 2016 11:10:05 +0100, > > Thomas Klausner wrote: > > > > > > On Thu, Mar 03, 2016 at 11:01:23AM +0100, Takashi Iwai wrote: > > > > Applied now. Thanks. > > > > > > Thank you! > > > > > > Next big issue: Many places include byteswap.h to get bswap_16, > > > bswap_32, bswap_64. > > > > > > This header does not exist on *BSD or Solaris. > > > > > > However, all of these provide similar macros under different names, > > > from different header files (bswap16 etc, or BSWAP_16). > > > > > > Do you want a compat header, e.g. include/bswap.h that takes care of > > > this and is included by local.h, or do you prefer a different > > > solution? > > > > bswap.h looks better ATM. Let's see. > > Ok, here's my try for a version of bswap.h. Does it look ok? Looks good to me -- supposing you tested it actually :) Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: byteswap.h 2016-03-03 11:37 ` byteswap.h Takashi Iwai @ 2016-03-03 11:39 ` Thomas Klausner 2016-03-03 12:02 ` Remaining compatibility patches for NetBSD Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 11:39 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel On Thu, Mar 03, 2016 at 12:37:25PM +0100, Takashi Iwai wrote: > On Thu, 03 Mar 2016 12:18:40 +0100, > Thomas Klausner wrote: > > > > On Thu, Mar 03, 2016 at 11:21:05AM +0100, Takashi Iwai wrote: > > > On Thu, 03 Mar 2016 11:10:05 +0100, > > > Thomas Klausner wrote: > > > > > > > > On Thu, Mar 03, 2016 at 11:01:23AM +0100, Takashi Iwai wrote: > > > > > Applied now. Thanks. > > > > > > > > Thank you! > > > > > > > > Next big issue: Many places include byteswap.h to get bswap_16, > > > > bswap_32, bswap_64. > > > > > > > > This header does not exist on *BSD or Solaris. > > > > > > > > However, all of these provide similar macros under different names, > > > > from different header files (bswap16 etc, or BSWAP_16). > > > > > > > > Do you want a compat header, e.g. include/bswap.h that takes care of > > > > this and is included by local.h, or do you prefer a different > > > > solution? > > > > > > bswap.h looks better ATM. Let's see. > > > > Ok, here's my try for a version of bswap.h. Does it look ok? > > Looks good to me -- supposing you tested it actually :) This particular patch was only compile-tested on NetBSD, but a quite similar ifdef has been in pkgsrc for years and has survived a number of bulk builds over the years. Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* Remaining compatibility patches for NetBSD 2016-03-03 11:39 ` byteswap.h Thomas Klausner @ 2016-03-03 12:02 ` Thomas Klausner 2016-03-03 13:35 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 12:02 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel [-- Attachment #1: Type: text/plain, Size: 575 bytes --] Here are the remaining patches to make the build succeed on NetBSD. More patches are needed for FreeBSD and Solaris, but let's take it one at a time :-) I think the first two (0002 and 0003) should be uncontroversial. For patch 0004 it would perhaps be good to have versionsort/alphasort in a central place instead of two. Do you have a suggestion where? I'm not sure what to do about 0005 since you said you don't want to modify include/sound/asound.h. endian.h seems to be unneeded on src/topology/tplg_local.h; if it's needed, I can move it inside the #ifdef. Thomas [-- Attachment #2: 0002-Add-more-compatibility-defines.patch --] [-- Type: text/plain, Size: 700 bytes --] >From b8abae028c02294906e99b1bc66423a89dce54ec Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Thu, 3 Mar 2016 12:56:58 +0100 Subject: [PATCH 2/5] Add more compatibility defines. --- include/type_compat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/type_compat.h b/include/type_compat.h index 9cc209f..0c10aed 100644 --- a/include/type_compat.h +++ b/include/type_compat.h @@ -25,6 +25,9 @@ #ifndef EBADFD #define EBADFD EBADF #endif +#ifndef ESTRPIPE +#define ESTRPIPE EPIPE +#endif #ifndef __u16 #define __u16 uint16_t @@ -63,4 +66,8 @@ #define __kernel_off_t off_t #endif +#ifndef __bitwise +#define __bitwise +#endif + #endif -- 2.7.1 [-- Attachment #3: 0003-Only-use-F_SETSIG-fcntl-where-it-exists.patch --] [-- Type: text/plain, Size: 765 bytes --] >From 72ada4937e512055abd39f83f31214d1e7ee4ebe Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Thu, 3 Mar 2016 12:57:34 +0100 Subject: [PATCH 3/5] Only use F_SETSIG fcntl where it exists. --- src/timer/timer_hw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/timer/timer_hw.c b/src/timer/timer_hw.c index e61b994..ddaebd3 100644 --- a/src/timer/timer_hw.c +++ b/src/timer/timer_hw.c @@ -85,10 +85,12 @@ static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid) } if (sig < 0) return 0; +#ifdef F_SETSIG if (fcntl(fd, F_SETSIG, (long)sig) < 0) { SYSERR("F_SETSIG failed"); return -errno; } +#endif if (fcntl(fd, F_SETOWN, (long)pid) < 0) { SYSERR("F_SETOWN failed"); return -errno; -- 2.7.1 [-- Attachment #4: 0004-Use-alphasort-where-versionsort-is-not-available.patch --] [-- Type: text/plain, Size: 1204 bytes --] >From 23ec0e49db34590c8d74b336d7fe0f97dcf28f26 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Thu, 3 Mar 2016 12:58:07 +0100 Subject: [PATCH 4/5] Use alphasort where versionsort is not available. --- src/conf.c | 2 +- src/ucm/parser.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index a4f2a4f..f8b7a66 100644 --- a/src/conf.c +++ b/src/conf.c @@ -3549,7 +3549,7 @@ int snd_config_hook_load(snd_config_t *root, snd_config_t *config, snd_config_t int n; #ifndef DOC_HIDDEN -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) #define SORTFUNC versionsort #else #define SORTFUNC alphasort diff --git a/src/ucm/parser.c b/src/ucm/parser.c index 9e1cb41..8405bd2 100644 --- a/src/ucm/parser.c +++ b/src/ucm/parser.c @@ -1264,7 +1264,7 @@ int uc_mgr_scan_master_configs(const char **_list[]) "%s", env ? env : ALSA_USE_CASE_DIR); filename[MAX_FILE-1] = '\0'; -#ifdef _GNU_SOURCE +#if defined(_GNU_SOURCE) && !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__sun) #define SORTFUNC versionsort #else #define SORTFUNC alphasort -- 2.7.1 [-- Attachment #5: 0005-Wrap-linux-specific-headers-in-ifdef-__linux__.patch --] [-- Type: text/plain, Size: 1069 bytes --] >From 678c4fd1ada7fb79988df0431312fcdfac9911f8 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Thu, 3 Mar 2016 12:58:30 +0100 Subject: [PATCH 5/5] Wrap linux-specific headers in #ifdef __linux__ --- include/sound/asound.h | 4 ++++ src/topology/tplg_local.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/sound/asound.h b/include/sound/asound.h index a82108e..3d581b5 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -23,7 +23,11 @@ #ifndef _UAPI__SOUND_ASOUND_H #define _UAPI__SOUND_ASOUND_H +#ifdef __linux__ #include <linux/types.h> +#else +#include <sys/ioctl.h> +#endif #ifndef __KERNEL__ #include <stdlib.h> diff --git a/src/topology/tplg_local.h b/src/topology/tplg_local.h index e66d7f4..2b44edd 100644 --- a/src/topology/tplg_local.h +++ b/src/topology/tplg_local.h @@ -13,8 +13,9 @@ #include <limits.h> #include <stdint.h> #include <stdbool.h> -#include <endian.h> +#ifdef __linux__ #include <linux/types.h> +#endif #include "local.h" #include "list.h" -- 2.7.1 [-- Attachment #6: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
* Re: Remaining compatibility patches for NetBSD 2016-03-03 12:02 ` Remaining compatibility patches for NetBSD Thomas Klausner @ 2016-03-03 13:35 ` Takashi Iwai 2016-03-03 13:46 ` Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 13:35 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 13:02:42 +0100, Thomas Klausner wrote: > > Here are the remaining patches to make the build succeed on NetBSD. > More patches are needed for FreeBSD and Solaris, but let's take it one > at a time :-) > > I think the first two (0002 and 0003) should be uncontroversial. > > For patch 0004 it would perhaps be good to have versionsort/alphasort > in a central place instead of two. Do you have a suggestion where? > > I'm not sure what to do about 0005 since you said you don't want to > modify include/sound/asound.h. Right. If we need to modify, it must be applied to Linux kernel tree at first, then copy back to alsa-lib. > endian.h seems to be unneeded on src/topology/tplg_local.h; if it's > needed, I can move it inside the #ifdef. src/topology/parser.c contains the code depending on the endian. The include can be moved there, too. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Remaining compatibility patches for NetBSD 2016-03-03 13:35 ` Takashi Iwai @ 2016-03-03 13:46 ` Thomas Klausner 2016-03-03 13:54 ` Takashi Iwai 0 siblings, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 13:46 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel On Thu, Mar 03, 2016 at 02:35:06PM +0100, Takashi Iwai wrote: > On Thu, 03 Mar 2016 13:02:42 +0100, > Thomas Klausner wrote: > > > > Here are the remaining patches to make the build succeed on NetBSD. > > More patches are needed for FreeBSD and Solaris, but let's take it one > > at a time :-) > > > > I think the first two (0002 and 0003) should be uncontroversial. > > > > For patch 0004 it would perhaps be good to have versionsort/alphasort > > in a central place instead of two. Do you have a suggestion where? > > > > I'm not sure what to do about 0005 since you said you don't want to > > modify include/sound/asound.h. > > Right. If we need to modify, it must be applied to Linux kernel tree > at first, then copy back to alsa-lib. I haven't done this before. I see on https://www.kernel.org/doc/linux/MAINTAINERS SOUND M: Jaroslav Kysela <perex@perex.cz> M: Takashi Iwai <tiwai@suse.com> L: alsa-devel@alsa-project.org (moderated for non-subscribers) W: http://www.alsa-project.org/ T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git T: git git://git.alsa-project.org/alsa-kernel.git Q: http://patchwork.kernel.org/project/alsa-devel/list/ S: Maintained F: Documentation/sound/ F: include/sound/ F: include/uapi/sound/ F: sound/ Against which of the two git trees should I prepare the patch? > > endian.h seems to be unneeded on src/topology/tplg_local.h; if it's > > needed, I can move it inside the #ifdef. > > src/topology/parser.c contains the code depending on the endian. > The include can be moved there, too. local.h already handles endianness: #ifdef HAVE_ENDIAN_H #include <endian.h> #elif defined(HAVE_SYS_ENDIAN_H) #include <sys/endian.h> #ifndef __BYTE_ORDER #define __BYTE_ORDER BYTE_ORDER #endif #ifndef __LITTLE_ENDIAN #define __LITTLE_ENDIAN LITTLE_ENDIAN #endif #ifndef __BIG_ENDIAN #define __BIG_ENDIAN BIG_ENDIAN #endif #else #error Header defining endianness not defined #endif So I think the endian.h include is not necessary and can just be removed. Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Remaining compatibility patches for NetBSD 2016-03-03 13:46 ` Thomas Klausner @ 2016-03-03 13:54 ` Takashi Iwai 2016-03-03 14:23 ` Thomas Klausner 0 siblings, 1 reply; 30+ messages in thread From: Takashi Iwai @ 2016-03-03 13:54 UTC (permalink / raw) To: Thomas Klausner; +Cc: alsa-devel On Thu, 03 Mar 2016 14:46:41 +0100, Thomas Klausner wrote: > > On Thu, Mar 03, 2016 at 02:35:06PM +0100, Takashi Iwai wrote: > > On Thu, 03 Mar 2016 13:02:42 +0100, > > Thomas Klausner wrote: > > > > > > Here are the remaining patches to make the build succeed on NetBSD. > > > More patches are needed for FreeBSD and Solaris, but let's take it one > > > at a time :-) > > > > > > I think the first two (0002 and 0003) should be uncontroversial. > > > > > > For patch 0004 it would perhaps be good to have versionsort/alphasort > > > in a central place instead of two. Do you have a suggestion where? > > > > > > I'm not sure what to do about 0005 since you said you don't want to > > > modify include/sound/asound.h. > > > > Right. If we need to modify, it must be applied to Linux kernel tree > > at first, then copy back to alsa-lib. > > I haven't done this before. > > I see on https://www.kernel.org/doc/linux/MAINTAINERS > > SOUND > M: Jaroslav Kysela <perex@perex.cz> > M: Takashi Iwai <tiwai@suse.com> > L: alsa-devel@alsa-project.org (moderated for non-subscribers) > W: http://www.alsa-project.org/ > T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git > T: git git://git.alsa-project.org/alsa-kernel.git > Q: http://patchwork.kernel.org/project/alsa-devel/list/ > S: Maintained > F: Documentation/sound/ > F: include/sound/ > F: include/uapi/sound/ > F: sound/ > > Against which of the two git trees should I prepare the patch? Use my sound git tree. > > > endian.h seems to be unneeded on src/topology/tplg_local.h; if it's > > > needed, I can move it inside the #ifdef. > > > > src/topology/parser.c contains the code depending on the endian. > > The include can be moved there, too. > > local.h already handles endianness: > > #ifdef HAVE_ENDIAN_H > #include <endian.h> > #elif defined(HAVE_SYS_ENDIAN_H) > #include <sys/endian.h> > #ifndef __BYTE_ORDER > #define __BYTE_ORDER BYTE_ORDER > #endif > #ifndef __LITTLE_ENDIAN > #define __LITTLE_ENDIAN LITTLE_ENDIAN > #endif > #ifndef __BIG_ENDIAN > #define __BIG_ENDIAN BIG_ENDIAN > #endif > #else > #error Header defining endianness not defined > #endif > > So I think the endian.h include is not necessary and can just be removed. Yes, looks so. Takashi ^ permalink raw reply [flat|nested] 30+ messages in thread
* Re: Remaining compatibility patches for NetBSD 2016-03-03 13:54 ` Takashi Iwai @ 2016-03-03 14:23 ` Thomas Klausner 0 siblings, 0 replies; 30+ messages in thread From: Thomas Klausner @ 2016-03-03 14:23 UTC (permalink / raw) To: Takashi Iwai; +Cc: alsa-devel On Thu, Mar 03, 2016 at 02:54:09PM +0100, Takashi Iwai wrote: > On Thu, 03 Mar 2016 14:46:41 +0100, > Thomas Klausner wrote: > > > > On Thu, Mar 03, 2016 at 02:35:06PM +0100, Takashi Iwai wrote: > > > On Thu, 03 Mar 2016 13:02:42 +0100, > > > Thomas Klausner wrote: > > > > > > > > Here are the remaining patches to make the build succeed on NetBSD. > > > > More patches are needed for FreeBSD and Solaris, but let's take it one > > > > at a time :-) > > > > > > > > I think the first two (0002 and 0003) should be uncontroversial. > > > > > > > > For patch 0004 it would perhaps be good to have versionsort/alphasort > > > > in a central place instead of two. Do you have a suggestion where? > > > > > > > > I'm not sure what to do about 0005 since you said you don't want to > > > > modify include/sound/asound.h. > > > > > > Right. If we need to modify, it must be applied to Linux kernel tree > > > at first, then copy back to alsa-lib. > > > > I haven't done this before. > > > > I see on https://www.kernel.org/doc/linux/MAINTAINERS > > > > SOUND > > M: Jaroslav Kysela <perex@perex.cz> > > M: Takashi Iwai <tiwai@suse.com> > > L: alsa-devel@alsa-project.org (moderated for non-subscribers) > > W: http://www.alsa-project.org/ > > T: git git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git > > T: git git://git.alsa-project.org/alsa-kernel.git > > Q: http://patchwork.kernel.org/project/alsa-devel/list/ > > S: Maintained > > F: Documentation/sound/ > > F: include/sound/ > > F: include/uapi/sound/ > > F: sound/ > > > > Against which of the two git trees should I prepare the patch? > > Use my sound git tree. Ok, I've just sent a patch against that repository to this mailing list. Thomas ^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH 3/3] Use uint*_t instead of __le*. 2016-02-29 15:05 ` [PATCH 1/3] Use POSIX uint*_t instead of u_int*_t Thomas Klausner 2016-02-29 15:05 ` [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability Thomas Klausner @ 2016-02-29 15:05 ` Thomas Klausner 2016-02-29 15:10 ` [PATCH 4/4] Replace __u* with uint*_t Thomas Klausner 1 sibling, 1 reply; 30+ messages in thread From: Thomas Klausner @ 2016-02-29 15:05 UTC (permalink / raw) To: alsa-devel; +Cc: Thomas Klausner From: Thomas Klausner <wiz@NetBSD.org> For better portability. --- include/sound/asoc.h | 178 +++++++++++++++++++++++++-------------------------- 1 file changed, 89 insertions(+), 89 deletions(-) diff --git a/include/sound/asoc.h b/include/sound/asoc.h index a29c05c..05bdae7 100644 --- a/include/sound/asoc.h +++ b/include/sound/asoc.h @@ -112,15 +112,15 @@ * This header precedes all object and object arrays below. */ struct snd_soc_tplg_hdr { - __le32 magic; /* magic number */ - __le32 abi; /* ABI version */ - __le32 version; /* optional vendor specific version details */ - __le32 type; /* SND_SOC_TPLG_TYPE_ */ - __le32 size; /* size of this structure */ - __le32 vendor_type; /* optional vendor specific type info */ - __le32 payload_size; /* data bytes, excluding this header */ - __le32 index; /* identifier for block */ - __le32 count; /* number of elements in block */ + uint32_t magic; /* magic number */ + uint32_t abi; /* ABI version */ + uint32_t version; /* optional vendor specific version details */ + uint32_t type; /* SND_SOC_TPLG_TYPE_ */ + uint32_t size; /* size of this structure */ + uint32_t vendor_type; /* optional vendor specific type info */ + uint32_t payload_size; /* data bytes, excluding this header */ + uint32_t index; /* identifier for block */ + uint32_t count; /* number of elements in block */ } __attribute__((packed)); /* @@ -129,7 +129,7 @@ struct snd_soc_tplg_hdr { * firmware. Core will ignore this data. */ struct snd_soc_tplg_private { - __le32 size; /* in bytes of private data */ + uint32_t size; /* in bytes of private data */ char data[0]; } __attribute__((packed)); @@ -137,16 +137,16 @@ struct snd_soc_tplg_private { * Kcontrol TLV data. */ struct snd_soc_tplg_tlv_dbscale { - __le32 min; - __le32 step; - __le32 mute; + uint32_t min; + uint32_t step; + uint32_t mute; } __attribute__((packed)); struct snd_soc_tplg_ctl_tlv { - __le32 size; /* in bytes of this structure */ - __le32 type; /* SNDRV_CTL_TLVT_*, type of TLV */ + uint32_t size; /* in bytes of this structure */ + uint32_t type; /* SNDRV_CTL_TLVT_*, type of TLV */ union { - __le32 data[SND_SOC_TPLG_TLV_SIZE]; + uint32_t data[SND_SOC_TPLG_TLV_SIZE]; struct snd_soc_tplg_tlv_dbscale scale; }; } __attribute__((packed)); @@ -155,10 +155,10 @@ struct snd_soc_tplg_ctl_tlv { * Kcontrol channel data */ struct snd_soc_tplg_channel { - __le32 size; /* in bytes of this structure */ - __le32 reg; - __le32 shift; - __le32 id; /* ID maps to Left, Right, LFE etc */ + uint32_t size; /* in bytes of this structure */ + uint32_t reg; + uint32_t shift; + uint32_t id; /* ID maps to Left, Right, LFE etc */ } __attribute__((packed)); /* @@ -167,19 +167,19 @@ struct snd_soc_tplg_channel { * Bytes ext ops need get/put. */ struct snd_soc_tplg_io_ops { - __le32 get; - __le32 put; - __le32 info; + uint32_t get; + uint32_t put; + uint32_t info; } __attribute__((packed)); /* * kcontrol header */ struct snd_soc_tplg_ctl_hdr { - __le32 size; /* in bytes of this structure */ - __le32 type; + uint32_t size; /* in bytes of this structure */ + uint32_t type; char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - __le32 access; + uint32_t access; struct snd_soc_tplg_io_ops ops; struct snd_soc_tplg_ctl_tlv tlv; } __attribute__((packed)); @@ -188,33 +188,33 @@ struct snd_soc_tplg_ctl_hdr { * Stream Capabilities */ struct snd_soc_tplg_stream_caps { - __le32 size; /* in bytes of this structure */ + uint32_t size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - __le64 formats; /* supported formats SNDRV_PCM_FMTBIT_* */ - __le32 rates; /* supported rates SNDRV_PCM_RATE_* */ - __le32 rate_min; /* min rate */ - __le32 rate_max; /* max rate */ - __le32 channels_min; /* min channels */ - __le32 channels_max; /* max channels */ - __le32 periods_min; /* min number of periods */ - __le32 periods_max; /* max number of periods */ - __le32 period_size_min; /* min period size bytes */ - __le32 period_size_max; /* max period size bytes */ - __le32 buffer_size_min; /* min buffer size bytes */ - __le32 buffer_size_max; /* max buffer size bytes */ + uint64_t formats; /* supported formats SNDRV_PCM_FMTBIT_* */ + uint32_t rates; /* supported rates SNDRV_PCM_RATE_* */ + uint32_t rate_min; /* min rate */ + uint32_t rate_max; /* max rate */ + uint32_t channels_min; /* min channels */ + uint32_t channels_max; /* max channels */ + uint32_t periods_min; /* min number of periods */ + uint32_t periods_max; /* max number of periods */ + uint32_t period_size_min; /* min period size bytes */ + uint32_t period_size_max; /* max period size bytes */ + uint32_t buffer_size_min; /* min buffer size bytes */ + uint32_t buffer_size_max; /* max buffer size bytes */ } __attribute__((packed)); /* * FE or BE Stream configuration supported by SW/FW */ struct snd_soc_tplg_stream { - __le32 size; /* in bytes of this structure */ + uint32_t size; /* in bytes of this structure */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; /* Name of the stream */ - __le64 format; /* SNDRV_PCM_FMTBIT_* */ - __le32 rate; /* SNDRV_PCM_RATE_* */ - __le32 period_bytes; /* size of period in bytes */ - __le32 buffer_bytes; /* size of buffer in bytes */ - __le32 channels; /* channels */ + uint64_t format; /* SNDRV_PCM_FMTBIT_* */ + uint32_t rate; /* SNDRV_PCM_RATE_* */ + uint32_t period_bytes; /* size of period in bytes */ + uint32_t buffer_bytes; /* size of buffer in bytes */ + uint32_t channels; /* channels */ } __attribute__((packed)); /* @@ -230,12 +230,12 @@ struct snd_soc_tplg_stream { * +-----------------------------------+----+ */ struct snd_soc_tplg_manifest { - __le32 size; /* in bytes of this structure */ - __le32 control_elems; /* number of control elements */ - __le32 widget_elems; /* number of widget elements */ - __le32 graph_elems; /* number of graph elements */ - __le32 pcm_elems; /* number of PCM elements */ - __le32 dai_link_elems; /* number of DAI link elements */ + uint32_t size; /* in bytes of this structure */ + uint32_t control_elems; /* number of control elements */ + uint32_t widget_elems; /* number of widget elements */ + uint32_t graph_elems; /* number of graph elements */ + uint32_t pcm_elems; /* number of PCM elements */ + uint32_t dai_link_elems; /* number of DAI link elements */ struct snd_soc_tplg_private priv; } __attribute__((packed)); @@ -251,12 +251,12 @@ struct snd_soc_tplg_manifest { */ struct snd_soc_tplg_mixer_control { struct snd_soc_tplg_ctl_hdr hdr; - __le32 size; /* in bytes of this structure */ - __le32 min; - __le32 max; - __le32 platform_max; - __le32 invert; - __le32 num_channels; + uint32_t size; /* in bytes of this structure */ + uint32_t min; + uint32_t max; + uint32_t platform_max; + uint32_t invert; + uint32_t num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; struct snd_soc_tplg_private priv; } __attribute__((packed)); @@ -273,14 +273,14 @@ struct snd_soc_tplg_mixer_control { */ struct snd_soc_tplg_enum_control { struct snd_soc_tplg_ctl_hdr hdr; - __le32 size; /* in bytes of this structure */ - __le32 num_channels; + uint32_t size; /* in bytes of this structure */ + uint32_t num_channels; struct snd_soc_tplg_channel channel[SND_SOC_TPLG_MAX_CHAN]; - __le32 items; - __le32 mask; - __le32 count; + uint32_t items; + uint32_t mask; + uint32_t count; char texts[SND_SOC_TPLG_NUM_TEXTS][SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - __le32 values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; + uint32_t values[SND_SOC_TPLG_NUM_TEXTS * SNDRV_CTL_ELEM_ID_NAME_MAXLEN / 4]; struct snd_soc_tplg_private priv; } __attribute__((packed)); @@ -296,11 +296,11 @@ struct snd_soc_tplg_enum_control { */ struct snd_soc_tplg_bytes_control { struct snd_soc_tplg_ctl_hdr hdr; - __le32 size; /* in bytes of this structure */ - __le32 max; - __le32 mask; - __le32 base; - __le32 num_regs; + uint32_t size; /* in bytes of this structure */ + uint32_t max; + uint32_t mask; + uint32_t base; + uint32_t num_regs; struct snd_soc_tplg_io_ops ext_ops; struct snd_soc_tplg_private priv; } __attribute__((packed)); @@ -338,20 +338,20 @@ struct snd_soc_tplg_dapm_graph_elem { * in the block. */ struct snd_soc_tplg_dapm_widget { - __le32 size; /* in bytes of this structure */ - __le32 id; /* SND_SOC_DAPM_CTL */ + uint32_t size; /* in bytes of this structure */ + uint32_t id; /* SND_SOC_DAPM_CTL */ char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char sname[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - __le32 reg; /* negative reg = no direct dapm */ - __le32 shift; /* bits to shift */ - __le32 mask; /* non-shifted mask */ - __le32 subseq; /* sort within widget type */ - __le32 invert; /* invert the power bit */ - __le32 ignore_suspend; /* kept enabled over suspend */ - __le16 event_flags; - __le16 event_type; - __le32 num_kcontrols; + uint32_t reg; /* negative reg = no direct dapm */ + uint32_t shift; /* bits to shift */ + uint32_t mask; /* non-shifted mask */ + uint32_t subseq; /* sort within widget type */ + uint32_t invert; /* invert the power bit */ + uint32_t ignore_suspend; /* kept enabled over suspend */ + uint16_t event_flags; + uint16_t event_type; + uint32_t num_kcontrols; struct snd_soc_tplg_private priv; /* * kcontrols that relate to this widget @@ -371,16 +371,16 @@ struct snd_soc_tplg_dapm_widget { * +-----------------------------------+-----+ */ struct snd_soc_tplg_pcm { - __le32 size; /* in bytes of this structure */ + uint32_t size; /* in bytes of this structure */ char pcm_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; char dai_name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; - __le32 pcm_id; /* unique ID - used to match */ - __le32 dai_id; /* unique ID - used to match */ - __le32 playback; /* supports playback mode */ - __le32 capture; /* supports capture mode */ - __le32 compress; /* 1 = compressed; 0 = PCM */ + uint32_t pcm_id; /* unique ID - used to match */ + uint32_t dai_id; /* unique ID - used to match */ + uint32_t playback; /* supports playback mode */ + uint32_t capture; /* supports capture mode */ + uint32_t compress; /* 1 = compressed; 0 = PCM */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* for DAI link */ - __le32 num_streams; /* number of streams */ + uint32_t num_streams; /* number of streams */ struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */ } __attribute__((packed)); @@ -396,9 +396,9 @@ struct snd_soc_tplg_pcm { * +-----------------------------------+-----+ */ struct snd_soc_tplg_link_config { - __le32 size; /* in bytes of this structure */ - __le32 id; /* unique ID - used to match */ + uint32_t size; /* in bytes of this structure */ + uint32_t id; /* unique ID - used to match */ struct snd_soc_tplg_stream stream[SND_SOC_TPLG_STREAM_CONFIG_MAX]; /* supported configs playback and captrure */ - __le32 num_streams; /* number of streams */ + uint32_t num_streams; /* number of streams */ } __attribute__((packed)); #endif -- 2.7.1 ^ permalink raw reply related [flat|nested] 30+ messages in thread
* [PATCH 4/4] Replace __u* with uint*_t 2016-02-29 15:05 ` [PATCH 3/3] Use uint*_t instead of __le* Thomas Klausner @ 2016-02-29 15:10 ` Thomas Klausner 0 siblings, 0 replies; 30+ messages in thread From: Thomas Klausner @ 2016-02-29 15:10 UTC (permalink / raw) To: alsa-devel [-- Attachment #1: Type: text/plain, Size: 25 bytes --] And here's a fourth one. [-- Attachment #2: 0004-Replace-__u-with-uint-_t.patch --] [-- Type: text/plain, Size: 2011 bytes --] >From e98b740f7617830f46e58365f3c0602fcb3ff8c2 Mon Sep 17 00:00:00 2001 From: Thomas Klausner <wiz@NetBSD.org> Date: Mon, 29 Feb 2016 16:08:54 +0100 Subject: [PATCH 4/4] Replace __u* with uint*_t. --- include/sound/asound.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/sound/asound.h b/include/sound/asound.h index 4f2202f..0d30eaa 100644 --- a/include/sound/asound.h +++ b/include/sound/asound.h @@ -370,7 +370,7 @@ struct snd_interval { #define SNDRV_MASK_MAX 256 struct snd_mask { - __u32 bits[(SNDRV_MASK_MAX+31)/32]; + uint32_t bits[(SNDRV_MASK_MAX+31)/32]; }; struct snd_pcm_hw_params { @@ -447,10 +447,10 @@ struct snd_pcm_status { snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ snd_pcm_state_t suspended_state; /* suspended stream state */ - __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ + uint32_t audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ struct timespec audio_tstamp; /* sample counter, wall clock, PHC or on-demand sync'ed */ struct timespec driver_tstamp; /* useful in case reference system tstamp is reported with delay */ - __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ + uint32_t audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ unsigned char reserved[52-2*sizeof(struct timespec)]; /* must be filled with zero */ }; @@ -900,7 +900,7 @@ struct snd_ctl_elem_info { unsigned int items; /* R: number of items */ unsigned int item; /* W: item number */ char name[64]; /* R: value name */ - __u64 names_ptr; /* W: names list (ELEM_ADD only) */ + uint64_t names_ptr; /* W: names list (ELEM_ADD only) */ unsigned int names_length; } enumerated; unsigned char reserved[128]; -- 2.7.1 [-- Attachment #3: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply related [flat|nested] 30+ messages in thread
end of thread, other threads:[~2016-03-03 14:23 UTC | newest] Thread overview: 30+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-18 15:47 feeding back pkgsrc changs Thomas Klausner 2016-02-18 15:51 ` Takashi Iwai 2016-02-23 14:09 ` portability patch: EBADF [was Re: feeding back pkgsrc changs] Thomas Klausner 2016-02-23 15:53 ` Takashi Iwai 2016-02-24 13:16 ` Thomas Klausner 2016-02-24 15:36 ` Takashi Iwai 2016-02-25 23:31 ` portability: types Thomas Klausner 2016-02-26 8:45 ` Clemens Ladisch 2016-02-29 15:05 ` [PATCH 1/3] Use POSIX uint*_t instead of u_int*_t Thomas Klausner 2016-02-29 15:05 ` [PATCH 2/3] Use pid_t, off_t instead of __kernel_*_t for better portability Thomas Klausner 2016-02-29 16:10 ` Takashi Iwai 2016-03-02 22:14 ` [PATCH] define more missing types for non-Linux Thomas Klausner 2016-03-03 9:32 ` Takashi Iwai 2016-03-03 9:50 ` Thomas Klausner 2016-03-03 9:53 ` Takashi Iwai 2016-03-03 9:55 ` Takashi Iwai 2016-03-03 9:58 ` Thomas Klausner 2016-03-03 10:01 ` Takashi Iwai 2016-03-03 10:10 ` byteswap.h Thomas Klausner 2016-03-03 10:21 ` byteswap.h Takashi Iwai 2016-03-03 11:18 ` byteswap.h Thomas Klausner 2016-03-03 11:37 ` byteswap.h Takashi Iwai 2016-03-03 11:39 ` byteswap.h Thomas Klausner 2016-03-03 12:02 ` Remaining compatibility patches for NetBSD Thomas Klausner 2016-03-03 13:35 ` Takashi Iwai 2016-03-03 13:46 ` Thomas Klausner 2016-03-03 13:54 ` Takashi Iwai 2016-03-03 14:23 ` Thomas Klausner 2016-02-29 15:05 ` [PATCH 3/3] Use uint*_t instead of __le* Thomas Klausner 2016-02-29 15:10 ` [PATCH 4/4] Replace __u* with uint*_t Thomas Klausner
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.