aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-08-22 10:18:44 -0400
committerJeff Layton <jlayton@primarydata.com>2014-09-09 16:01:09 -0400
commit699688a416524c3cea9eafaca69fc6c06c13c02e (patch)
tree3ece46a475ab54135bbcd01d97a563c52a1f2eaa /fs
parent09802fd2a8caea2a2147fca8d7975697c5de573d (diff)
locks: remove lock_may_read and lock_may_write
There are no callers of these functions. Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/locks.c80
1 files changed, 0 insertions, 80 deletions
diff --git a/fs/locks.c b/fs/locks.c
index c3991dc80137..5200ffd2ba9b 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2597,86 +2597,6 @@ static int __init proc_locks_init(void)
2597module_init(proc_locks_init); 2597module_init(proc_locks_init);
2598#endif 2598#endif
2599 2599
2600/**
2601 * lock_may_read - checks that the region is free of locks
2602 * @inode: the inode that is being read
2603 * @start: the first byte to read
2604 * @len: the number of bytes to read
2605 *
2606 * Emulates Windows locking requirements. Whole-file
2607 * mandatory locks (share modes) can prohibit a read and
2608 * byte-range POSIX locks can prohibit a read if they overlap.
2609 *
2610 * N.B. this function is only ever called
2611 * from knfsd and ownership of locks is never checked.
2612 */
2613int lock_may_read(struct inode *inode, loff_t start, unsigned long len)
2614{
2615 struct file_lock *fl;
2616 int result = 1;
2617
2618 spin_lock(&inode->i_lock);
2619 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
2620 if (IS_POSIX(fl)) {
2621 if (fl->fl_type == F_RDLCK)
2622 continue;
2623 if ((fl->fl_end < start) || (fl->fl_start > (start + len)))
2624 continue;
2625 } else if (IS_FLOCK(fl)) {
2626 if (!(fl->fl_type & LOCK_MAND))
2627 continue;
2628 if (fl->fl_type & LOCK_READ)
2629 continue;
2630 } else
2631 continue;
2632 result = 0;
2633 break;
2634 }
2635 spin_unlock(&inode->i_lock);
2636 return result;
2637}
2638
2639EXPORT_SYMBOL(lock_may_read);
2640
2641/**
2642 * lock_may_write - checks that the region is free of locks
2643 * @inode: the inode that is being written
2644 * @start: the first byte to write
2645 * @len: the number of bytes to write
2646 *
2647 * Emulates Windows locking requirements. Whole-file
2648 * mandatory locks (share modes) can prohibit a write and
2649 * byte-range POSIX locks can prohibit a write if they overlap.
2650 *
2651 * N.B. this function is only ever called
2652 * from knfsd and ownership of locks is never checked.
2653 */
2654int lock_may_write(struct inode *inode, loff_t start, unsigned long len)
2655{
2656 struct file_lock *fl;
2657 int result = 1;
2658
2659 spin_lock(&inode->i_lock);
2660 for (fl = inode->i_flock; fl != NULL; fl = fl->fl_next) {
2661 if (IS_POSIX(fl)) {
2662 if ((fl->fl_end < start) || (fl->fl_start > (start + len)))
2663 continue;
2664 } else if (IS_FLOCK(fl)) {
2665 if (!(fl->fl_type & LOCK_MAND))
2666 continue;
2667 if (fl->fl_type & LOCK_WRITE)
2668 continue;
2669 } else
2670 continue;
2671 result = 0;
2672 break;
2673 }
2674 spin_unlock(&inode->i_lock);
2675 return result;
2676}
2677
2678EXPORT_SYMBOL(lock_may_write);
2679
2680static int __init filelock_init(void) 2600static int __init filelock_init(void)
2681{ 2601{
2682 int i; 2602 int i;