ecryptfs: switch ecryptfs_decode_and_decrypt_filename() from dentry to sb
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 16 Jun 2013 16:05:38 +0000 (20:05 +0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 29 Jun 2013 08:57:25 +0000 (12:57 +0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/ecryptfs/crypto.c
fs/ecryptfs/ecryptfs_kernel.h
fs/ecryptfs/file.c
fs/ecryptfs/inode.c

index f71ec125290db7da87355f444f7308826ee1c034..cfa109a4d5a21ac6f784f1a4e8a16b534c9e8d0d 100644 (file)
@@ -2243,12 +2243,11 @@ out:
  */
 int ecryptfs_decode_and_decrypt_filename(char **plaintext_name,
                                         size_t *plaintext_name_size,
-                                        struct dentry *ecryptfs_dir_dentry,
+                                        struct super_block *sb,
                                         const char *name, size_t name_size)
 {
        struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
-               &ecryptfs_superblock_to_private(
-                       ecryptfs_dir_dentry->d_sb)->mount_crypt_stat;
+               &ecryptfs_superblock_to_private(sb)->mount_crypt_stat;
        char *decoded_name;
        size_t decoded_name_size;
        size_t packet_size;
index f622a733f7adc3ff1778e4f74790db507c61c824..df19d34a033b9521de8623bb33ff2de6c0d9361a 100644 (file)
@@ -575,7 +575,7 @@ int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry,
                             struct inode *ecryptfs_inode);
 int ecryptfs_decode_and_decrypt_filename(char **decrypted_name,
                                         size_t *decrypted_name_size,
-                                        struct dentry *ecryptfs_dentry,
+                                        struct super_block *sb,
                                         const char *name, size_t name_size);
 int ecryptfs_fill_zeros(struct file *file, loff_t new_length);
 int ecryptfs_encrypt_and_encode_filename(
index 9aa05e08060b507f05f17a5b464fb1f695c7e3e4..24f1105fda3ab5edfccc7a748f97dd624bf6f0fb 100644 (file)
@@ -70,7 +70,7 @@ static ssize_t ecryptfs_read_update_atime(struct kiocb *iocb,
 struct ecryptfs_getdents_callback {
        struct dir_context ctx;
        struct dir_context *caller;
-       struct dentry *dentry;
+       struct super_block *sb;
        int filldir_called;
        int entries_written;
 };
@@ -88,7 +88,7 @@ ecryptfs_filldir(void *dirent, const char *lower_name, int lower_namelen,
 
        buf->filldir_called++;
        rc = ecryptfs_decode_and_decrypt_filename(&name, &name_size,
-                                                 buf->dentry, lower_name,
+                                                 buf->sb, lower_name,
                                                  lower_namelen);
        if (rc) {
                printk(KERN_ERR "%s: Error attempting to decode and decrypt "
@@ -114,15 +114,14 @@ static int ecryptfs_readdir(struct file *file, struct dir_context *ctx)
 {
        int rc;
        struct file *lower_file;
-       struct inode *inode;
+       struct inode *inode = file_inode(file);
        struct ecryptfs_getdents_callback buf = {
                .ctx.actor = ecryptfs_filldir,
                .caller = ctx,
-               .dentry = file->f_path.dentry
+               .sb = inode->i_sb,
        };
        lower_file = ecryptfs_file_to_lower(file);
        lower_file->f_pos = ctx->pos;
-       inode = file_inode(file);
        rc = iterate_dir(lower_file, &buf.ctx);
        ctx->pos = buf.ctx.pos;
        if (rc < 0)
index 5eab400e25903b71641d4a056254c79f3a776885..a2f2bb2c256dd24cf8a9e597cbbe7f97a290f282 100644 (file)
@@ -679,7 +679,7 @@ static int ecryptfs_readlink_lower(struct dentry *dentry, char **buf,
        set_fs(old_fs);
        if (rc < 0)
                goto out;
-       rc = ecryptfs_decode_and_decrypt_filename(buf, bufsiz, dentry,
+       rc = ecryptfs_decode_and_decrypt_filename(buf, bufsiz, dentry->d_sb,
                                                  lower_buf, rc);
 out:
        kfree(lower_buf);