diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-05-16 12:07:31 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-06-29 04:56:32 -0400 |
commit | f0c3b5093addc8bfe9fe3a5b01acb7ec7969eafa (patch) | |
tree | 3bad119186fd14fa95886cfc73c6953a4dd00e74 /fs/hppfs | |
parent | 68c61471138402e34489edc5efde4f0fc5beaa25 (diff) |
[readdir] convert procfs
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hppfs')
-rw-r--r-- | fs/hppfs/hppfs.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index cd3e38972c86..fc90ab11c340 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
@@ -542,8 +542,8 @@ static const struct file_operations hppfs_file_fops = { | |||
542 | }; | 542 | }; |
543 | 543 | ||
544 | struct hppfs_dirent { | 544 | struct hppfs_dirent { |
545 | void *vfs_dirent; | 545 | struct dir_context ctx; |
546 | filldir_t filldir; | 546 | struct dir_context *caller; |
547 | struct dentry *dentry; | 547 | struct dentry *dentry; |
548 | }; | 548 | }; |
549 | 549 | ||
@@ -555,34 +555,29 @@ static int hppfs_filldir(void *d, const char *name, int size, | |||
555 | if (file_removed(dirent->dentry, name)) | 555 | if (file_removed(dirent->dentry, name)) |
556 | return 0; | 556 | return 0; |
557 | 557 | ||
558 | return (*dirent->filldir)(dirent->vfs_dirent, name, size, offset, | 558 | dirent->caller->pos = dirent->ctx.pos; |
559 | inode, type); | 559 | return !dir_emit(dirent->caller, name, size, inode, type); |
560 | } | 560 | } |
561 | 561 | ||
562 | static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) | 562 | static int hppfs_readdir(struct file *file, struct dir_context *ctx) |
563 | { | 563 | { |
564 | struct hppfs_private *data = file->private_data; | 564 | struct hppfs_private *data = file->private_data; |
565 | struct file *proc_file = data->proc_file; | 565 | struct file *proc_file = data->proc_file; |
566 | int (*readdir)(struct file *, void *, filldir_t); | 566 | struct hppfs_dirent d = { |
567 | struct hppfs_dirent dirent = ((struct hppfs_dirent) | 567 | .ctx.actor = hppfs_filldir, |
568 | { .vfs_dirent = ent, | 568 | .caller = ctx, |
569 | .filldir = filldir, | 569 | .dentry = file->f_path.dentry |
570 | .dentry = file->f_path.dentry | 570 | }; |
571 | }); | ||
572 | int err; | 571 | int err; |
573 | 572 | proc_file->f_pos = ctx->pos; | |
574 | readdir = file_inode(proc_file)->i_fop->readdir; | 573 | err = iterate_dir(proc_file, &d.ctx); |
575 | 574 | ctx->pos = d.ctx.pos; | |
576 | proc_file->f_pos = file->f_pos; | ||
577 | err = (*readdir)(proc_file, &dirent, hppfs_filldir); | ||
578 | file->f_pos = proc_file->f_pos; | ||
579 | |||
580 | return err; | 575 | return err; |
581 | } | 576 | } |
582 | 577 | ||
583 | static const struct file_operations hppfs_dir_fops = { | 578 | static const struct file_operations hppfs_dir_fops = { |
584 | .owner = NULL, | 579 | .owner = NULL, |
585 | .readdir = hppfs_readdir, | 580 | .iterate = hppfs_readdir, |
586 | .open = hppfs_dir_open, | 581 | .open = hppfs_dir_open, |
587 | .llseek = default_llseek, | 582 | .llseek = default_llseek, |
588 | .release = hppfs_release, | 583 | .release = hppfs_release, |