[alsa-devel] [PATCH RFC 7/9] ALSA: core: pass audio tstamp config from userspace in compat mode
Pierre-Louis Bossart
pierre-louis.bossart at linux.intel.com
Mon Dec 8 23:23:44 CET 2014
Let userspace select audio timestamp config, ignore and zero all
other fields
Use audio_tstamp_data to retrieve config and pass report back to
user space
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
---
sound/core/pcm_compat.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 2d957ba..d71b5b3 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -194,7 +194,7 @@ struct snd_pcm_status32 {
u32 avail_max;
u32 overrange;
s32 suspended_state;
- u32 reserved_alignment;
+ u32 audio_tstamp_data;
struct compat_timespec audio_tstamp;
unsigned char reserved[56-sizeof(struct compat_timespec)];
} __attribute__((packed));
@@ -206,6 +206,10 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
struct snd_pcm_status status;
int err;
+ /* fetch audio_stamp_config from user-space */
+ if (get_user(status.audio_tstamp_data, &src->audio_tstamp_data))
+ return -EFAULT;
+
err = snd_pcm_status(substream, &status);
if (err < 0)
return err;
@@ -222,6 +226,7 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
put_user(status.avail_max, &src->avail_max) ||
put_user(status.overrange, &src->overrange) ||
put_user(status.suspended_state, &src->suspended_state) ||
+ put_user(status.audio_tstamp_data, &src->audio_tstamp_data) ||
compat_put_timespec(&status.audio_tstamp, &src->audio_tstamp))
return -EFAULT;
--
2.1.0
More information about the Alsa-devel
mailing list