diff options
| -rw-r--r-- | fs/ext4/dir.c | 17 | ||||
| -rw-r--r-- | include/linux/fs.h | 3 |
2 files changed, 17 insertions, 3 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index c24143ea9..85fa814ed 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -26,6 +26,7 @@ #include <linux/buffer_head.h> #include <linux/slab.h> #include <linux/rbtree.h> +#include <linux/fsnotify.h> #include "ext4.h" #include "xattr.h" @@ -102,7 +103,7 @@ int __ext4_check_dir_entry(const char *function, unsigned int line, return 1; } -static int ext4_readdir(struct file *file, struct dir_context *ctx) +static int ext4_readdir2(struct file *file, struct dir_context *ctx) { unsigned int offset; int i; @@ -247,6 +248,18 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) return 0; } +static int ext4_readdir(struct file *file, + void *dirent, filldir_t filldir) +{ + struct dir_context ctx = { filldir, dirent, file->f_pos }; + int ret; + + ret = ext4_readdir2(file, &ctx); + file->f_pos = ctx.pos; + fsnotify_access(file); + return ret; +} + static inline int is_32bit_api(void) { #ifdef CONFIG_COMPAT @@ -597,7 +610,7 @@ int ext4_check_all_de(struct inode *dir, struct buffer_head *bh, void *buf, const struct file_operations ext4_dir_operations = { .llseek = ext4_dir_llseek, .read = generic_read_dir, - .iterate = ext4_readdir, + .readdir = ext4_readdir, .unlocked_ioctl = ext4_ioctl, #ifdef CONFIG_COMPAT .compat_ioctl = ext4_compat_ioctl, diff --git a/include/linux/fs.h b/include/linux/fs.h index 4dc48e4af..9bfff5d2b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1536,6 +1536,7 @@ int fiemap_check_flags(struct fiemap_extent_info *fieinfo, u32 fs_flags); typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned); struct dir_context { const filldir_t actor; + void *dirent; loff_t pos; bool romnt; }; @@ -1544,7 +1545,7 @@ static inline bool dir_emit(struct dir_context *ctx, const char *name, int namelen, u64 ino, unsigned type) { - return ctx->actor(ctx, name, namelen, ctx->pos, ino, type) == 0; + return ctx->actor(ctx->dirent, name, namelen, ctx->pos, ino, type) == 0; } struct block_device_operations; |
