aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-15 13:52:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:46:46 -0400
commit5c0ba4e0762e6dabd14a5c276652e2defec38de7 (patch)
treecc2c94d81a631b0656782e1f8299da3267871964 /arch
parent83a8761142cb38536e9e88dfc2432d331ea4e257 (diff)
[readdir] introduce iterate_dir() and dir_context
iterate_dir(): new helper, replacing vfs_readdir(). struct dir_context: contains the readdir callback (and will get more stuff in it), embedded into whatever data that callback wants to deal with; eventually, we'll be passing it to ->readdir() replacement instead of (data,filldir) pair. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/osf_sys.c4
-rw-r--r--arch/parisc/hpux/fs.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index b9e37ad6fa19..ac19c7299d8e 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -96,6 +96,7 @@ struct osf_dirent {
96}; 96};
97 97
98struct osf_dirent_callback { 98struct osf_dirent_callback {
99 struct dir_context ctx;
99 struct osf_dirent __user *dirent; 100 struct osf_dirent __user *dirent;
100 long __user *basep; 101 long __user *basep;
101 unsigned int count; 102 unsigned int count;
@@ -155,8 +156,9 @@ SYSCALL_DEFINE4(osf_getdirentries, unsigned int, fd,
155 buf.basep = basep; 156 buf.basep = basep;
156 buf.count = count; 157 buf.count = count;
157 buf.error = 0; 158 buf.error = 0;
159 buf.ctx.actor = osf_filldir;
158 160
159 error = vfs_readdir(arg.file, osf_filldir, &buf); 161 error = iterate_dir(arg.file, &buf.ctx);
160 if (error >= 0) 162 if (error >= 0)
161 error = buf.error; 163 error = buf.error;
162 if (count != buf.count) 164 if (count != buf.count)
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 838b479a42c4..fc2cbee86e34 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -60,6 +60,7 @@ struct hpux_dirent {
60}; 60};
61 61
62struct getdents_callback { 62struct getdents_callback {
63 struct dir_context ctx;
63 struct hpux_dirent __user *current_dir; 64 struct hpux_dirent __user *current_dir;
64 struct hpux_dirent __user *previous; 65 struct hpux_dirent __user *previous;
65 int count; 66 int count;
@@ -121,8 +122,9 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i
121 buf.previous = NULL; 122 buf.previous = NULL;
122 buf.count = count; 123 buf.count = count;
123 buf.error = 0; 124 buf.error = 0;
125 buf.ctx.actor = filldir;
124 126
125 error = vfs_readdir(arg.file, filldir, &buf); 127 error = iterate_dir(arg.file, &buf.ctx);
126 if (error >= 0) 128 if (error >= 0)
127 error = buf.error; 129 error = buf.error;
128 lastdirent = buf.previous; 130 lastdirent = buf.previous;