X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzpl_file.c;fp=module%2Fzfs%2Fzpl_file.c;h=6598c177971d46abbe6e3299f698249e70853582;hb=0f37d0c8bed442dd0d2c1b1dddd68653fa6eec66;hp=299589193e5ca513a5e1baaa9b6d08d70d8d07f0;hpb=34e143323e359b42bc9d06dd19cc4b1f13091283;p=zfs.git diff --git a/module/zfs/zpl_file.c b/module/zfs/zpl_file.c index 2995891..6598c17 100644 --- a/module/zfs/zpl_file.c +++ b/module/zfs/zpl_file.c @@ -64,21 +64,34 @@ zpl_release(struct inode *ip, struct file *filp) } static int -zpl_readdir(struct file *filp, void *dirent, filldir_t filldir) +zpl_iterate(struct file *filp, struct dir_context *ctx) { struct dentry *dentry = filp->f_path.dentry; cred_t *cr = CRED(); int error; crhold(cr); - error = -zfs_readdir(dentry->d_inode, dirent, filldir, - &filp->f_pos, cr); + error = -zfs_readdir(dentry->d_inode, ctx, cr); crfree(cr); ASSERT3S(error, <=, 0); return (error); } +#if !defined(HAVE_VFS_ITERATE) +static int +zpl_readdir(struct file *filp, void *dirent, filldir_t filldir) +{ + struct dir_context ctx = DIR_CONTEXT_INIT(dirent, filldir, filp->f_pos); + int error; + + error = zpl_iterate(filp, &ctx); + filp->f_pos = ctx.pos; + + return (error); +} +#endif /* HAVE_VFS_ITERATE */ + #if defined(HAVE_FSYNC_WITH_DENTRY) /* * Linux 2.6.x - 2.6.34 API, @@ -506,7 +519,11 @@ const struct file_operations zpl_file_operations = { const struct file_operations zpl_dir_file_operations = { .llseek = generic_file_llseek, .read = generic_read_dir, +#ifdef HAVE_VFS_ITERATE + .iterate = zpl_iterate, +#else .readdir = zpl_readdir, +#endif .fsync = zpl_fsync, .unlocked_ioctl = zpl_ioctl, #ifdef CONFIG_COMPAT