aboutsummaryrefslogtreecommitdiffstats
path: root/old/e.patch
blob: ef62199b0ba9d36273f3ec9ed5bb70b92902c3f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
---
 drivers/staging/exfat/exfat_super.c |   40 ++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 22 deletions(-)

--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -382,7 +382,7 @@ static long exfat_generic_ioctl(struct f
 {
 #if EXFAT_CONFIG_KERNEL_DEBUG
 #if !(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
-	struct inode *inode = filp->f_dentry->d_inode;
+	struct inode *inode = file_inode(filp);
 #endif
 	unsigned int flags;
 #endif
@@ -838,7 +838,8 @@ out:
 }
 
 static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
-						struct inode *new_dir, struct dentry *new_dentry)
+			struct inode *new_dir, struct dentry *new_dentry,
+			unsigned int flags)
 {
 	struct inode *old_inode, *new_inode;
 	struct super_block *sb = old_dir->i_sb;
@@ -846,6 +847,9 @@ static int exfat_rename(struct inode *ol
 	loff_t i_pos;
 	int err;
 
+	if (flags & ~RENAME_NOREPLACE)
+		return -EINVAL;
+
 	__lock_super(sb);
 
 	PRINTK("exfat_rename entered\n");
@@ -1011,7 +1015,7 @@ static int exfat_setattr(struct dentry *
 		attr->ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET);
 	}
 
-	error = inode_change_ok(inode, attr);
+	error = setattr_prepare(dentry, attr);
 	attr->ia_valid = ia_valid;
 	if (error) {
 		return error;
@@ -1334,32 +1338,24 @@ static int exfat_write_end(struct file *
 	return err;
 }
 
-static ssize_t exfat_direct_IO(int rw, struct kiocb *iocb,
-					   const struct iovec *iov,
-					   loff_t offset, unsigned long nr_segs)
+static ssize_t exfat_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 {
-	struct inode *inode = iocb->ki_filp->f_mapping->host;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34)
-	struct address_space *mapping = iocb->ki_filp->f_mapping;
-#endif
+	struct file *file = iocb->ki_filep;
+	struct address_space *mapping = file->f_mapping;
+	struct inode *inode = mapping->host;
+	size_t count = iov_iter_count(iter);
+	loff_t offset = iocb->ki_pos;
 	ssize_t ret;
 
-	if (rw == WRITE) {
-		if (EXFAT_I(inode)->mmu_private < (offset + iov_length(iov, nr_segs)))
+	if (iov_iter_rw(iter) == WRITE) {
+		loff_t size = offset + count
+		if (EXFAT_I(inode)->mmu_private < size)
 			return 0;
 	}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,00)
-	ret = blockdev_direct_IO(rw, iocb, inode, iov,
-					offset, nr_segs, exfat_get_block);
-#else
-        ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
-					offset, nr_segs, exfat_get_block, NULL);
-#endif
+	ret = blockdev_direct_IO(iocb, inode, iter, exfat_get_block);
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,34)
-	if ((ret < 0) && (rw & WRITE))
+	if ((ret < 0) && (iov_iter_rw(iter) == WRITE))
 		exfat_write_failed(mapping, offset+iov_length(iov, nr_segs));
-#endif
 	return ret;
 
 }