fs: ecryptfs: readdir: constify actor
authorAmit Pundir <amit.pundir@linaro.org>
Fri, 13 Mar 2015 08:29:47 +0000 (13:59 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Fri, 13 Mar 2015 08:55:54 +0000 (14:25 +0530)
actor is a constant in dir_context struct and
because of that we run into following build failure:
----------
fs/ecryptfs/file.c: In function ‘ecryptfs_readdir’:
fs/ecryptfs/file.c:130:2: error: assignment of read-only member ‘actor’
make[2]: *** [fs/ecryptfs/file.o] Error 1
make[1]: *** [fs/ecryptfs] Error 2
make: *** [fs] Error 2
----------

This fix is based on commit: b2497fc3057a([readdir] constify ->actor)

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
fs/ecryptfs/file.c

index 041379a646b3c2fb89621b0fcaf3278365281c93..faa26beb1e4e52b99e2bdaccdd99a59f24e064b0 100644 (file)
@@ -116,18 +116,18 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir)
        int rc;
        struct file *lower_file;
        struct inode *inode;
-       struct ecryptfs_getdents_callback buf;
+       struct ecryptfs_getdents_callback buf = {
+               .dirent = dirent,
+               .dentry = file->f_path.dentry,
+               .filldir = filldir,
+               .filldir_called = 0,
+               .entries_written = 0,
+               .ctx.actor = ecryptfs_filldir
+       };
 
        lower_file = ecryptfs_file_to_lower(file);
        lower_file->f_pos = file->f_pos;
        inode = file_inode(file);
-       memset(&buf, 0, sizeof(buf));
-       buf.dirent = dirent;
-       buf.dentry = file->f_path.dentry;
-       buf.filldir = filldir;
-       buf.filldir_called = 0;
-       buf.entries_written = 0;
-       buf.ctx.actor = ecryptfs_filldir;
        rc = iterate_dir(lower_file, &buf.ctx);
        file->f_pos = lower_file->f_pos;
        if (rc < 0)