arm: dts: rockchip: add mpu6050 to rk3288-evb-act8846
[firefly-linux-kernel-4.4.55.git] / fs / readdir.c
index d46eca8567a413a8f081b4c8a5272a60a2039437..ced679179cac0686407c3743cff177289bfc3959 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/stat.h>
 #include <linux/file.h>
 #include <linux/fs.h>
+#include <linux/fsnotify.h>
 #include <linux/dirent.h>
 #include <linux/security.h>
 #include <linux/syscalls.h>
@@ -24,7 +25,7 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
 {
        struct inode *inode = file_inode(file);
        int res = -ENOTDIR;
-       if (!file->f_op || (!file->f_op->readdir && !file->f_op->iterate))
+       if (!file->f_op->iterate)
                goto out;
 
        res = security_file_permission(file, MAY_READ);
@@ -37,14 +38,10 @@ int iterate_dir(struct file *file, struct dir_context *ctx)
 
        res = -ENOENT;
        if (!IS_DEADDIR(inode)) {
-               if (file->f_op->iterate) {
-                       ctx->pos = file->f_pos;
-                       res = file->f_op->iterate(file, ctx);
-                       file->f_pos = ctx->pos;
-               } else {
-                       res = file->f_op->readdir(file, ctx, ctx->actor);
-                       ctx->pos = file->f_pos;
-               }
+               ctx->pos = file->f_pos;
+               res = file->f_op->iterate(file, ctx);
+               file->f_pos = ctx->pos;
+               fsnotify_access(file);
                file_accessed(file);
        }
        mutex_unlock(&inode->i_mutex);
@@ -77,10 +74,11 @@ struct readdir_callback {
        int result;
 };
 
-static int fillonedir(void * __buf, const char * name, int namlen, loff_t offset,
-                     u64 ino, unsigned int d_type)
+static int fillonedir(struct dir_context *ctx, const char *name, int namlen,
+                     loff_t offset, u64 ino, unsigned int d_type)
 {
-       struct readdir_callback *buf = (struct readdir_callback *) __buf;
+       struct readdir_callback *buf =
+               container_of(ctx, struct readdir_callback, ctx);
        struct old_linux_dirent __user * dirent;
        unsigned long d_ino;
 
@@ -151,11 +149,12 @@ struct getdents_callback {
        int error;
 };
 
-static int filldir(void * __buf, const char * name, int namlen, loff_t offset,
-                  u64 ino, unsigned int d_type)
+static int filldir(struct dir_context *ctx, const char *name, int namlen,
+                  loff_t offset, u64 ino, unsigned int d_type)
 {
        struct linux_dirent __user * dirent;
-       struct getdents_callback * buf = (struct getdents_callback *) __buf;
+       struct getdents_callback *buf =
+               container_of(ctx, struct getdents_callback, ctx);
        unsigned long d_ino;
        int reclen = ALIGN(offsetof(struct linux_dirent, d_name) + namlen + 2,
                sizeof(long));
@@ -235,11 +234,12 @@ struct getdents_callback64 {
        int error;
 };
 
-static int filldir64(void * __buf, const char * name, int namlen, loff_t offset,
-                    u64 ino, unsigned int d_type)
+static int filldir64(struct dir_context *ctx, const char *name, int namlen,
+                    loff_t offset, u64 ino, unsigned int d_type)
 {
        struct linux_dirent64 __user *dirent;
-       struct getdents_callback64 * buf = (struct getdents_callback64 *) __buf;
+       struct getdents_callback64 *buf =
+               container_of(ctx, struct getdents_callback64, ctx);
        int reclen = ALIGN(offsetof(struct linux_dirent64, d_name) + namlen + 1,
                sizeof(u64));