diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-22 22:22:04 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:57:05 -0400 |
commit | ac6614b76478e68173ccf7ad4e9e98035cc9c21d (patch) | |
tree | ed2c996b6e64e44c5a752dfafd650bfa1eb7f035 /fs | |
parent | 2233f31aade393641f0eaed43a71110e629bb900 (diff) |
[readdir] constify ->actor
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/compat.c | 33 | ||||
-rw-r--r-- | fs/exportfs/expfs.c | 10 | ||||
-rw-r--r-- | fs/gfs2/export.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfs4recover.c | 7 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 7 | ||||
-rw-r--r-- | fs/readdir.c | 33 |
6 files changed, 45 insertions, 53 deletions
diff --git a/fs/compat.c b/fs/compat.c index 69ca1e301766..6af20de2c1a3 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -874,15 +874,14 @@ asmlinkage long compat_sys_old_readdir(unsigned int fd, | |||
874 | { | 874 | { |
875 | int error; | 875 | int error; |
876 | struct fd f = fdget(fd); | 876 | struct fd f = fdget(fd); |
877 | struct compat_readdir_callback buf; | 877 | struct compat_readdir_callback buf = { |
878 | .ctx.actor = compat_fillonedir, | ||
879 | .dirent = dirent | ||
880 | }; | ||
878 | 881 | ||
879 | if (!f.file) | 882 | if (!f.file) |
880 | return -EBADF; | 883 | return -EBADF; |
881 | 884 | ||
882 | buf.result = 0; | ||
883 | buf.dirent = dirent; | ||
884 | buf.ctx.actor = compat_fillonedir; | ||
885 | |||
886 | error = iterate_dir(f.file, &buf.ctx); | 885 | error = iterate_dir(f.file, &buf.ctx); |
887 | if (buf.result) | 886 | if (buf.result) |
888 | error = buf.result; | 887 | error = buf.result; |
@@ -954,7 +953,11 @@ asmlinkage long compat_sys_getdents(unsigned int fd, | |||
954 | { | 953 | { |
955 | struct fd f; | 954 | struct fd f; |
956 | struct compat_linux_dirent __user * lastdirent; | 955 | struct compat_linux_dirent __user * lastdirent; |
957 | struct compat_getdents_callback buf; | 956 | struct compat_getdents_callback buf = { |
957 | .ctx.actor = compat_filldir, | ||
958 | .current_dir = dirent, | ||
959 | .count = count | ||
960 | }; | ||
958 | int error; | 961 | int error; |
959 | 962 | ||
960 | if (!access_ok(VERIFY_WRITE, dirent, count)) | 963 | if (!access_ok(VERIFY_WRITE, dirent, count)) |
@@ -964,12 +967,6 @@ asmlinkage long compat_sys_getdents(unsigned int fd, | |||
964 | if (!f.file) | 967 | if (!f.file) |
965 | return -EBADF; | 968 | return -EBADF; |
966 | 969 | ||
967 | buf.current_dir = dirent; | ||
968 | buf.previous = NULL; | ||
969 | buf.count = count; | ||
970 | buf.error = 0; | ||
971 | buf.ctx.actor = compat_filldir; | ||
972 | |||
973 | error = iterate_dir(f.file, &buf.ctx); | 970 | error = iterate_dir(f.file, &buf.ctx); |
974 | if (error >= 0) | 971 | if (error >= 0) |
975 | error = buf.error; | 972 | error = buf.error; |
@@ -1041,7 +1038,11 @@ asmlinkage long compat_sys_getdents64(unsigned int fd, | |||
1041 | { | 1038 | { |
1042 | struct fd f; | 1039 | struct fd f; |
1043 | struct linux_dirent64 __user * lastdirent; | 1040 | struct linux_dirent64 __user * lastdirent; |
1044 | struct compat_getdents_callback64 buf; | 1041 | struct compat_getdents_callback64 buf = { |
1042 | .ctx.actor = compat_filldir64, | ||
1043 | .current_dir = dirent, | ||
1044 | .count = count | ||
1045 | }; | ||
1045 | int error; | 1046 | int error; |
1046 | 1047 | ||
1047 | if (!access_ok(VERIFY_WRITE, dirent, count)) | 1048 | if (!access_ok(VERIFY_WRITE, dirent, count)) |
@@ -1051,12 +1052,6 @@ asmlinkage long compat_sys_getdents64(unsigned int fd, | |||
1051 | if (!f.file) | 1052 | if (!f.file) |
1052 | return -EBADF; | 1053 | return -EBADF; |
1053 | 1054 | ||
1054 | buf.current_dir = dirent; | ||
1055 | buf.previous = NULL; | ||
1056 | buf.count = count; | ||
1057 | buf.error = 0; | ||
1058 | buf.ctx.actor = compat_filldir64; | ||
1059 | |||
1060 | error = iterate_dir(f.file, &buf.ctx); | 1055 | error = iterate_dir(f.file, &buf.ctx); |
1061 | if (error >= 0) | 1056 | if (error >= 0) |
1062 | error = buf.error; | 1057 | error = buf.error; |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 78072e65f926..293bc2e47a73 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -255,7 +255,11 @@ static int get_name(const struct path *path, char *name, struct dentry *child) | |||
255 | struct inode *dir = path->dentry->d_inode; | 255 | struct inode *dir = path->dentry->d_inode; |
256 | int error; | 256 | int error; |
257 | struct file *file; | 257 | struct file *file; |
258 | struct getdents_callback buffer; | 258 | struct getdents_callback buffer = { |
259 | .ctx.actor = filldir_one, | ||
260 | .name = name, | ||
261 | .ino = child->d_inode->i_ino | ||
262 | }; | ||
259 | 263 | ||
260 | error = -ENOTDIR; | 264 | error = -ENOTDIR; |
261 | if (!dir || !S_ISDIR(dir->i_mode)) | 265 | if (!dir || !S_ISDIR(dir->i_mode)) |
@@ -275,11 +279,7 @@ static int get_name(const struct path *path, char *name, struct dentry *child) | |||
275 | if (!file->f_op->iterate) | 279 | if (!file->f_op->iterate) |
276 | goto out_close; | 280 | goto out_close; |
277 | 281 | ||
278 | buffer.name = name; | ||
279 | buffer.ino = child->d_inode->i_ino; | ||
280 | buffer.found = 0; | ||
281 | buffer.sequence = 0; | 282 | buffer.sequence = 0; |
282 | buffer.ctx.actor = filldir_one; | ||
283 | while (1) { | 283 | while (1) { |
284 | int old_seq = buffer.sequence; | 284 | int old_seq = buffer.sequence; |
285 | 285 | ||
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index aed4003486d6..8b9b3775e2e7 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
@@ -89,7 +89,10 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
89 | struct inode *dir = parent->d_inode; | 89 | struct inode *dir = parent->d_inode; |
90 | struct inode *inode = child->d_inode; | 90 | struct inode *inode = child->d_inode; |
91 | struct gfs2_inode *dip, *ip; | 91 | struct gfs2_inode *dip, *ip; |
92 | struct get_name_filldir gnfd; | 92 | struct get_name_filldir gnfd = { |
93 | .ctx.actor = get_name_filldir, | ||
94 | .name = name | ||
95 | }; | ||
93 | struct gfs2_holder gh; | 96 | struct gfs2_holder gh; |
94 | int error; | 97 | int error; |
95 | struct file_ra_state f_ra = { .start = 0 }; | 98 | struct file_ra_state f_ra = { .start = 0 }; |
@@ -106,9 +109,6 @@ static int gfs2_get_name(struct dentry *parent, char *name, | |||
106 | *name = 0; | 109 | *name = 0; |
107 | gnfd.inum.no_addr = ip->i_no_addr; | 110 | gnfd.inum.no_addr = ip->i_no_addr; |
108 | gnfd.inum.no_formal_ino = ip->i_no_formal_ino; | 111 | gnfd.inum.no_formal_ino = ip->i_no_formal_ino; |
109 | gnfd.name = name; | ||
110 | gnfd.ctx.actor = get_name_filldir; | ||
111 | gnfd.ctx.pos = 0; | ||
112 | 112 | ||
113 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); | 113 | error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, &gh); |
114 | if (error) | 114 | if (error) |
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index 2fa2e2eb190b..105a3b080d12 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -268,7 +268,10 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
268 | { | 268 | { |
269 | const struct cred *original_cred; | 269 | const struct cred *original_cred; |
270 | struct dentry *dir = nn->rec_file->f_path.dentry; | 270 | struct dentry *dir = nn->rec_file->f_path.dentry; |
271 | struct nfs4_dir_ctx ctx; | 271 | struct nfs4_dir_ctx ctx = { |
272 | .ctx.actor = nfsd4_build_namelist, | ||
273 | .names = LIST_HEAD_INIT(ctx.names) | ||
274 | }; | ||
272 | int status; | 275 | int status; |
273 | 276 | ||
274 | status = nfs4_save_creds(&original_cred); | 277 | status = nfs4_save_creds(&original_cred); |
@@ -281,8 +284,6 @@ nfsd4_list_rec_dir(recdir_func *f, struct nfsd_net *nn) | |||
281 | return status; | 284 | return status; |
282 | } | 285 | } |
283 | 286 | ||
284 | INIT_LIST_HEAD(&ctx.names); | ||
285 | ctx.ctx.actor = nfsd4_build_namelist; | ||
286 | status = iterate_dir(nn->rec_file, &ctx.ctx); | 287 | status = iterate_dir(nn->rec_file, &ctx.ctx); |
287 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 288 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); |
288 | while (!list_empty(&ctx.names)) { | 289 | while (!list_empty(&ctx.names)) { |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index f939ba9bf8e8..a6bc8a7423db 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1944,14 +1944,15 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | |||
1944 | static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, | 1944 | static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, |
1945 | struct readdir_cd *cdp, loff_t *offsetp) | 1945 | struct readdir_cd *cdp, loff_t *offsetp) |
1946 | { | 1946 | { |
1947 | struct readdir_data buf; | ||
1948 | struct buffered_dirent *de; | 1947 | struct buffered_dirent *de; |
1949 | int host_err; | 1948 | int host_err; |
1950 | int size; | 1949 | int size; |
1951 | loff_t offset; | 1950 | loff_t offset; |
1951 | struct readdir_data buf = { | ||
1952 | .ctx.actor = nfsd_buffered_filldir, | ||
1953 | .dirent = (void *)__get_free_page(GFP_KERNEL) | ||
1954 | }; | ||
1952 | 1955 | ||
1953 | buf.ctx.actor = nfsd_buffered_filldir; | ||
1954 | buf.dirent = (void *)__get_free_page(GFP_KERNEL); | ||
1955 | if (!buf.dirent) | 1956 | if (!buf.dirent) |
1956 | return nfserrno(-ENOMEM); | 1957 | return nfserrno(-ENOMEM); |
1957 | 1958 | ||
diff --git a/fs/readdir.c b/fs/readdir.c index a6245c9fd0e6..93d71e574310 100644 --- a/fs/readdir.c +++ b/fs/readdir.c | |||
@@ -109,15 +109,14 @@ SYSCALL_DEFINE3(old_readdir, unsigned int, fd, | |||
109 | { | 109 | { |
110 | int error; | 110 | int error; |
111 | struct fd f = fdget(fd); | 111 | struct fd f = fdget(fd); |
112 | struct readdir_callback buf; | 112 | struct readdir_callback buf = { |
113 | .ctx.actor = fillonedir, | ||
114 | .dirent = dirent | ||
115 | }; | ||
113 | 116 | ||
114 | if (!f.file) | 117 | if (!f.file) |
115 | return -EBADF; | 118 | return -EBADF; |
116 | 119 | ||
117 | buf.ctx.actor = fillonedir; | ||
118 | buf.result = 0; | ||
119 | buf.dirent = dirent; | ||
120 | |||
121 | error = iterate_dir(f.file, &buf.ctx); | 120 | error = iterate_dir(f.file, &buf.ctx); |
122 | if (buf.result) | 121 | if (buf.result) |
123 | error = buf.result; | 122 | error = buf.result; |
@@ -195,7 +194,11 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, | |||
195 | { | 194 | { |
196 | struct fd f; | 195 | struct fd f; |
197 | struct linux_dirent __user * lastdirent; | 196 | struct linux_dirent __user * lastdirent; |
198 | struct getdents_callback buf; | 197 | struct getdents_callback buf = { |
198 | .ctx.actor = filldir, | ||
199 | .count = count, | ||
200 | .current_dir = dirent | ||
201 | }; | ||
199 | int error; | 202 | int error; |
200 | 203 | ||
201 | if (!access_ok(VERIFY_WRITE, dirent, count)) | 204 | if (!access_ok(VERIFY_WRITE, dirent, count)) |
@@ -205,12 +208,6 @@ SYSCALL_DEFINE3(getdents, unsigned int, fd, | |||
205 | if (!f.file) | 208 | if (!f.file) |
206 | return -EBADF; | 209 | return -EBADF; |
207 | 210 | ||
208 | buf.current_dir = dirent; | ||
209 | buf.previous = NULL; | ||
210 | buf.count = count; | ||
211 | buf.error = 0; | ||
212 | buf.ctx.actor = filldir; | ||
213 | |||
214 | error = iterate_dir(f.file, &buf.ctx); | 211 | error = iterate_dir(f.file, &buf.ctx); |
215 | if (error >= 0) | 212 | if (error >= 0) |
216 | error = buf.error; | 213 | error = buf.error; |
@@ -277,7 +274,11 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd, | |||
277 | { | 274 | { |
278 | struct fd f; | 275 | struct fd f; |
279 | struct linux_dirent64 __user * lastdirent; | 276 | struct linux_dirent64 __user * lastdirent; |
280 | struct getdents_callback64 buf; | 277 | struct getdents_callback64 buf = { |
278 | .ctx.actor = filldir64, | ||
279 | .count = count, | ||
280 | .current_dir = dirent | ||
281 | }; | ||
281 | int error; | 282 | int error; |
282 | 283 | ||
283 | if (!access_ok(VERIFY_WRITE, dirent, count)) | 284 | if (!access_ok(VERIFY_WRITE, dirent, count)) |
@@ -287,12 +288,6 @@ SYSCALL_DEFINE3(getdents64, unsigned int, fd, | |||
287 | if (!f.file) | 288 | if (!f.file) |
288 | return -EBADF; | 289 | return -EBADF; |
289 | 290 | ||
290 | buf.current_dir = dirent; | ||
291 | buf.previous = NULL; | ||
292 | buf.count = count; | ||
293 | buf.error = 0; | ||
294 | buf.ctx.actor = filldir64; | ||
295 | |||
296 | error = iterate_dir(f.file, &buf.ctx); | 291 | error = iterate_dir(f.file, &buf.ctx); |
297 | if (error >= 0) | 292 | if (error >= 0) |
298 | error = buf.error; | 293 | error = buf.error; |