From: Karsten Wiese Subject: [Patch]implement no_mmap_ctrl only for CONFIG_COMPAT Date: Wed, 10 Aug 2005 13:51:47 +0200 Message-ID: <200508101351.48058.annabellesgarden@yahoo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Takashi Iwai Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org 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 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. Signed-off-by: Karsten Wiese --- alsa-kernel_/include/pcm.h 2005-08-09 22:55:04.000000000 +0200 +++ alsa-kernel/include/pcm.h 2005-08-10 12:06:40.000000000 +0200 @@ -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 --- alsa-kernel_/core/pcm_native.c 2005-08-09 23:03:15.000000000 +0200 +++ alsa-kernel/core/pcm_native.c 2005-08-10 12:06:40.000000000 +0200 @@ -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: --- alsa-kernel_/core/pcm_compat.c 2005-01-20 18:11:46.000000000 +0100 +++ alsa-kernel/core/pcm_compat.c 2005-08-10 12:06:29.000000000 +0200 @@ -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