diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-15 18:49:12 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:46:47 -0400 |
commit | bb6f619b3a49f940d7478112500da312d70866eb (patch) | |
tree | 4e17d6ed5b965eaec2e55b11b61145b200d28f0f /fs/compat.c | |
parent | 5c0ba4e0762e6dabd14a5c276652e2defec38de7 (diff) |
[readdir] introduce ->iterate(), ctx->pos, dir_emit()
New method - ->iterate(file, ctx). That's the replacement for ->readdir();
it takes callback from ctx->actor, uses ctx->pos instead of file->f_pos and
calls dir_emit(ctx, ...) instead of filldir(data, ...). It does *not*
update file->f_pos (or look at it, for that matter); iterate_dir() does the
update.
Note that dir_emit() takes the offset from ctx->pos (and eventually
filldir_t will lose that argument).
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/compat.c b/fs/compat.c index 2279b59e81f2..69ca1e301766 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -975,7 +975,7 @@ asmlinkage long compat_sys_getdents(unsigned int fd, | |||
975 | error = buf.error; | 975 | error = buf.error; |
976 | lastdirent = buf.previous; | 976 | lastdirent = buf.previous; |
977 | if (lastdirent) { | 977 | if (lastdirent) { |
978 | if (put_user(f.file->f_pos, &lastdirent->d_off)) | 978 | if (put_user(buf.ctx.pos, &lastdirent->d_off)) |
979 | error = -EFAULT; | 979 | error = -EFAULT; |
980 | else | 980 | else |
981 | error = count - buf.count; | 981 | error = count - buf.count; |
@@ -1062,7 +1062,7 @@ asmlinkage long compat_sys_getdents64(unsigned int fd, | |||
1062 | error = buf.error; | 1062 | error = buf.error; |
1063 | lastdirent = buf.previous; | 1063 | lastdirent = buf.previous; |
1064 | if (lastdirent) { | 1064 | if (lastdirent) { |
1065 | typeof(lastdirent->d_off) d_off = f.file->f_pos; | 1065 | typeof(lastdirent->d_off) d_off = buf.ctx.pos; |
1066 | if (__put_user_unaligned(d_off, &lastdirent->d_off)) | 1066 | if (__put_user_unaligned(d_off, &lastdirent->d_off)) |
1067 | error = -EFAULT; | 1067 | error = -EFAULT; |
1068 | else | 1068 | else |