24 #include <linux/slab.h>
33 fs = snd_enter_user();
34 err = snd_pcm_delay(substream, &delay);
52 err = snd_pcm_playback_rewind(substream, frames);
54 err = snd_pcm_capture_rewind(substream, frames);
57 return err < 0 ? err : 0;
69 err = snd_pcm_playback_forward(substream, frames);
71 err = snd_pcm_capture_forward(substream, frames);
74 return err < 0 ? err : 0;
115 while (boundary * 2 <= 0x7fffffffUL - runtime->
buffer_size)
142 boundary = recalculate_boundary(substream->
runtime);
143 if (boundary &&
params.silence_size >= boundary)
148 if (boundary &&
put_user(boundary, &src->boundary))
160 static int snd_pcm_ioctl_channel_info_compat(
struct snd_pcm_substream *substream,
208 put_user(
status.trigger_tstamp.tv_sec, &src->trigger_tstamp.tv_sec) ||
209 put_user(
status.trigger_tstamp.tv_nsec, &src->trigger_tstamp.tv_nsec) ||
233 if (! (runtime = substream->
runtime))
239 return PTR_ERR(data);
254 unsigned int new_boundary = recalculate_boundary(runtime);
281 if (substream->
stream != dir)
327 if (substream->
stream != dir)
330 if ((ch = substream->
runtime->channels) > 128)
335 bufptr = compat_ptr(buf);
339 for (i = 0; i < ch; i++) {
345 bufs[
i] = compat_ptr(ptr);
401 if (
get_user(sflags, &src->flags) ||
402 get_user(scontrol.appl_ptr, &src->c.control.appl_ptr) ||
403 get_user(scontrol.avail_min, &src->c.control.avail_min))
406 err = snd_pcm_hwsync(substream);
412 boundary = recalculate_boundary(runtime);
414 boundary = 0x7fffffff;
415 snd_pcm_stream_lock_irq(substream);
418 control->
appl_ptr = scontrol.appl_ptr;
420 scontrol.appl_ptr = control->
appl_ptr % boundary;
425 sstatus.state = status->
state;
426 sstatus.hw_ptr = status->
hw_ptr % boundary;
427 sstatus.tstamp = status->
tstamp;
429 snd_pcm_stream_unlock_irq(substream);
430 if (
put_user(sstatus.state, &src->s.status.state) ||
431 put_user(sstatus.hw_ptr, &src->s.status.hw_ptr) ||
432 put_user(sstatus.tstamp.tv_sec, &src->s.status.tstamp.tv_sec) ||
433 put_user(sstatus.tstamp.tv_nsec, &src->s.status.tstamp.tv_nsec) ||
434 put_user(sstatus.suspended_state, &src->s.status.suspended_state) ||
435 put_user(scontrol.appl_ptr, &src->c.control.appl_ptr) ||
436 put_user(scontrol.avail_min, &src->c.control.avail_min))
500 return snd_pcm_playback_ioctl1(file, substream, cmd, argp);
502 return snd_pcm_capture_ioctl1(file, substream, cmd, argp);
504 return snd_pcm_ioctl_hw_params_compat(substream, 1, argp);
506 return snd_pcm_ioctl_hw_params_compat(substream, 0, argp);
508 return snd_pcm_ioctl_sw_params_compat(substream, argp);
510 return snd_pcm_status_user_compat(substream, argp);
512 return snd_pcm_ioctl_sync_ptr_compat(substream, argp);
514 return snd_pcm_ioctl_channel_info_compat(substream, argp);
524 return snd_pcm_ioctl_delay_compat(substream, argp);
526 return snd_pcm_ioctl_rewind_compat(substream, argp);
528 return snd_pcm_ioctl_forward_compat(substream, argp);