aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2012-11-10 10:55:56 -0500
committerMiklos Szeredi <mszeredi@suse.cz>2013-01-24 10:21:28 -0500
commitfb05f41f5f96f7423c53da4d87913fb44fd0565d (patch)
treed3cad72fea5e2b58b8bfa65aa3568e3617507234
parent5565a9d884327ac45d49041f1b846dac273e110c (diff)
fuse: cleanup fuse_direct_io()
Fix the following sparse warnings: fs/fuse/file.c:1216:43: warning: cast removes address space of expression fs/fuse/file.c:1216:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1216:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1216:43: got void *<noident> fs/fuse/file.c:1241:43: warning: cast removes address space of expression fs/fuse/file.c:1241:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1241:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1241:43: got void *<noident> fs/fuse/file.c:1267:43: warning: cast removes address space of expression fs/fuse/file.c:1267:43: warning: incorrect type in initializer (different address spaces) fs/fuse/file.c:1267:43: expected void [noderef] <asn:1>*iov_base fs/fuse/file.c:1267:43: got void *<noident> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
-rw-r--r--fs/fuse/cuse.c7
-rw-r--r--fs/fuse/file.c23
-rw-r--r--fs/fuse/fuse_i.h5
3 files changed, 16 insertions, 19 deletions
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index fb9dcfdf040b..6f96a8def147 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -91,19 +91,22 @@ static ssize_t cuse_read(struct file *file, char __user *buf, size_t count,
91 loff_t *ppos) 91 loff_t *ppos)
92{ 92{
93 loff_t pos = 0; 93 loff_t pos = 0;
94 struct iovec iov = { .iov_base = buf, .iov_len = count };
94 95
95 return fuse_direct_io(file, buf, count, &pos, 0); 96 return fuse_direct_io(file, &iov, 1, count, &pos, 0);
96} 97}
97 98
98static ssize_t cuse_write(struct file *file, const char __user *buf, 99static ssize_t cuse_write(struct file *file, const char __user *buf,
99 size_t count, loff_t *ppos) 100 size_t count, loff_t *ppos)
100{ 101{
101 loff_t pos = 0; 102 loff_t pos = 0;
103 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count };
104
102 /* 105 /*
103 * No locking or generic_write_checks(), the server is 106 * No locking or generic_write_checks(), the server is
104 * responsible for locking and sanity checks. 107 * responsible for locking and sanity checks.
105 */ 108 */
106 return fuse_direct_io(file, buf, count, &pos, 1); 109 return fuse_direct_io(file, &iov, 1, count, &pos, 1);
107} 110}
108 111
109static int cuse_open(struct inode *inode, struct file *file) 112static int cuse_open(struct inode *inode, struct file *file)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 68e10d43bd3f..28bc9c672196 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1148,9 +1148,9 @@ static inline int fuse_iter_npages(const struct iov_iter *ii_p)
1148 return min(npages, FUSE_MAX_PAGES_PER_REQ); 1148 return min(npages, FUSE_MAX_PAGES_PER_REQ);
1149} 1149}
1150 1150
1151static ssize_t __fuse_direct_io(struct file *file, const struct iovec *iov, 1151ssize_t fuse_direct_io(struct file *file, const struct iovec *iov,
1152 unsigned long nr_segs, size_t count, 1152 unsigned long nr_segs, size_t count, loff_t *ppos,
1153 loff_t *ppos, int write) 1153 int write)
1154{ 1154{
1155 struct fuse_file *ff = file->private_data; 1155 struct fuse_file *ff = file->private_data;
1156 struct fuse_conn *fc = ff->fc; 1156 struct fuse_conn *fc = ff->fc;
@@ -1209,13 +1209,6 @@ static ssize_t __fuse_direct_io(struct file *file, const struct iovec *iov,
1209 1209
1210 return res; 1210 return res;
1211} 1211}
1212
1213ssize_t fuse_direct_io(struct file *file, const char __user *buf,
1214 size_t count, loff_t *ppos, int write)
1215{
1216 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count };
1217 return __fuse_direct_io(file, &iov, 1, count, ppos, write);
1218}
1219EXPORT_SYMBOL_GPL(fuse_direct_io); 1212EXPORT_SYMBOL_GPL(fuse_direct_io);
1220 1213
1221static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov, 1214static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
@@ -1227,8 +1220,8 @@ static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
1227 if (is_bad_inode(inode)) 1220 if (is_bad_inode(inode))
1228 return -EIO; 1221 return -EIO;
1229 1222
1230 res = __fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs), 1223 res = fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs),
1231 ppos, 0); 1224 ppos, 0);
1232 1225
1233 fuse_invalidate_attr(inode); 1226 fuse_invalidate_attr(inode);
1234 1227
@@ -1238,7 +1231,7 @@ static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
1238static ssize_t fuse_direct_read(struct file *file, char __user *buf, 1231static ssize_t fuse_direct_read(struct file *file, char __user *buf,
1239 size_t count, loff_t *ppos) 1232 size_t count, loff_t *ppos)
1240{ 1233{
1241 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; 1234 struct iovec iov = { .iov_base = buf, .iov_len = count };
1242 return __fuse_direct_read(file, &iov, 1, ppos); 1235 return __fuse_direct_read(file, &iov, 1, ppos);
1243} 1236}
1244 1237
@@ -1251,7 +1244,7 @@ static ssize_t __fuse_direct_write(struct file *file, const struct iovec *iov,
1251 1244
1252 res = generic_write_checks(file, ppos, &count, 0); 1245 res = generic_write_checks(file, ppos, &count, 0);
1253 if (!res) { 1246 if (!res) {
1254 res = __fuse_direct_io(file, iov, nr_segs, count, ppos, 1); 1247 res = fuse_direct_io(file, iov, nr_segs, count, ppos, 1);
1255 if (res > 0) 1248 if (res > 0)
1256 fuse_write_update_size(inode, *ppos); 1249 fuse_write_update_size(inode, *ppos);
1257 } 1250 }
@@ -1264,7 +1257,7 @@ static ssize_t __fuse_direct_write(struct file *file, const struct iovec *iov,
1264static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 1257static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
1265 size_t count, loff_t *ppos) 1258 size_t count, loff_t *ppos)
1266{ 1259{
1267 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; 1260 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count };
1268 struct inode *inode = file->f_path.dentry->d_inode; 1261 struct inode *inode = file->f_path.dentry->d_inode;
1269 ssize_t res; 1262 ssize_t res;
1270 1263
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 70cef60afe0e..13befcd29c5b 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -811,8 +811,9 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
811 811
812int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, 812int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
813 bool isdir); 813 bool isdir);
814ssize_t fuse_direct_io(struct file *file, const char __user *buf, 814ssize_t fuse_direct_io(struct file *file, const struct iovec *iov,
815 size_t count, loff_t *ppos, int write); 815 unsigned long nr_segs, size_t count, loff_t *ppos,
816 int write);
816long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, 817long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
817 unsigned int flags); 818 unsigned int flags);
818long fuse_ioctl_common(struct file *file, unsigned int cmd, 819long fuse_ioctl_common(struct file *file, unsigned int cmd,