X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=libcfs%2Flibcfs%2Fcrypto%2Fpolicy.c;h=5e744544f6b6e7873208ff48db452777acdb6c42;hb=f18c87cb5362496a4baadaa14265471c992ca06a;hp=8d209e202ac700cddefb77268c5f13ef8622aa8e;hpb=c60b7d9f571748fb055d29cd019709f9e965a84d;p=fs%2Flustre-release.git diff --git a/libcfs/libcfs/crypto/policy.c b/libcfs/libcfs/crypto/policy.c index 8d209e2..5e74454 100644 --- a/libcfs/libcfs/crypto/policy.c +++ b/libcfs/libcfs/crypto/policy.c @@ -282,6 +282,25 @@ static int set_encryption_policy(struct inode *inode, return lsi->lsi_cop->set_context(inode, &ctx, ctxsize, NULL); } +/* Tell if an inode's encryption policy has filename encryption */ +bool llcrypt_policy_has_filename_enc(struct inode *inode) +{ + union llcrypt_policy policy; + int err; + + err = llcrypt_get_policy(inode, &policy); + if (err) + return true; + + if ((policy.version == LLCRYPT_POLICY_V1 && + policy.v1.filenames_encryption_mode == LLCRYPT_MODE_NULL) || + (policy.version == LLCRYPT_POLICY_V2 && + policy.v2.filenames_encryption_mode == LLCRYPT_MODE_NULL)) + return false; + return true; +} +EXPORT_SYMBOL(llcrypt_policy_has_filename_enc); + int llcrypt_ioctl_set_policy(struct file *filp, const void __user *arg) { union llcrypt_policy policy;