drivers/iovec: revert vector io implement from loop/null/zero driver

basic driver does not need such complex wrapper

Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
chao an
2025-01-19 21:34:12 +08:00
committed by Xiang Xiao
parent 5918335b7f
commit 0ffb0b716e
3 changed files with 65 additions and 75 deletions
+15 -16
View File
@@ -40,8 +40,10 @@
* Private Function Prototypes
****************************************************************************/
static ssize_t loop_readv(FAR struct file *filep, FAR struct uio *uio);
static ssize_t loop_writev(FAR struct file *filep, FAR struct uio *uio);
static ssize_t loop_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static ssize_t loop_write(FAR struct file *filep, FAR const char *buffer,
size_t buflen);
static int loop_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
@@ -53,15 +55,15 @@ static const struct file_operations g_loop_fops =
{
NULL, /* open */
NULL, /* close */
NULL, /* read */
NULL, /* write */
loop_read, /* read */
loop_write, /* write */
NULL, /* seek */
loop_ioctl, /* ioctl */
NULL, /* mmap */
NULL, /* truncate */
NULL, /* poll */
loop_readv, /* readv */
loop_writev /* writev */
NULL, /* readv */
NULL /* writev */
};
/****************************************************************************
@@ -69,26 +71,23 @@ static const struct file_operations g_loop_fops =
****************************************************************************/
/****************************************************************************
* Name: loop_readv
* Name: loop_read
****************************************************************************/
static ssize_t loop_readv(FAR struct file *filep, FAR struct uio *uio)
static ssize_t loop_read(FAR struct file *filep, FAR char *buffer,
size_t len)
{
return 0; /* Return EOF */
}
/****************************************************************************
* Name: loop_writev
* Name: loop_write
****************************************************************************/
static ssize_t loop_writev(FAR struct file *filep, FAR struct uio *uio)
static ssize_t loop_write(FAR struct file *filep, FAR const char *buffer,
size_t len)
{
/* Say that everything was written */
size_t ret = uio->uio_resid;
uio_advance(uio, ret);
return ret;
return len; /* Say that everything was written */
}
/****************************************************************************