Re: [PATCH v3 1/3] libfs: Add generic function for setting dentry_ops

From: Eric Biggers
Date: Wed Nov 18 2020 - 13:32:27 EST


On Wed, Nov 18, 2020 at 06:42:43AM +0000, Daniel Rosenberg wrote:
> +#if IS_ENABLED(CONFIG_UNICODE) && IS_ENABLED(CONFIG_FS_ENCRYPTION)
> +static const struct dentry_operations generic_encrypted_ci_dentry_ops = {
> + .d_hash = generic_ci_d_hash,
> + .d_compare = generic_ci_d_compare,
> + .d_revalidate = fscrypt_d_revalidate,
> +};
> +#endif

One nit: it would be good to change the #if condition above to:

#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)

... to make it identical to the #if condition later on:

> +#if defined(CONFIG_FS_ENCRYPTION) && defined(CONFIG_UNICODE)
> + if (needs_encrypt_ops && needs_ci_ops) {
> + d_set_d_op(dentry, &generic_encrypted_ci_dentry_ops);
> + return;
> + }
> #endif

It doesn't actually matter, but it's nice to keep things consistent.

Otherwise, please feel free to add:

Reviewed-by: Eric Biggers <ebiggers@xxxxxxxxxx>

- Eric