]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - sound/core/pcm_native.c
[PATCH] Remove readv/writev methods and use aio_read/aio_write instead
[net-next-2.6.git] / sound / core / pcm_native.c
index 891d7140553cbc32111a3b3573b4707debde4c8d..37b4b10850ae0358cdbbf654fffd6754aa5a11d4 100644 (file)
@@ -2852,8 +2852,8 @@ static ssize_t snd_pcm_write(struct file *file, const char __user *buf,
        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;
@@ -2864,22 +2864,22 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector,
        void __user **bufs;
        snd_pcm_uframes_t frames;
 
-       pcm_file = file->private_data;
+       pcm_file = iocb->ki_filp->private_data;
        substream = pcm_file->substream;
        snd_assert(substream != NULL, return -ENXIO);
        runtime = substream->runtime;
        if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
                return -EBADFD;
-       if (count > 1024 || count != runtime->channels)
+       if (nr_segs > 1024 || nr_segs != runtime->channels)
                return -EINVAL;
-       if (!frame_aligned(runtime, _vector->iov_len))
+       if (!frame_aligned(runtime, iov->iov_len))
                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)
                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);
        if (result > 0)
                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;
 }
 
-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_substream *substream;
@@ -2898,7 +2898,7 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
        void __user **bufs;
        snd_pcm_uframes_t frames;
 
-       pcm_file = file->private_data;
+       pcm_file = iocb->ki_filp->private_data;
        substream = pcm_file->substream;
        snd_assert(substream != NULL, result = -ENXIO; goto end);
        runtime = substream->runtime;
@@ -2906,17 +2906,17 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector,
                result = -EBADFD;
                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;
                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)
                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);
        if (result > 0)
                result = frames_to_bytes(runtime, result);
@@ -3426,7 +3426,7 @@ struct file_operations snd_pcm_f_ops[2] = {
        {
                .owner =                THIS_MODULE,
                .write =                snd_pcm_write,
-               .writev =               snd_pcm_writev,
+               .aio_write =            snd_pcm_aio_write,
                .open =                 snd_pcm_playback_open,
                .release =              snd_pcm_release,
                .poll =                 snd_pcm_playback_poll,
@@ -3438,7 +3438,7 @@ struct file_operations snd_pcm_f_ops[2] = {
        {
                .owner =                THIS_MODULE,
                .read =                 snd_pcm_read,
-               .readv =                snd_pcm_readv,
+               .aio_read =             snd_pcm_aio_read,
                .open =                 snd_pcm_capture_open,
                .release =              snd_pcm_release,
                .poll =                 snd_pcm_capture_poll,