From patchwork Sun Apr 3 05:21:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 8733111 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 642DEC0553 for ; Sun, 3 Apr 2016 05:28:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4E3AC20251 for ; Sun, 3 Apr 2016 05:28:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 342B3200D9 for ; Sun, 3 Apr 2016 05:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753087AbcDCF16 (ORCPT ); Sun, 3 Apr 2016 01:27:58 -0400 Received: from mail-ig0-f196.google.com ([209.85.213.196]:32966 "EHLO mail-ig0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752083AbcDCFXj (ORCPT ); Sun, 3 Apr 2016 01:23:39 -0400 Received: by mail-ig0-f196.google.com with SMTP id nt3so7656562igb.0; Sat, 02 Apr 2016 22:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DySFIuo8VuR+ptnPj92Uw8Cl2WxYDAXKEZIVLOLPOEc=; b=VBHYZalGzkcA9ZJmG8lXd+cyIa/xamGBWX7U4Jt6XShqEiSgFdhglzhnfHlWO96df+ W/zXpwNjyDrzxr+gDsF0R4y4Y1Pv5tz/30hpbWiMObBK3T/9RZQGyYH7KNg3e5/0JfDB J9cqMgUi/mFW0LRzLdA7vThWwrxBmp86TxAgSRmF0sdxtr4EjulrE3m04fLPvygh6tBX nX3hwLfhaiHE2DrFLxLZOgXYsyFLnBhJ4G2BudW2mltBfbsDk4TOo9fC75EtV+psQOWc clMa0cv+CE4SgyAAIhZE1TJRzXsjcxjpAy8YKDMTKlNtf1CdU0vKihEZ4QwsA0HHouMG 2lsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=DySFIuo8VuR+ptnPj92Uw8Cl2WxYDAXKEZIVLOLPOEc=; b=dD5cS97f7Zb2vQ4bxQ69dw2vzvqJxlVFTouORQuMCxNrv/nd2WMMkLULDJr4+aKYwm wsYUB60TQuZxrBCe0tPcP7jivmvlm5F8MTqvfEEMcMOuBKk1NsUK3cKOu1SyMrlqfHZk HUWInig9QFusJmlDElUXOCpCVkPBx5Q/Yi1Mqf7PSzwoxZPrkYD6gvgENutxstsLQf1J GXPeWuxdXTVyeJsSmQokxqoI8w96T+0M+1A6QNpIjDoWKzxSykpMG9kZA81NHdc40vr0 UAYnsF+PYN3eyFMIC3cHSPbchpZ0rxNmqelTa/QEwPB73geZZcPLUqKAdNjxIeeMQbQA 1wXQ== X-Gm-Message-State: AD7BkJJIqSEJXQMhmYxGgcrQ8lSKXa/5EQ02c0AVnhSWIEEYAyWfweos8yKJ2Zr5CRTvFA== X-Received: by 10.50.47.82 with SMTP id b18mr4863563ign.41.1459661018095; Sat, 02 Apr 2016 22:23:38 -0700 (PDT) Received: from localhost.localdomain (c-24-7-245-123.hsd1.mn.comcast.net. [24.7.245.123]) by smtp.gmail.com with ESMTPSA id je6sm2914954igb.15.2016.04.02.22.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 02 Apr 2016 22:23:37 -0700 (PDT) From: Eric Biggers To: linux-fsdevel@vger.kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, jaegeuk@kernel.org, tytso@mit.edu, mhalcrow@google.com, Eric Biggers Subject: [PATCH 02/13] fscrypto: rename some functions for clarity Date: Sun, 3 Apr 2016 00:21:53 -0500 Message-Id: <1459660924-2960-3-git-send-email-ebiggers3@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1459660924-2960-1-git-send-email-ebiggers3@gmail.com> References: <1459660924-2960-1-git-send-email-ebiggers3@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Rename fscrypt_complete() to page_crypt_complete(). This callback is specifically for data pages; fscrypto also performs filename encryption. Rename dir_crypt_complete() to fname_crypt_complete(). This callback is also used for symlink targets, not just directory entries. Rename fscrypt_process_policy() to fscrypt_set_policy(). The new name better matches the ioctl, and it goes along with fscrypt_get_policy(). Signed-off-by: Eric Biggers --- fs/crypto/crypto.c | 11 ++++++----- fs/crypto/fname.c | 11 +++++++---- fs/crypto/policy.c | 5 ++--- fs/f2fs/f2fs.h | 2 +- fs/f2fs/file.c | 2 +- include/linux/fscrypto.h | 5 ++--- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 2c7923d..6e550ec 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -125,11 +125,12 @@ struct fscrypt_ctx *fscrypt_get_ctx(struct inode *inode) EXPORT_SYMBOL(fscrypt_get_ctx); /** - * fscrypt_complete() - The completion callback for page encryption - * @req: The asynchronous encryption request context - * @res: The result of the encryption operation + * page_crypt_complete() - The completion callback for page encryption and + * decryption + * @req: The asynchronous cipher request context + * @res: The result of the cipher operation */ -static void fscrypt_complete(struct crypto_async_request *req, int res) +static void page_crypt_complete(struct crypto_async_request *req, int res) { struct fscrypt_completion_result *ecr = req->data; @@ -166,7 +167,7 @@ static int do_page_crypto(struct inode *inode, skcipher_request_set_callback( req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, - fscrypt_complete, &ecr); + page_crypt_complete, &ecr); BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index)); memcpy(xts_tweak, &index, sizeof(index)); diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index 3108806..c3e3554 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -20,9 +20,12 @@ static u32 size_round_up(size_t size, size_t blksize) } /** - * dir_crypt_complete() - + * fname_crypt_complete() - The completion callback for filename encryption and + * decryption + * @req: The asynchronous cipher request context + * @res: The result of the cipher operation */ -static void dir_crypt_complete(struct crypto_async_request *req, int res) +static void fname_crypt_complete(struct crypto_async_request *req, int res) { struct fscrypt_completion_result *ecr = req->data; @@ -82,7 +85,7 @@ static int fname_encrypt(struct inode *inode, } skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, - dir_crypt_complete, &ecr); + fname_crypt_complete, &ecr); /* Copy the input */ memcpy(workbuf, iname->name, iname->len); @@ -144,7 +147,7 @@ static int fname_decrypt(struct inode *inode, } skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, - dir_crypt_complete, &ecr); + fname_crypt_complete, &ecr); /* Initialize IV */ memset(iv, 0, FS_CRYPTO_BLOCK_SIZE); diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index 0f9961e..e1d263d 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -92,8 +92,7 @@ static int create_encryption_context_from_policy(struct inode *inode, return inode->i_sb->s_cop->set_context(inode, &ctx, sizeof(ctx), NULL); } -int fscrypt_process_policy(struct inode *inode, - const struct fscrypt_policy *policy) +int fscrypt_set_policy(struct inode *inode, const struct fscrypt_policy *policy) { if (policy->version != 0) return -EINVAL; @@ -113,7 +112,7 @@ int fscrypt_process_policy(struct inode *inode, __func__); return -EINVAL; } -EXPORT_SYMBOL(fscrypt_process_policy); +EXPORT_SYMBOL(fscrypt_set_policy); int fscrypt_get_policy(struct inode *inode, struct fscrypt_policy *policy) { diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index bbe2cd1..970678d 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -2172,7 +2172,7 @@ static inline bool f2fs_may_encrypt(struct inode *inode) #define fscrypt_pullback_bio_page fscrypt_notsupp_pullback_bio_page #define fscrypt_restore_control_page fscrypt_notsupp_restore_control_page #define fscrypt_zeroout_range fscrypt_notsupp_zeroout_range -#define fscrypt_process_policy fscrypt_notsupp_process_policy +#define fscrypt_set_policy fscrypt_notsupp_set_policy #define fscrypt_get_policy fscrypt_notsupp_get_policy #define fscrypt_has_permitted_context fscrypt_notsupp_has_permitted_context #define fscrypt_inherit_context fscrypt_notsupp_inherit_context diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index b41c357..ea2c9a9 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1542,7 +1542,7 @@ static int f2fs_ioc_set_encryption_policy(struct file *filp, unsigned long arg) return -EFAULT; f2fs_update_time(F2FS_I_SB(inode), REQ_TIME); - return fscrypt_process_policy(inode, &policy); + return fscrypt_set_policy(inode, &policy); } static int f2fs_ioc_get_encryption_policy(struct file *filp, unsigned long arg) diff --git a/include/linux/fscrypto.h b/include/linux/fscrypto.h index cd91f75..4e7bc69 100644 --- a/include/linux/fscrypto.h +++ b/include/linux/fscrypto.h @@ -273,8 +273,7 @@ extern void fscrypt_restore_control_page(struct page *); extern int fscrypt_zeroout_range(struct inode *, pgoff_t, sector_t, unsigned int); /* policy.c */ -extern int fscrypt_process_policy(struct inode *, - const struct fscrypt_policy *); +extern int fscrypt_set_policy(struct inode *, const struct fscrypt_policy *); extern int fscrypt_get_policy(struct inode *, struct fscrypt_policy *); extern int fscrypt_has_permitted_context(struct inode *, struct inode *); extern int fscrypt_inherit_context(struct inode *, struct inode *, @@ -343,7 +342,7 @@ static inline int fscrypt_notsupp_zeroout_range(struct inode *i, pgoff_t p, } /* policy.c */ -static inline int fscrypt_notsupp_process_policy(struct inode *i, +static inline int fscrypt_notsupp_set_policy(struct inode *i, const struct fscrypt_policy *p) { return -EOPNOTSUPP;