implement no_mmap_ctrl only for CONFIG_COMPAT
PATCH 1/1 implement no_mmap_ctrl only for CONFIG_COMPAT
Hi Takashi,
this spares a few bytes for the average case.
Please apply.
Thanks,
Karsten
------
Summary: ALSA's struct _snd_pcm_substream:
implent no_mmap_ctrl only for CONFIG_COMPAT
From: Karsten Wiese <[email protected]>
This patch makes the implementation of no_mmap_ctrl depend on CONFIG_COMPAT and thus spares a few bytes in the average case, when CONFIG_COMPAT is not defined.
Two access macros GET_NO_MMAP_CTRL() and SET_NO_MMAP_CTRL() are also defined and substituted in the c - files, where previously no_mmap_ctrl was used directly.
include/pcm.h +11 -0
@@ -405,10 +405,21 @@ struct _snd_pcm_substream {snd_info_entry_t *proc_sw_params_entry;snd_info_entry_t *proc_status_entry;snd_info_entry_t *proc_prealloc_entry; +#ifdef CONFIG_COMPAT /* misc flags */ unsigned int no_mmap_ctrl: 1; +#endif }; +#ifdef CONFIG_COMPAT +# define GET_NO_MMAP_CTRL (substream) ((substream)->no_mmap_ctrl) +# define SET_NO_MMAP_CTRL (substream, val) ((substream)->no_mmap_ctrl = val) +#else +# define GET_NO_MMAP_CTRL (substream) 0 +# define SET_NO_MMAP_CTRL (substream, val) +#endif + +#if defined(CONFIG_SND_PCM_OSS ) || defined(CONFIG_SND_PCM_OSS_MODULE )#define SUBSTREAM_BUSY (substream) ((substream)->file != NULL || ((substream)->oss.file != NULL))#else
core/pcm_native.c +3 -3
@@ -2004,7 +2004,7 @@ static int snd_pcm_open_file(struct file str = substream->pstr; substream->file = pcm_file; - substream->no_mmap_ctrl =0 ; +SET_NO_MMAP_CTRL (substream,0 ); pcm_file->substream = substream;
@@ -3170,11 +3170,11 @@ static int snd_pcm_mmap(struct file *fil offset = area->vm_pgoff <<PAGE_SHIFT ;switch (offset) {case SNDRV_PCM_MMAP_OFFSET_STATUS : -if (substream->no_mmap_ctrl) +if (GET_NO_MMAP_CTRL (substream))return -ENXIO ;return snd_pcm_mmap_status (substream, file, area);case SNDRV_PCM_MMAP_OFFSET_CONTROL : -if (substream->no_mmap_ctrl) +if (GET_NO_MMAP_CTRL (substream))return -ENXIO ;return snd_pcm_mmap_control (substream, file, area);default :
core/pcm_compat.c +1 -1
@@ -459,7 +459,7 @@ static long snd_pcm_ioctl_compat(struct* mmap of PCM status/control records because of the size * incompatibility. */ - substream->no_mmap_ctrl =1 ; +SET_NO_MMAP_CTRL (substream,1 );switch (cmd) {case SNDRV_PCM_IOCTL_PVERSION :
_
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
At Wed, 10 Aug 2005 13:51:47 +0200,
Quoted 5 lines · Karsten Wiese
Hi Takashi,
this spares a few bytes for the average case.
Please apply.
I'd like to keep it explicitly.no_mmap_ctrl would be required for some architectures which don't support mmap well.
Takashi
Quoted 87 lines
Thanks,
Karsten------
Summary: ALSA's struct_snd_pcm_substream:
implentno_mmap_ctrlonly forCONFIG_COMPAT
From: Karsten Wiese <[email protected]>This patch makes the implementation of
no_mmap_ctrldepend onCONFIG_COMPATand thus spares a few bytes in the average case, whenCONFIG_COMPATis not defined.
Two access macrosGET_NO_MMAP_CTRL()andSET_NO_MMAP_CTRL()are also defined and substituted in the c - files, where previouslyno_mmap_ctrlwas used directly.Signed-off-by Karsten Wiese <[email protected]>include/pcm.h +11
-0@@ -405,10 +405,21 @@ struct _snd_pcm_substream {snd_info_entry_t *proc_sw_params_entry;snd_info_entry_t *proc_status_entry;snd_info_entry_t *proc_prealloc_entry; +#ifdef CONFIG_COMPAT /* misc flags */ unsigned int no_mmap_ctrl: 1; +#endif }; +#ifdef CONFIG_COMPAT +# define GET_NO_MMAP_CTRL (substream) ((substream)->no_mmap_ctrl) +# define SET_NO_MMAP_CTRL (substream, val) ((substream)->no_mmap_ctrl = val) +#else +# define GET_NO_MMAP_CTRL (substream) 0 +# define SET_NO_MMAP_CTRL (substream, val) +#endif + +#if defined(CONFIG_SND_PCM_OSS ) || defined(CONFIG_SND_PCM_OSS_MODULE )#define SUBSTREAM_BUSY (substream) ((substream)->file != NULL || ((substream)->oss.file != NULL))#else core/pcm_native.c +3
-3@@ -2004,7 +2004,7 @@ static int snd_pcm_open_file(struct file str = substream->pstr; substream->file = pcm_file; - substream->no_mmap_ctrl =0 ; +SET_NO_MMAP_CTRL (substream,0 ); pcm_file->substream = substream;@@ -3170,11 +3170,11 @@ static int snd_pcm_mmap(struct file *fil offset = area->vm_pgoff <<PAGE_SHIFT ;switch (offset) {case SNDRV_PCM_MMAP_OFFSET_STATUS : -if (substream->no_mmap_ctrl) +if (GET_NO_MMAP_CTRL (substream))return -ENXIO ;return snd_pcm_mmap_status (substream, file, area);case SNDRV_PCM_MMAP_OFFSET_CONTROL : -if (substream->no_mmap_ctrl) +if (GET_NO_MMAP_CTRL (substream))return -ENXIO ;return snd_pcm_mmap_control (substream, file, area);default :core/pcm_compat.c +1
-1@@ -459,7 +459,7 @@ static long snd_pcm_ioctl_compat(struct* mmap of PCM status/control records because of the size * incompatibility. */ - substream->no_mmap_ctrl =1 ; +SET_NO_MMAP_CTRL (substream,1 );switch (cmd) {case SNDRV_PCM_IOCTL_PVERSION :_
Quoted 3 lines
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf