diff options
Diffstat (limited to 'arch/parisc/hpux/fs.c')
-rw-r--r-- | arch/parisc/hpux/fs.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c index 838b479a42c4..88d0962de65a 100644 --- a/arch/parisc/hpux/fs.c +++ b/arch/parisc/hpux/fs.c | |||
@@ -60,6 +60,7 @@ struct hpux_dirent { | |||
60 | }; | 60 | }; |
61 | 61 | ||
62 | struct getdents_callback { | 62 | struct 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; |
@@ -110,24 +111,23 @@ int hpux_getdents(unsigned int fd, struct hpux_dirent __user *dirent, unsigned i | |||
110 | { | 111 | { |
111 | struct fd arg; | 112 | struct fd arg; |
112 | struct hpux_dirent __user * lastdirent; | 113 | struct hpux_dirent __user * lastdirent; |
113 | struct getdents_callback buf; | 114 | struct getdents_callback buf = { |
115 | .ctx.actor = filldir, | ||
116 | .current_dir = dirent, | ||
117 | .count = count | ||
118 | }; | ||
114 | int error; | 119 | int error; |
115 | 120 | ||
116 | arg = fdget(fd); | 121 | arg = fdget(fd); |
117 | if (!arg.file) | 122 | if (!arg.file) |
118 | return -EBADF; | 123 | return -EBADF; |
119 | 124 | ||
120 | buf.current_dir = dirent; | 125 | error = iterate_dir(arg.file, &buf.ctx); |
121 | buf.previous = NULL; | ||
122 | buf.count = count; | ||
123 | buf.error = 0; | ||
124 | |||
125 | error = vfs_readdir(arg.file, filldir, &buf); | ||
126 | if (error >= 0) | 126 | if (error >= 0) |
127 | error = buf.error; | 127 | error = buf.error; |
128 | lastdirent = buf.previous; | 128 | lastdirent = buf.previous; |
129 | if (lastdirent) { | 129 | if (lastdirent) { |
130 | if (put_user(arg.file->f_pos, &lastdirent->d_off)) | 130 | if (put_user(buf.ctx.pos, &lastdirent->d_off)) |
131 | error = -EFAULT; | 131 | error = -EFAULT; |
132 | else | 132 | else |
133 | error = count - buf.count; | 133 | error = count - buf.count; |