summaryrefslogtreecommitdiff
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2015-12-03 14:59:49 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-12-08 07:09:16 +0300
commitacc15575e78e534c12549d8057a692f490a50f61 (patch)
treea177119e84264c8a8db1e04090f97a7335ccfc69 /include/linux/fs.h
parenteac70053a141998c40907747d6cea1d53a9414be (diff)
downloadlinux-acc15575e78e534c12549d8057a692f490a50f61.tar.xz
locks: new locks_mandatory_area calling convention
Pass a loff_t end for the last byte instead of the 32-bit count parameter to allow full file clones even on 32-bit architectures. While we're at it also simplify the read/write selection. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: J. Bruce Fields <bfields@fieldses.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h30
1 files changed, 14 insertions, 16 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index e8a736242b1a..4377b2df991d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2030,12 +2030,9 @@ extern struct kobject *fs_kobj;
#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
-#define FLOCK_VERIFY_READ 1
-#define FLOCK_VERIFY_WRITE 2
-
#ifdef CONFIG_FILE_LOCKING
extern int locks_mandatory_locked(struct file *);
-extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
+extern int locks_mandatory_area(struct inode *, struct file *, loff_t, loff_t, unsigned char);
/*
* Candidates for mandatory locking have the setgid bit set
@@ -2065,17 +2062,19 @@ static inline int locks_verify_locked(struct file *file)
}
static inline int locks_verify_truncate(struct inode *inode,
- struct file *filp,
+ struct file *f,
loff_t size)
{
- if (inode->i_flctx && mandatory_lock(inode))
- return locks_mandatory_area(
- FLOCK_VERIFY_WRITE, inode, filp,
- size < inode->i_size ? size : inode->i_size,
- (size < inode->i_size ? inode->i_size - size
- : size - inode->i_size)
- );
- return 0;
+ if (!inode->i_flctx || !mandatory_lock(inode))
+ return 0;
+
+ if (size < inode->i_size) {
+ return locks_mandatory_area(inode, f, size, inode->i_size - 1,
+ F_WRLCK);
+ } else {
+ return locks_mandatory_area(inode, f, inode->i_size, size - 1,
+ F_WRLCK);
+ }
}
static inline int break_lease(struct inode *inode, unsigned int mode)
@@ -2144,9 +2143,8 @@ static inline int locks_mandatory_locked(struct file *file)
return 0;
}
-static inline int locks_mandatory_area(int rw, struct inode *inode,
- struct file *filp, loff_t offset,
- size_t count)
+static inline int locks_mandatory_area(struct inode *inode, struct file *filp,
+ loff_t start, loff_t end, unsigned char type)
{
return 0;
}