Lines Matching refs:file

122 static int sock_mmap(struct file *file, struct vm_area_struct *vma);
124 static int sock_close(struct inode *inode, struct file *file);
125 static __poll_t sock_poll(struct file *file,
127 static long sock_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
129 static long compat_sock_ioctl(struct file *file,
132 static int sock_fasync(int fd, struct file *filp, int on);
133 static ssize_t sock_splice_read(struct file *file, loff_t *ppos,
136 static void sock_splice_eof(struct file *file);
139 static void sock_show_fdinfo(struct seq_file *m, struct file *f) in sock_show_fdinfo()
320 ei->socket.file = NULL; in sock_alloc_inode()
463 struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname) in sock_alloc_file()
465 struct file *file; in sock_alloc_file() local
470 file = alloc_file_pseudo(SOCK_INODE(sock), sock_mnt, dname, in sock_alloc_file()
473 if (IS_ERR(file)) { in sock_alloc_file()
475 return file; in sock_alloc_file()
478 file->f_mode |= FMODE_NOWAIT; in sock_alloc_file()
479 sock->file = file; in sock_alloc_file()
480 file->private_data = sock; in sock_alloc_file()
481 stream_open(SOCK_INODE(sock), file); in sock_alloc_file()
486 file_set_fsnotify_mode(file, FMODE_NONOTIFY_PERM); in sock_alloc_file()
487 return file; in sock_alloc_file()
493 struct file *newfile; in sock_map_fd()
517 struct socket *sock_from_file(struct file *file) in sock_from_file() argument
519 if (likely(file->f_op == &socket_file_ops)) in sock_from_file()
520 return file->private_data; /* set in sock_alloc_file */ in sock_from_file()
541 struct file *file; in sockfd_lookup() local
544 file = fget(fd); in sockfd_lookup()
545 if (!file) { in sockfd_lookup()
550 sock = sock_from_file(file); in sockfd_lookup()
553 fput(file); in sockfd_lookup()
660 if (!sock->file) { in __sock_release()
664 sock->file = NULL; in __sock_release()
1116 static ssize_t sock_splice_read(struct file *file, loff_t *ppos, in sock_splice_read() argument
1120 struct socket *sock = file->private_data; in sock_splice_read()
1125 return copy_splice_read(file, ppos, pipe, len, flags); in sock_splice_read()
1130 static void sock_splice_eof(struct file *file) in sock_splice_eof() argument
1132 struct socket *sock = file->private_data; in sock_splice_eof()
1142 struct file *file = iocb->ki_filp; in sock_read_iter() local
1143 struct socket *sock = file->private_data; in sock_read_iter()
1148 if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) in sock_read_iter()
1164 struct file *file = iocb->ki_filp; in sock_write_iter() local
1165 struct socket *sock = file->private_data; in sock_write_iter()
1173 if (file->f_flags & O_NONBLOCK || (iocb->ki_flags & IOCB_NOWAIT)) in sock_write_iter()
1265 static long sock_ioctl(struct file *file, unsigned cmd, unsigned long arg) in sock_ioctl() argument
1274 sock = file->private_data; in sock_ioctl()
1300 err = f_setown(sock->file, pid, 1); in sock_ioctl()
1304 err = put_user(f_getown(sock->file), in sock_ioctl()
1409 static __poll_t sock_poll(struct file *file, poll_table *wait) in sock_poll() argument
1411 struct socket *sock = file->private_data; in sock_poll()
1427 return ops->poll(file, sock, wait) | flag; in sock_poll()
1430 static int sock_mmap(struct file *file, struct vm_area_struct *vma) in sock_mmap() argument
1432 struct socket *sock = file->private_data; in sock_mmap()
1434 return READ_ONCE(sock->ops)->mmap(file, sock, vma); in sock_mmap()
1437 static int sock_close(struct inode *inode, struct file *filp) in sock_close()
1454 static int sock_fasync(int fd, struct file *filp, int on) in sock_fasync()
1691 struct file *__sys_socket_file(int family, int type, int protocol) in __sys_socket_file()
1756 struct file *newfile1, *newfile2; in __sys_socketpair()
1935 struct file *do_accept(struct file *file, struct proto_accept_arg *arg, in do_accept() argument
1940 struct file *newfile; in do_accept()
1945 sock = sock_from_file(file); in do_accept()
1971 arg->flags |= sock->file->f_flags; in do_accept()
1995 static int __sys_accept4_file(struct file *file, struct sockaddr __user *upeer_sockaddr, in __sys_accept4_file() argument
1999 struct file *newfile; in __sys_accept4_file()
2012 newfile = do_accept(file, &arg, upeer_sockaddr, upeer_addrlen, in __sys_accept4_file()
2069 int __sys_connect_file(struct file *file, struct sockaddr_storage *address, in __sys_connect_file() argument
2075 sock = sock_from_file(file); in __sys_connect_file()
2087 addrlen, sock->file->f_flags | file_flags); in __sys_connect_file()
2225 if (sock->file->f_flags & O_NONBLOCK) in __sys_sendto()
2276 if (sock->file->f_flags & O_NONBLOCK) in __sys_recvfrom()
2599 if (sock->file->f_flags & O_NONBLOCK) in ____sys_sendmsg()
2828 if (sock->file->f_flags & O_NONBLOCK) in ____sys_recvmsg()
3438 static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, in compat_sock_ioctl_trans() argument
3447 return sock_ioctl(file, cmd, (unsigned long)argp); in compat_sock_ioctl_trans()
3483 return sock_ioctl(file, cmd, arg); in compat_sock_ioctl_trans()
3535 static long compat_sock_ioctl(struct file *file, unsigned int cmd, in compat_sock_ioctl() argument
3538 struct socket *sock = file->private_data; in compat_sock_ioctl()
3555 ret = compat_sock_ioctl_trans(file, sock, cmd, arg); in compat_sock_ioctl()