Commit bb9cd910 authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Jaegeuk Kim
Browse files

fscrypt: Have filesystems handle their d_ops



This shifts the responsibility of setting up dentry operations from
fscrypt to the individual filesystems, allowing them to have their own
operations while still setting fscrypt's d_revalidate as appropriate.

Most filesystems can just use generic_set_encrypted_ci_d_ops, unless
they have their own specific dentry operations as well. That operation
will set the minimal d_ops required under the circumstances.

Since the fscrypt d_ops are set later on, we must set all d_ops there,
since we cannot adjust those later on. This should not result in any
change in behavior.

Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Acked-by: default avatarTheodore Ts'o <tytso@mit.edu>
Acked-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 608af703
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -570,7 +570,3 @@ int fscrypt_d_revalidate(struct dentry *dentry, unsigned int flags)
	return valid;
}
EXPORT_SYMBOL_GPL(fscrypt_d_revalidate);

const struct dentry_operations fscrypt_d_ops = {
	.d_revalidate = fscrypt_d_revalidate,
};
+0 −1
Original line number Diff line number Diff line
@@ -294,7 +294,6 @@ int fscrypt_fname_encrypt(const struct inode *inode, const struct qstr *iname,
bool fscrypt_fname_encrypted_size(const union fscrypt_policy *policy,
				  u32 orig_len, u32 max_len,
				  u32 *encrypted_len_ret);
extern const struct dentry_operations fscrypt_d_ops;

/* hkdf.c */

+0 −1
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry,
		spin_lock(&dentry->d_lock);
		dentry->d_flags |= DCACHE_NOKEY_NAME;
		spin_unlock(&dentry->d_lock);
		d_set_d_op(dentry, &fscrypt_d_ops);
	}
	return err;
}
+0 −7
Original line number Diff line number Diff line
@@ -667,10 +667,3 @@ const struct file_operations ext4_dir_operations = {
	.open		= ext4_dir_open,
	.release	= ext4_release_dir,
};

#ifdef CONFIG_UNICODE
const struct dentry_operations ext4_dentry_ops = {
	.d_hash = generic_ci_d_hash,
	.d_compare = generic_ci_d_compare,
};
#endif
+0 −4
Original line number Diff line number Diff line
@@ -3354,10 +3354,6 @@ static inline void ext4_unlock_group(struct super_block *sb,
/* dir.c */
extern const struct file_operations ext4_dir_operations;

#ifdef CONFIG_UNICODE
extern const struct dentry_operations ext4_dentry_ops;
#endif

/* file.c */
extern const struct inode_operations ext4_file_inode_operations;
extern const struct file_operations ext4_file_operations;
Loading