*参照元 [#o9465765] #backlinks *説明 [#gf657628] -パス: [[linux-2.6.33/sound/core/pcm_lib.c]] -FIXME: これは何? --説明 **引数 [#f9aee086] -struct snd_pcm_substream *substream -- --[[linux-2.6.33/snd_pcm_substream]] -unsigned int hwoff -- -unsigned long data -- -unsigned int off -- -snd_pcm_uframes_t frames -- --[[linux-2.6.33/snd_pcm_uframes_t]] **返り値 [#qd17c367] -int -- **参考 [#a25e8913] *実装 [#wcd41e48] static int snd_pcm_lib_readv_transfer(struct snd_pcm_substream *substream, unsigned int hwoff, unsigned long data, unsigned int off, snd_pcm_uframes_t frames) { struct snd_pcm_runtime *runtime = substream->runtime; int err; void __user **bufs = (void __user **)data; int channels = runtime->channels; int c; - --[[linux-2.6.33/snd_pcm_runtime]] if (substream->ops->copy) { for (c = 0; c < channels; ++c, ++bufs) { char __user *buf; if (*bufs == NULL) continue; buf = *bufs + samples_to_bytes(runtime, off); if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0) return err; } - --substream->ops は snd_pcm_ops 型のメンバ --[[linux-2.6.33/snd_pcm_ops]] - --[[linux-2.6.33/samples_to_bytes()]] } else { snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels; - --[[linux-2.6.33/snd_pcm_uframes_t]] for (c = 0; c < channels; ++c, ++bufs) { char *hwbuf; char __user *buf; if (*bufs == NULL) continue; hwbuf = runtime->dma_area + (c * dma_csize) + samples_to_bytes(runtime, hwoff); buf = *bufs + samples_to_bytes(runtime, off); if (copy_to_user(buf, hwbuf, samples_to_bytes(runtime, frames))) return -EFAULT; } - --[[linux-2.6.33/copy_to_user()]] } return 0; } *コメント [#n15f49c0]