本文整理汇总了C++中do_readv_writev函数的典型用法代码示例。如果您正苦于以下问题:C++ do_readv_writev函数的具体用法?C++ do_readv_writev怎么用?C++ do_readv_writev使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_readv_writev函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: orangefs_file_write_iter
static ssize_t orangefs_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
{
struct file *file = iocb->ki_filp;
loff_t pos;
ssize_t rc;
BUG_ON(iocb->private);
gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_write_iter\n");
inode_lock(file->f_mapping->host);
/* Make sure generic_write_checks sees an up to date inode size. */
if (file->f_flags & O_APPEND) {
rc = orangefs_inode_getattr(file->f_mapping->host, 0, 1);
if (rc == -ESTALE)
rc = -EIO;
if (rc) {
gossip_err("%s: orangefs_inode_getattr failed, "
"rc:%zd:.\n", __func__, rc);
goto out;
}
}
if (file->f_pos > i_size_read(file->f_mapping->host))
orangefs_i_size_write(file->f_mapping->host, file->f_pos);
rc = generic_write_checks(iocb, iter);
if (rc <= 0) {
gossip_err("%s: generic_write_checks failed, rc:%zd:.\n",
__func__, rc);
goto out;
}
/*
* if we are appending, generic_write_checks would have updated
* pos to the end of the file, so we will wait till now to set
* pos...
*/
pos = *(&iocb->ki_pos);
rc = do_readv_writev(ORANGEFS_IO_WRITE,
file,
&pos,
iter);
if (rc < 0) {
gossip_err("%s: do_readv_writev failed, rc:%zd:.\n",
__func__, rc);
goto out;
}
iocb->ki_pos = pos;
g_orangefs_stats.writes++;
out:
inode_unlock(file->f_mapping->host);
return rc;
}
示例2: vfs_readv
ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
unsigned long vlen, loff_t *pos)
{
if (!(file->f_mode & FMODE_READ))
return -EBADF;
if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
return -EINVAL;
return do_readv_writev(READ, file, vec, vlen, pos);
}
示例3: vfs_readv
ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
unsigned long vlen, loff_t *pos, int flags)
{
if (!(file->f_mode & FMODE_READ))
return -EBADF;
if (!(file->f_mode & FMODE_CAN_READ))
return -EINVAL;
return do_readv_writev(READ, file, vec, vlen, pos, flags);
}
示例4: sys_readv
asmlinkage int sys_readv(unsigned long fd, const struct iovec * vector, long count)
{
struct file * file;
struct inode * inode;
if (fd >= NR_OPEN || !(file = current->files->fd[fd]) || !(inode = file->f_inode))
return -EBADF;
if (!(file->f_mode & 1))
return -EBADF;
return do_readv_writev(VERIFY_WRITE, inode, file, vector, count);
}
示例5: sys_writev
asmlinkage int sys_writev(unsigned long fd, const struct iovec * vector, long count)
{
int error;
struct file * file;
struct inode * inode;
if (fd >= NR_OPEN || !(file = current->files->fd[fd]) || !(inode = file->f_inode))
return -EBADF;
if (!(file->f_mode & 2))
return -EBADF;
down(&inode->i_sem);
error = do_readv_writev(VERIFY_READ, inode, file, vector, count);
up(&inode->i_sem);
return error;
}
示例6: orangefs_file_read_iter
static ssize_t orangefs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
{
struct file *file = iocb->ki_filp;
loff_t pos = *(&iocb->ki_pos);
ssize_t rc = 0;
BUG_ON(iocb->private);
gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_read_iter\n");
g_orangefs_stats.reads++;
rc = do_readv_writev(ORANGEFS_IO_READ, file, &pos, iter);
iocb->ki_pos = pos;
return rc;
}
示例7: sys_readv
asmlinkage ssize_t sys_readv(unsigned long fd, const struct iovec * vector,
unsigned long count)
{
struct file * file;
struct vms_fd * vms_fd;
ssize_t ret;
ret = -EBADF;
vms_fd = fget(fd);
file = vms_fd->vfd$l_fd_p;
if (!file)
goto bad_file;
if (file->f_op && (file->f_mode & FMODE_READ) &&
(file->f_op->readv || file->f_op->read))
ret = do_readv_writev(VERIFY_WRITE, file, vector, count);
fput(file);
bad_file:
return ret;
}