Lines Matching refs:filp
36 static long vfs_ioctl(struct file *filp, unsigned int cmd, in vfs_ioctl() argument
41 if (!filp->f_op) in vfs_ioctl()
44 if (filp->f_op->unlocked_ioctl) { in vfs_ioctl()
45 error = filp->f_op->unlocked_ioctl(filp, cmd, arg); in vfs_ioctl()
49 } else if (filp->f_op->ioctl) { in vfs_ioctl()
51 error = filp->f_op->ioctl(filp->f_path.dentry->d_inode, in vfs_ioctl()
52 filp, cmd, arg); in vfs_ioctl()
60 static int ioctl_fibmap(struct file *filp, int __user *p) in ioctl_fibmap() argument
62 struct address_space *mapping = filp->f_mapping; in ioctl_fibmap()
184 static int ioctl_fiemap(struct file *filp, unsigned long arg) in ioctl_fiemap() argument
188 struct inode *inode = filp->f_path.dentry->d_inode; in ioctl_fiemap()
373 static int file_ioctl(struct file *filp, unsigned int cmd, in file_ioctl() argument
376 struct inode *inode = filp->f_path.dentry->d_inode; in file_ioctl()
381 return ioctl_fibmap(filp, p); in file_ioctl()
383 return ioctl_fiemap(filp, arg); in file_ioctl()
387 return put_user(i_size_read(inode) - filp->f_pos, p); in file_ioctl()
390 return vfs_ioctl(filp, cmd, arg); in file_ioctl()
393 static int ioctl_fionbio(struct file *filp, int __user *argp) in ioctl_fionbio() argument
408 filp->f_flags |= flag; in ioctl_fionbio()
410 filp->f_flags &= ~flag; in ioctl_fionbio()
414 static int ioctl_fioasync(unsigned int fd, struct file *filp, in ioctl_fioasync() argument
426 if ((flag ^ filp->f_flags) & FASYNC) { in ioctl_fioasync()
427 if (filp->f_op && filp->f_op->fasync) in ioctl_fioasync()
428 error = filp->f_op->fasync(fd, filp, on); in ioctl_fioasync()
436 filp->f_flags |= FASYNC; in ioctl_fioasync()
438 filp->f_flags &= ~FASYNC; in ioctl_fioasync()
442 static int ioctl_fsfreeze(struct file *filp) in ioctl_fsfreeze() argument
444 struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; in ioctl_fsfreeze()
464 static int ioctl_fsthaw(struct file *filp) in ioctl_fsthaw() argument
466 struct super_block *sb = filp->f_path.dentry->d_inode->i_sb; in ioctl_fsthaw()
486 int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, in do_vfs_ioctl() argument
504 error = ioctl_fionbio(filp, argp); in do_vfs_ioctl()
511 error = ioctl_fioasync(fd, filp, argp); in do_vfs_ioctl()
516 if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) || in do_vfs_ioctl()
517 S_ISREG(filp->f_path.dentry->d_inode->i_mode) || in do_vfs_ioctl()
518 S_ISLNK(filp->f_path.dentry->d_inode->i_mode)) { in do_vfs_ioctl()
520 inode_get_bytes(filp->f_path.dentry->d_inode); in do_vfs_ioctl()
528 error = ioctl_fsfreeze(filp); in do_vfs_ioctl()
532 error = ioctl_fsthaw(filp); in do_vfs_ioctl()
536 if (S_ISREG(filp->f_path.dentry->d_inode->i_mode)) in do_vfs_ioctl()
537 error = file_ioctl(filp, cmd, arg); in do_vfs_ioctl()
539 error = vfs_ioctl(filp, cmd, arg); in do_vfs_ioctl()
547 struct file *filp; in SYSCALL_DEFINE3() local
551 filp = fget_light(fd, &fput_needed); in SYSCALL_DEFINE3()
552 if (!filp) in SYSCALL_DEFINE3()
555 error = security_file_ioctl(filp, cmd, arg); in SYSCALL_DEFINE3()
559 error = do_vfs_ioctl(filp, fd, cmd, arg); in SYSCALL_DEFINE3()
561 fput_light(filp, fput_needed); in SYSCALL_DEFINE3()