|
@@ -2852,8 +2852,8 @@ static ssize_t snd_pcm_write(struct file *file, const char __user *buf,
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
|
|
|
|
- unsigned long count, loff_t * offset)
|
|
|
|
|
|
+static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct iovec *iov,
|
|
|
|
+ unsigned long nr_segs, loff_t pos)
|
|
|
|
|
|
{
|
|
{
|
|
struct snd_pcm_file *pcm_file;
|
|
struct snd_pcm_file *pcm_file;
|
|
@@ -2864,22 +2864,22 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
|
|
void __user **bufs;
|
|
void __user **bufs;
|
|
snd_pcm_uframes_t frames;
|
|
snd_pcm_uframes_t frames;
|
|
|
|
|
|
- pcm_file = file->private_data;
|
|
|
|
|
|
+ pcm_file = iocb->ki_filp->private_data;
|
|
substream = pcm_file->substream;
|
|
substream = pcm_file->substream;
|
|
snd_assert(substream != NULL, return -ENXIO);
|
|
snd_assert(substream != NULL, return -ENXIO);
|
|
runtime = substream->runtime;
|
|
runtime = substream->runtime;
|
|
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
|
|
if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
|
|
return -EBADFD;
|
|
return -EBADFD;
|
|
- if (count > 1024 || count != runtime->channels)
|
|
|
|
|
|
+ if (nr_segs > 1024 || nr_segs != runtime->channels)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- if (!frame_aligned(runtime, _vector->iov_len))
|
|
|
|
|
|
+ if (!frame_aligned(runtime, iov->iov_len))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
- frames = bytes_to_samples(runtime, _vector->iov_len);
|
|
|
|
- bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL);
|
|
|
|
|
|
+ frames = bytes_to_samples(runtime, iov->iov_len);
|
|
|
|
+ bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL);
|
|
if (bufs == NULL)
|
|
if (bufs == NULL)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
- for (i = 0; i < count; ++i)
|
|
|
|
- bufs[i] = _vector[i].iov_base;
|
|
|
|
|
|
+ for (i = 0; i < nr_segs; ++i)
|
|
|
|
+ bufs[i] = iov[i].iov_base;
|
|
result = snd_pcm_lib_readv(substream, bufs, frames);
|
|
result = snd_pcm_lib_readv(substream, bufs, frames);
|
|
if (result > 0)
|
|
if (result > 0)
|
|
result = frames_to_bytes(runtime, result);
|
|
result = frames_to_bytes(runtime, result);
|
|
@@ -2887,8 +2887,8 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
-static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
|
|
|
|
- unsigned long count, loff_t * offset)
|
|
|
|
|
|
+static ssize_t snd_pcm_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
|
|
|
+ unsigned long nr_segs, loff_t pos)
|
|
{
|
|
{
|
|
struct snd_pcm_file *pcm_file;
|
|
struct snd_pcm_file *pcm_file;
|
|
struct snd_pcm_substream *substream;
|
|
struct snd_pcm_substream *substream;
|
|
@@ -2898,7 +2898,7 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
|
|
void __user **bufs;
|
|
void __user **bufs;
|
|
snd_pcm_uframes_t frames;
|
|
snd_pcm_uframes_t frames;
|
|
|
|
|
|
- pcm_file = file->private_data;
|
|
|
|
|
|
+ pcm_file = iocb->ki_filp->private_data;
|
|
substream = pcm_file->substream;
|
|
substream = pcm_file->substream;
|
|
snd_assert(substream != NULL, result = -ENXIO; goto end);
|
|
snd_assert(substream != NULL, result = -ENXIO; goto end);
|
|
runtime = substream->runtime;
|
|
runtime = substream->runtime;
|
|
@@ -2906,17 +2906,17 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
|
|
result = -EBADFD;
|
|
result = -EBADFD;
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
- if (count > 128 || count != runtime->channels ||
|
|
|
|
- !frame_aligned(runtime, _vector->iov_len)) {
|
|
|
|
|
|
+ if (nr_segs > 128 || nr_segs != runtime->channels ||
|
|
|
|
+ !frame_aligned(runtime, iov->iov_len)) {
|
|
result = -EINVAL;
|
|
result = -EINVAL;
|
|
goto end;
|
|
goto end;
|
|
}
|
|
}
|
|
- frames = bytes_to_samples(runtime, _vector->iov_len);
|
|
|
|
- bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL);
|
|
|
|
|
|
+ frames = bytes_to_samples(runtime, iov->iov_len);
|
|
|
|
+ bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL);
|
|
if (bufs == NULL)
|
|
if (bufs == NULL)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
- for (i = 0; i < count; ++i)
|
|
|
|
- bufs[i] = _vector[i].iov_base;
|
|
|
|
|
|
+ for (i = 0; i < nr_segs; ++i)
|
|
|
|
+ bufs[i] = iov[i].iov_base;
|
|
result = snd_pcm_lib_writev(substream, bufs, frames);
|
|
result = snd_pcm_lib_writev(substream, bufs, frames);
|
|
if (result > 0)
|
|
if (result > 0)
|
|
result = frames_to_bytes(runtime, result);
|
|
result = frames_to_bytes(runtime, result);
|
|
@@ -3426,7 +3426,7 @@ struct file_operations snd_pcm_f_ops[2] = {
|
|
{
|
|
{
|
|
.owner = THIS_MODULE,
|
|
.owner = THIS_MODULE,
|
|
.write = snd_pcm_write,
|
|
.write = snd_pcm_write,
|
|
- .writev = snd_pcm_writev,
|
|
|
|
|
|
+ .aio_write = snd_pcm_aio_write,
|
|
.open = snd_pcm_playback_open,
|
|
.open = snd_pcm_playback_open,
|
|
.release = snd_pcm_release,
|
|
.release = snd_pcm_release,
|
|
.poll = snd_pcm_playback_poll,
|
|
.poll = snd_pcm_playback_poll,
|
|
@@ -3438,7 +3438,7 @@ struct file_operations snd_pcm_f_ops[2] = {
|
|
{
|
|
{
|
|
.owner = THIS_MODULE,
|
|
.owner = THIS_MODULE,
|
|
.read = snd_pcm_read,
|
|
.read = snd_pcm_read,
|
|
- .readv = snd_pcm_readv,
|
|
|
|
|
|
+ .aio_read = snd_pcm_aio_read,
|
|
.open = snd_pcm_capture_open,
|
|
.open = snd_pcm_capture_open,
|
|
.release = snd_pcm_release,
|
|
.release = snd_pcm_release,
|
|
.poll = snd_pcm_capture_poll,
|
|
.poll = snd_pcm_capture_poll,
|