diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-16 01:22:00 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:56:29 -0400 |
commit | 3903b38ce77a9a5f6adb36610bae4a69db3eaceb (patch) | |
tree | aafdef1faec8faa5fc8702a79918268fc4233b03 /fs/romfs | |
parent | 5f6039ce69605e40e9188437d8837a67f8056ec6 (diff) |
[readdir] convert romfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/romfs')
-rw-r--r-- | fs/romfs/super.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index 15cbc41ee365..ff1d3d42e72a 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c | |||
@@ -145,19 +145,18 @@ static const struct address_space_operations romfs_aops = { | |||
145 | /* | 145 | /* |
146 | * read the entries from a directory | 146 | * read the entries from a directory |
147 | */ | 147 | */ |
148 | static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | 148 | static int romfs_readdir(struct file *file, struct dir_context *ctx) |
149 | { | 149 | { |
150 | struct inode *i = file_inode(filp); | 150 | struct inode *i = file_inode(file); |
151 | struct romfs_inode ri; | 151 | struct romfs_inode ri; |
152 | unsigned long offset, maxoff; | 152 | unsigned long offset, maxoff; |
153 | int j, ino, nextfh; | 153 | int j, ino, nextfh; |
154 | int stored = 0; | ||
155 | char fsname[ROMFS_MAXFN]; /* XXX dynamic? */ | 154 | char fsname[ROMFS_MAXFN]; /* XXX dynamic? */ |
156 | int ret; | 155 | int ret; |
157 | 156 | ||
158 | maxoff = romfs_maxsize(i->i_sb); | 157 | maxoff = romfs_maxsize(i->i_sb); |
159 | 158 | ||
160 | offset = filp->f_pos; | 159 | offset = ctx->pos; |
161 | if (!offset) { | 160 | if (!offset) { |
162 | offset = i->i_ino & ROMFH_MASK; | 161 | offset = i->i_ino & ROMFH_MASK; |
163 | ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE); | 162 | ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE); |
@@ -170,10 +169,10 @@ static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
170 | for (;;) { | 169 | for (;;) { |
171 | if (!offset || offset >= maxoff) { | 170 | if (!offset || offset >= maxoff) { |
172 | offset = maxoff; | 171 | offset = maxoff; |
173 | filp->f_pos = offset; | 172 | ctx->pos = offset; |
174 | goto out; | 173 | goto out; |
175 | } | 174 | } |
176 | filp->f_pos = offset; | 175 | ctx->pos = offset; |
177 | 176 | ||
178 | /* Fetch inode info */ | 177 | /* Fetch inode info */ |
179 | ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE); | 178 | ret = romfs_dev_read(i->i_sb, offset, &ri, ROMFH_SIZE); |
@@ -194,16 +193,14 @@ static int romfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
194 | nextfh = be32_to_cpu(ri.next); | 193 | nextfh = be32_to_cpu(ri.next); |
195 | if ((nextfh & ROMFH_TYPE) == ROMFH_HRD) | 194 | if ((nextfh & ROMFH_TYPE) == ROMFH_HRD) |
196 | ino = be32_to_cpu(ri.spec); | 195 | ino = be32_to_cpu(ri.spec); |
197 | if (filldir(dirent, fsname, j, offset, ino, | 196 | if (!dir_emit(ctx, fsname, j, ino, |
198 | romfs_dtype_table[nextfh & ROMFH_TYPE]) < 0) | 197 | romfs_dtype_table[nextfh & ROMFH_TYPE])) |
199 | goto out; | 198 | goto out; |
200 | 199 | ||
201 | stored++; | ||
202 | offset = nextfh & ROMFH_MASK; | 200 | offset = nextfh & ROMFH_MASK; |
203 | } | 201 | } |
204 | |||
205 | out: | 202 | out: |
206 | return stored; | 203 | return 0; |
207 | } | 204 | } |
208 | 205 | ||
209 | /* | 206 | /* |
@@ -281,7 +278,7 @@ error: | |||
281 | 278 | ||
282 | static const struct file_operations romfs_dir_operations = { | 279 | static const struct file_operations romfs_dir_operations = { |
283 | .read = generic_read_dir, | 280 | .read = generic_read_dir, |
284 | .readdir = romfs_readdir, | 281 | .iterate = romfs_readdir, |
285 | .llseek = default_llseek, | 282 | .llseek = default_llseek, |
286 | }; | 283 | }; |
287 | 284 | ||