Lines Matching refs:filp
370 flock_make_lock(struct file *filp, unsigned int cmd) in flock_make_lock() argument
382 fl->fl_file = filp; in flock_make_lock()
383 fl->fl_owner = filp; in flock_make_lock()
406 static int flock64_to_posix_lock(struct file *filp, struct file_lock *fl, in flock64_to_posix_lock() argument
414 fl->fl_start = filp->f_pos; in flock64_to_posix_lock()
417 fl->fl_start = i_size_read(file_inode(filp)); in flock64_to_posix_lock()
445 fl->fl_file = filp; in flock64_to_posix_lock()
456 static int flock_to_posix_lock(struct file *filp, struct file_lock *fl, in flock_to_posix_lock() argument
466 return flock64_to_posix_lock(filp, fl, &ll); in flock_to_posix_lock()
480 struct file *filp = fl->fl_file; in lease_setup() local
488 if (!fasync_insert_entry(fa->fa_fd, filp, &fl->fl_fasync, fa)) in lease_setup()
491 __f_setown(filp, task_pid(current), PIDTYPE_PID, 0); in lease_setup()
503 static int lease_init(struct file *filp, long type, struct file_lock *fl) in lease_init() argument
508 fl->fl_owner = filp; in lease_init()
511 fl->fl_file = filp; in lease_init()
521 static struct file_lock *lease_alloc(struct file *filp, long type) in lease_alloc() argument
529 error = lease_init(filp, type, fl); in lease_alloc()
759 posix_test_lock(struct file *filp, struct file_lock *fl) in posix_test_lock() argument
763 struct inode *inode = file_inode(filp); in posix_test_lock()
1158 int posix_lock_file(struct file *filp, struct file_lock *fl, in posix_lock_file() argument
1161 return __posix_lock_file(file_inode(filp), fl, conflock); in posix_lock_file()
1240 struct file *filp, loff_t offset, in locks_mandatory_area() argument
1249 fl.fl_file = filp; in locks_mandatory_area()
1251 if (filp && !(filp->f_flags & O_NONBLOCK)) in locks_mandatory_area()
1258 if (filp) { in locks_mandatory_area()
1259 fl.fl_owner = filp; in locks_mandatory_area()
1312 struct file *filp = fl->fl_file; in lease_modify() local
1314 f_delown(filp); in lease_modify()
1315 filp->f_owner.signum = 0; in lease_modify()
1542 int fcntl_getlease(struct file *filp) in fcntl_getlease() argument
1545 struct inode *inode = file_inode(filp); in fcntl_getlease()
1552 time_out_leases(file_inode(filp), &dispose); in fcntl_getlease()
1554 if (fl->fl_file != filp) in fcntl_getlease()
1595 generic_add_lease(struct file *filp, long arg, struct file_lock **flp, void **priv) in generic_add_lease() argument
1598 struct dentry *dentry = filp->f_path.dentry; in generic_add_lease()
1647 if (fl->fl_file == filp && in generic_add_lease()
1709 static int generic_delete_lease(struct file *filp, void *owner) in generic_delete_lease() argument
1713 struct dentry *dentry = filp->f_path.dentry; in generic_delete_lease()
1725 if (fl->fl_file == filp && in generic_delete_lease()
1750 int generic_setlease(struct file *filp, long arg, struct file_lock **flp, in generic_setlease() argument
1753 struct dentry *dentry = filp->f_path.dentry; in generic_setlease()
1761 error = security_file_lock(filp, arg); in generic_setlease()
1767 return generic_delete_lease(filp, *priv); in generic_setlease()
1775 return generic_add_lease(filp, arg, flp, priv); in generic_setlease()
1800 vfs_setlease(struct file *filp, long arg, struct file_lock **lease, void **priv) in vfs_setlease() argument
1802 if (filp->f_op->setlease) in vfs_setlease()
1803 return filp->f_op->setlease(filp, arg, lease, priv); in vfs_setlease()
1805 return generic_setlease(filp, arg, lease, priv); in vfs_setlease()
1809 static int do_fcntl_add_lease(unsigned int fd, struct file *filp, long arg) in do_fcntl_add_lease() argument
1815 fl = lease_alloc(filp, arg); in do_fcntl_add_lease()
1826 error = vfs_setlease(filp, arg, &fl, (void **)&new); in do_fcntl_add_lease()
1844 int fcntl_setlease(unsigned int fd, struct file *filp, long arg) in fcntl_setlease() argument
1847 return vfs_setlease(filp, F_UNLCK, NULL, (void **)&filp); in fcntl_setlease()
1848 return do_fcntl_add_lease(fd, filp, arg); in fcntl_setlease()
1952 int vfs_test_lock(struct file *filp, struct file_lock *fl) in vfs_test_lock() argument
1954 if (filp->f_op->lock) in vfs_test_lock()
1955 return filp->f_op->lock(filp, F_GETLK, fl); in vfs_test_lock()
1956 posix_test_lock(filp, fl); in vfs_test_lock()
1997 int fcntl_getlk(struct file *filp, unsigned int cmd, struct flock __user *l) in fcntl_getlk() argument
2010 error = flock_to_posix_lock(filp, &file_lock, &flock); in fcntl_getlk()
2021 file_lock.fl_owner = filp; in fcntl_getlk()
2024 error = vfs_test_lock(filp, &file_lock); in fcntl_getlk()
2076 int vfs_lock_file(struct file *filp, unsigned int cmd, struct file_lock *fl, struct file_lock *conf) in vfs_lock_file() argument
2078 if (filp->f_op->lock) in vfs_lock_file()
2079 return filp->f_op->lock(filp, cmd, fl); in vfs_lock_file()
2081 return posix_lock_file(filp, fl, conf); in vfs_lock_file()
2085 static int do_lock_file_wait(struct file *filp, unsigned int cmd, in do_lock_file_wait() argument
2090 error = security_file_lock(filp, fl->fl_type); in do_lock_file_wait()
2095 error = vfs_lock_file(filp, cmd, fl, NULL); in do_lock_file_wait()
2128 int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk() argument
2147 inode = file_inode(filp); in fcntl_setlk()
2152 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk()
2157 error = flock_to_posix_lock(filp, file_lock, &flock); in fcntl_setlk()
2177 file_lock->fl_owner = filp; in fcntl_setlk()
2186 file_lock->fl_owner = filp; in fcntl_setlk()
2192 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2207 if (f != filp) { in fcntl_setlk()
2209 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk()
2223 int fcntl_getlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l) in fcntl_getlk64() argument
2236 error = flock64_to_posix_lock(filp, &file_lock, &flock); in fcntl_getlk64()
2247 file_lock.fl_owner = filp; in fcntl_getlk64()
2250 error = vfs_test_lock(filp, &file_lock); in fcntl_getlk64()
2270 int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, in fcntl_setlk64() argument
2289 inode = file_inode(filp); in fcntl_setlk64()
2294 if (mandatory_lock(inode) && mapping_writably_mapped(filp->f_mapping)) { in fcntl_setlk64()
2299 error = flock64_to_posix_lock(filp, file_lock, &flock); in fcntl_setlk64()
2319 file_lock->fl_owner = filp; in fcntl_setlk64()
2328 file_lock->fl_owner = filp; in fcntl_setlk64()
2334 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2349 if (f != filp) { in fcntl_setlk64()
2351 error = do_lock_file_wait(filp, cmd, file_lock); in fcntl_setlk64()
2367 void locks_remove_posix(struct file *filp, fl_owner_t owner) in locks_remove_posix() argument
2370 struct file_lock_context *ctx = file_inode(filp)->i_flctx; in locks_remove_posix()
2386 lock.fl_file = filp; in locks_remove_posix()
2390 vfs_lock_file(filp, F_SETLK, &lock, NULL); in locks_remove_posix()
2400 locks_remove_flock(struct file *filp) in locks_remove_flock() argument
2403 .fl_owner = filp, in locks_remove_flock()
2405 .fl_file = filp, in locks_remove_flock()
2410 struct inode *inode = file_inode(filp); in locks_remove_flock()
2416 if (filp->f_op->flock) in locks_remove_flock()
2417 filp->f_op->flock(filp, F_SETLKW, &fl); in locks_remove_flock()
2427 locks_remove_lease(struct file *filp) in locks_remove_lease() argument
2429 struct inode *inode = file_inode(filp); in locks_remove_lease()
2439 if (filp == fl->fl_file) in locks_remove_lease()
2448 void locks_remove_file(struct file *filp) in locks_remove_file() argument
2450 if (!file_inode(filp)->i_flctx) in locks_remove_file()
2454 locks_remove_posix(filp, filp); in locks_remove_file()
2457 locks_remove_flock(filp); in locks_remove_file()
2460 locks_remove_lease(filp); in locks_remove_file()
2491 int vfs_cancel_lock(struct file *filp, struct file_lock *fl) in vfs_cancel_lock() argument
2493 if (filp->f_op->lock) in vfs_cancel_lock()
2494 return filp->f_op->lock(filp, F_CANCELLK, fl); in vfs_cancel_lock()
2602 struct file *filp, struct files_struct *files) in __show_fd_locks() argument
2608 if (filp != fl->fl_file) in __show_fd_locks()
2611 fl->fl_owner != filp) in __show_fd_locks()
2621 struct file *filp, struct files_struct *files) in show_fd_locks() argument
2623 struct inode *inode = file_inode(filp); in show_fd_locks()
2632 __show_fd_locks(f, &ctx->flc_flock, &id, filp, files); in show_fd_locks()
2633 __show_fd_locks(f, &ctx->flc_posix, &id, filp, files); in show_fd_locks()
2634 __show_fd_locks(f, &ctx->flc_lease, &id, filp, files); in show_fd_locks()
2671 static int locks_open(struct inode *inode, struct file *filp) in locks_open() argument
2673 return seq_open_private(filp, &locks_seq_operations, in locks_open()