aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-05-22 13:44:05 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-06-29 04:56:55 -0400
commitf0f49ef5ce0a9393a084073ad4cbdf30464ad896 (patch)
tree307ec836771a9eafb41f249ec6cdc5742986ef84 /fs/befs
parentbe4ccdcc2575ae154426083765b8b8eb9253c925 (diff)
[readdir] convert befs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/linuxvfs.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index f95dddced968..e9c75e20db32 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -31,7 +31,7 @@ MODULE_LICENSE("GPL");
31/* The units the vfs expects inode->i_blocks to be in */ 31/* The units the vfs expects inode->i_blocks to be in */
32#define VFS_BLOCK_SIZE 512 32#define VFS_BLOCK_SIZE 512
33 33
34static int befs_readdir(struct file *, void *, filldir_t); 34static int befs_readdir(struct file *, struct dir_context *);
35static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int); 35static int befs_get_block(struct inode *, sector_t, struct buffer_head *, int);
36static int befs_readpage(struct file *file, struct page *page); 36static int befs_readpage(struct file *file, struct page *page);
37static sector_t befs_bmap(struct address_space *mapping, sector_t block); 37static sector_t befs_bmap(struct address_space *mapping, sector_t block);
@@ -66,7 +66,7 @@ static struct kmem_cache *befs_inode_cachep;
66 66
67static const struct file_operations befs_dir_operations = { 67static const struct file_operations befs_dir_operations = {
68 .read = generic_read_dir, 68 .read = generic_read_dir,
69 .readdir = befs_readdir, 69 .iterate = befs_readdir,
70 .llseek = generic_file_llseek, 70 .llseek = generic_file_llseek,
71}; 71};
72 72
@@ -211,9 +211,9 @@ befs_lookup(struct inode *dir, struct dentry *dentry, unsigned int flags)
211} 211}
212 212
213static int 213static int
214befs_readdir(struct file *filp, void *dirent, filldir_t filldir) 214befs_readdir(struct file *file, struct dir_context *ctx)
215{ 215{
216 struct inode *inode = file_inode(filp); 216 struct inode *inode = file_inode(file);
217 struct super_block *sb = inode->i_sb; 217 struct super_block *sb = inode->i_sb;
218 befs_data_stream *ds = &BEFS_I(inode)->i_data.ds; 218 befs_data_stream *ds = &BEFS_I(inode)->i_data.ds;
219 befs_off_t value; 219 befs_off_t value;
@@ -221,15 +221,14 @@ befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
221 size_t keysize; 221 size_t keysize;
222 unsigned char d_type; 222 unsigned char d_type;
223 char keybuf[BEFS_NAME_LEN + 1]; 223 char keybuf[BEFS_NAME_LEN + 1];
224 char *nlsname; 224 const char *dirname = file->f_path.dentry->d_name.name;
225 int nlsnamelen;
226 const char *dirname = filp->f_path.dentry->d_name.name;
227 225
228 befs_debug(sb, "---> befs_readdir() " 226 befs_debug(sb, "---> befs_readdir() "
229 "name %s, inode %ld, filp->f_pos %Ld", 227 "name %s, inode %ld, ctx->pos %Ld",
230 dirname, inode->i_ino, filp->f_pos); 228 dirname, inode->i_ino, ctx->pos);
231 229
232 result = befs_btree_read(sb, ds, filp->f_pos, BEFS_NAME_LEN + 1, 230more:
231 result = befs_btree_read(sb, ds, ctx->pos, BEFS_NAME_LEN + 1,
233 keybuf, &keysize, &value); 232 keybuf, &keysize, &value);
234 233
235 if (result == BEFS_ERR) { 234 if (result == BEFS_ERR) {
@@ -251,24 +250,29 @@ befs_readdir(struct file *filp, void *dirent, filldir_t filldir)
251 250
252 /* Convert to NLS */ 251 /* Convert to NLS */
253 if (BEFS_SB(sb)->nls) { 252 if (BEFS_SB(sb)->nls) {
253 char *nlsname;
254 int nlsnamelen;
254 result = 255 result =
255 befs_utf2nls(sb, keybuf, keysize, &nlsname, &nlsnamelen); 256 befs_utf2nls(sb, keybuf, keysize, &nlsname, &nlsnamelen);
256 if (result < 0) { 257 if (result < 0) {
257 befs_debug(sb, "<--- befs_readdir() ERROR"); 258 befs_debug(sb, "<--- befs_readdir() ERROR");
258 return result; 259 return result;
259 } 260 }
260 result = filldir(dirent, nlsname, nlsnamelen, filp->f_pos, 261 if (!dir_emit(ctx, nlsname, nlsnamelen,
261 (ino_t) value, d_type); 262 (ino_t) value, d_type)) {
263 kfree(nlsname);
264 return 0;
265 }
262 kfree(nlsname); 266 kfree(nlsname);
263
264 } else { 267 } else {
265 result = filldir(dirent, keybuf, keysize, filp->f_pos, 268 if (!dir_emit(ctx, keybuf, keysize,
266 (ino_t) value, d_type); 269 (ino_t) value, d_type))
270 return 0;
267 } 271 }
268 if (!result) 272 ctx->pos++;
269 filp->f_pos++; 273 goto more;
270 274
271 befs_debug(sb, "<--- befs_readdir() filp->f_pos %Ld", filp->f_pos); 275 befs_debug(sb, "<--- befs_readdir() pos %Ld", ctx->pos);
272 276
273 return 0; 277 return 0;
274} 278}