Lines Matching refs:filp
374 flock_make_lock(struct file *filp, unsigned int cmd) in flock_make_lock() argument
386 fl->fl_file = filp; in flock_make_lock()
387 fl->fl_owner = filp; in flock_make_lock()
410 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
418 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
421 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
449 fl->fl_file = filp; in flock64_to_posix_lock()
460 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
470 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
484 struct file *filp = fl->fl_file; in lease_setup() local
492 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
495 __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); in lease_setup()
507 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init() argument
512 fl->fl_owner = filp; in lease_init()
515 fl->fl_file = filp; in lease_init()
525 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc() argument
533 error = lease_init(filp, type, fl); in lease_alloc()
763 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
767 struct inode *inode = file_inode(filp); in posix_test_lock()
1162 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1165 return __posix_lock_file(file_inode(filp), fl, conflock); in posix_lock_file()
1242 struct file *filp, loff_t offset, in locks_mandatory_area() argument
1251 fl.fl_file = filp; in locks_mandatory_area()
1253 if (filp && !(filp->f_flags & O_NONBLOCK)) in locks_mandatory_area()
1260 if (filp) { in locks_mandatory_area()
1261 fl.fl_owner = filp; in locks_mandatory_area()
1314 struct file *filp = fl->fl_file; in lease_modify() local
1316 f_delown(filp); in lease_modify()
1317 filp->f_owner.signum = 0; in lease_modify()
1546 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1549 struct inode *inode = file_inode(filp); in fcntl_getlease()
1557 time_out_leases(file_inode(filp), &dispose); in fcntl_getlease()
1559 if (fl->fl_file != filp) in fcntl_getlease()
1601 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1604 struct dentry *dentry = filp->f_path.dentry; in generic_add_lease()
1653 if (fl->fl_file == filp && in generic_add_lease()
1715 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1719 struct inode *inode = file_inode(filp); in generic_delete_lease()
1731 if (fl->fl_file == filp && in generic_delete_lease()
1756 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1759 struct inode *inode = file_inode(filp); in generic_setlease()
1766 error = security_file_lock(filp, arg); in generic_setlease()
1772 return generic_delete_lease(filp, *priv); in generic_setlease()
1780 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1805 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1807 if (filp->f_op->setlease) in vfs_setlease()
1808 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1810 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1814 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
1820 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1831 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
1849 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
1852 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
1853 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
1980 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
1982 if (filp->f_op->lock) in vfs_test_lock()
1983 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
1984 posix_test_lock(filp, fl); in vfs_test_lock()
2025 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock __user *l) in fcntl_getlk() argument
2038 error = flock_to_posix_lock(filp, &file_lock, &flock); in fcntl_getlk()
2049 file_lock.fl_owner = filp; in fcntl_getlk()
2052 error = vfs_test_lock(filp, &file_lock); in fcntl_getlk()
2104 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2106 if (filp->f_op->lock) in vfs_lock_file()
2107 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2109 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2113 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2118 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2123 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2156 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2175 inode = file_inode(filp); in fcntl_setlk()
2180 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk()
2185 error = flock_to_posix_lock(filp, file_lock, &flock); in fcntl_setlk()
2205 file_lock->fl_owner = filp; in fcntl_setlk()
2214 file_lock->fl_owner = filp; in fcntl_setlk()
2220 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2235 if (f != filp) { in fcntl_setlk()
2237 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2251 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l) in fcntl_getlk64() argument
2264 error = flock64_to_posix_lock(filp, &file_lock, &flock); in fcntl_getlk64()
2275 file_lock.fl_owner = filp; in fcntl_getlk64()
2278 error = vfs_test_lock(filp, &file_lock); in fcntl_getlk64()
2298 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2317 inode = file_inode(filp); in fcntl_setlk64()
2322 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk64()
2327 error = flock64_to_posix_lock(filp, file_lock, &flock); in fcntl_setlk64()
2347 file_lock->fl_owner = filp; in fcntl_setlk64()
2356 file_lock->fl_owner = filp; in fcntl_setlk64()
2362 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2377 if (f != filp) { in fcntl_setlk64()
2379 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2395 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2405 ctx = smp_load_acquire(&file_inode(filp)->i_flctx); in locks_remove_posix()
2415 lock.fl_file = filp; in locks_remove_posix()
2419 vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2429 locks_remove_flock(struct file *filp, struct file_lock_context *flctx) in locks_remove_flock() argument
2432 .fl_owner = filp, in locks_remove_flock()
2434 .fl_file = filp, in locks_remove_flock()
2439 struct inode *inode = file_inode(filp); in locks_remove_flock()
2444 if (filp->f_op->flock) in locks_remove_flock()
2445 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2455 locks_remove_lease(struct file *filp, struct file_lock_context *ctx) in locks_remove_lease() argument
2465 if (filp == fl->fl_file) in locks_remove_lease()
2474 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2478 ctx = smp_load_acquire(&file_inode(filp)->i_flctx); in locks_remove_file()
2483 locks_remove_posix(filp, filp); in locks_remove_file()
2486 locks_remove_flock(filp, ctx); in locks_remove_file()
2489 locks_remove_lease(filp, ctx); in locks_remove_file()
2520 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2522 if (filp->f_op->lock) in vfs_cancel_lock()
2523 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2631 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2637 if (filp != fl->fl_file) in __show_fd_locks()
2640 fl->fl_owner != filp) in __show_fd_locks()
2650 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2652 struct inode *inode = file_inode(filp); in show_fd_locks()
2661 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2662 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2663 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()
2700 static int locks_open(struct inode *inode, struct file *filp) in locks_open() argument
2702 return seq_open_private(filp, &locks_seq_operations, in locks_open()