#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/sched/xacct.h>
#include <linux/fcntl.h>
#include <linux/file.h>
#include <linux/uio.h>
#include <linux/fsnotify.h>
#include <linux/security.h>
#include <linux/export.h>
#include <linux/syscalls.h>
#include <linux/pagemap.h>
#include <linux/splice.h>
#include <linux/compat.h>
#include <linux/mount.h>
#include <linux/fs.h>
#include "internal.h"
#include <linux/uaccess.h>
#include <asm/unistd.h>
const struct file_operations generic_ro_fops = …;
EXPORT_SYMBOL(…);
static inline bool unsigned_offsets(struct file *file)
{ … }
loff_t vfs_setpos(struct file *file, loff_t offset, loff_t maxsize)
{ … }
EXPORT_SYMBOL(…);
loff_t
generic_file_llseek_size(struct file *file, loff_t offset, int whence,
loff_t maxsize, loff_t eof)
{ … }
EXPORT_SYMBOL(…);
loff_t generic_file_llseek(struct file *file, loff_t offset, int whence)
{ … }
EXPORT_SYMBOL(…);
loff_t fixed_size_llseek(struct file *file, loff_t offset, int whence, loff_t size)
{ … }
EXPORT_SYMBOL(…);
loff_t no_seek_end_llseek(struct file *file, loff_t offset, int whence)
{ … }
EXPORT_SYMBOL(…);
loff_t no_seek_end_llseek_size(struct file *file, loff_t offset, int whence, loff_t size)
{ … }
EXPORT_SYMBOL(…);
loff_t noop_llseek(struct file *file, loff_t offset, int whence)
{ … }
EXPORT_SYMBOL(…);
loff_t default_llseek(struct file *file, loff_t offset, int whence)
{ … }
EXPORT_SYMBOL(…);
loff_t vfs_llseek(struct file *file, loff_t offset, int whence)
{ … }
EXPORT_SYMBOL(…);
static off_t ksys_lseek(unsigned int fd, off_t offset, unsigned int whence)
{ … }
SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence)
{ … }
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE3(lseek, unsigned int, fd, compat_off_t, offset, unsigned int, whence)
{ … }
#endif
#if !defined(CONFIG_64BIT) || defined(CONFIG_COMPAT) || \
defined(__ARCH_WANT_SYS_LLSEEK)
SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
unsigned long, offset_low, loff_t __user *, result,
unsigned int, whence)
{ … }
#endif
int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count)
{ … }
EXPORT_SYMBOL(…);
static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, loff_t *ppos)
{ … }
static int warn_unsupported(struct file *file, const char *op)
{ … }
ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
{ … }
ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
{ … }
EXPORT_SYMBOL(…);
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{ … }
static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t len, loff_t *ppos)
{ … }
ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *pos)
{ … }
ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t *pos)
{ … }
EXPORT_SYMBOL_GPL(…);
ssize_t kernel_write(struct file *file, const void *buf, size_t count,
loff_t *pos)
{ … }
EXPORT_SYMBOL(…);
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
{ … }
static inline loff_t *file_ppos(struct file *file)
{ … }
ssize_t ksys_read(unsigned int fd, char __user *buf, size_t count)
{ … }
SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
{ … }
ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count)
{ … }
SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
size_t, count)
{ … }
ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count,
loff_t pos)
{ … }
SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf,
size_t, count, loff_t, pos)
{ … }
#if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_PREAD64)
COMPAT_SYSCALL_DEFINE5(pread64, unsigned int, fd, char __user *, buf,
size_t, count, compat_arg_u64_dual(pos))
{
return ksys_pread64(fd, buf, count, compat_arg_u64_glue(pos));
}
#endif
ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf,
size_t count, loff_t pos)
{ … }
SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
size_t, count, loff_t, pos)
{ … }
#if defined(CONFIG_COMPAT) && defined(__ARCH_WANT_COMPAT_PWRITE64)
COMPAT_SYSCALL_DEFINE5(pwrite64, unsigned int, fd, const char __user *, buf,
size_t, count, compat_arg_u64_dual(pos))
{
return ksys_pwrite64(fd, buf, count, compat_arg_u64_glue(pos));
}
#endif
static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
loff_t *ppos, int type, rwf_t flags)
{ … }
static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter,
loff_t *ppos, int type, rwf_t flags)
{ … }
ssize_t vfs_iocb_iter_read(struct file *file, struct kiocb *iocb,
struct iov_iter *iter)
{ … }
EXPORT_SYMBOL(…);
ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos,
rwf_t flags)
{ … }
EXPORT_SYMBOL(…);
ssize_t vfs_iocb_iter_write(struct file *file, struct kiocb *iocb,
struct iov_iter *iter)
{ … }
EXPORT_SYMBOL(…);
ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos,
rwf_t flags)
{ … }
EXPORT_SYMBOL(…);
static ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
unsigned long vlen, loff_t *pos, rwf_t flags)
{ … }
static ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
unsigned long vlen, loff_t *pos, rwf_t flags)
{ … }
static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec,
unsigned long vlen, rwf_t flags)
{ … }
static ssize_t do_writev(unsigned long fd, const struct iovec __user *vec,
unsigned long vlen, rwf_t flags)
{ … }
static inline loff_t pos_from_hilo(unsigned long high, unsigned long low)
{ … }
static ssize_t do_preadv(unsigned long fd, const struct iovec __user *vec,
unsigned long vlen, loff_t pos, rwf_t flags)
{ … }
static ssize_t do_pwritev(unsigned long fd, const struct iovec __user *vec,
unsigned long vlen, loff_t pos, rwf_t flags)
{ … }
SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen)
{ … }
SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen)
{ … }
SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)
{ … }
SYSCALL_DEFINE6(preadv2, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h,
rwf_t, flags)
{ … }
SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)
{ … }
SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec,
unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h,
rwf_t, flags)
{ … }
#ifdef CONFIG_COMPAT
#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
const struct iovec __user *, vec,
unsigned long, vlen, loff_t, pos)
{ … }
#endif
COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
const struct iovec __user *, vec,
compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
{ … }
#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
const struct iovec __user *, vec,
unsigned long, vlen, loff_t, pos, rwf_t, flags)
{ … }
#endif
COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
const struct iovec __user *, vec,
compat_ulong_t, vlen, u32, pos_low, u32, pos_high,
rwf_t, flags)
{ … }
#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64
COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
const struct iovec __user *, vec,
unsigned long, vlen, loff_t, pos)
{ … }
#endif
COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
const struct iovec __user *,vec,
compat_ulong_t, vlen, u32, pos_low, u32, pos_high)
{ … }
#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
COMPAT_SYSCALL_DEFINE5(pwritev64v2, unsigned long, fd,
const struct iovec __user *, vec,
unsigned long, vlen, loff_t, pos, rwf_t, flags)
{ … }
#endif
COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
const struct iovec __user *,vec,
compat_ulong_t, vlen, u32, pos_low, u32, pos_high, rwf_t, flags)
{ … }
#endif
static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
size_t count, loff_t max)
{ … }
SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
{ … }
SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count)
{ … }
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd,
compat_off_t __user *, offset, compat_size_t, count)
{ … }
COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd,
compat_loff_t __user *, offset, compat_size_t, count)
{ … }
#endif
static int generic_copy_file_checks(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
size_t *req_count, unsigned int flags)
{ … }
ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in,
struct file *file_out, loff_t pos_out,
size_t len, unsigned int flags)
{ … }
EXPORT_SYMBOL(…);
SYSCALL_DEFINE6(copy_file_range, int, fd_in, loff_t __user *, off_in,
int, fd_out, loff_t __user *, off_out,
size_t, len, unsigned int, flags)
{ … }
int generic_write_check_limits(struct file *file, loff_t pos, loff_t *count)
{ … }
EXPORT_SYMBOL_GPL(…);
int generic_write_checks_count(struct kiocb *iocb, loff_t *count)
{ … }
EXPORT_SYMBOL(…);
ssize_t generic_write_checks(struct kiocb *iocb, struct iov_iter *from)
{ … }
EXPORT_SYMBOL(…);
int generic_file_rw_checks(struct file *file_in, struct file *file_out)
{ … }
bool generic_atomic_write_valid(struct iov_iter *iter, loff_t pos)
{ … }