From patchwork Fri Oct 21 12:48:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 9388869 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD861607F0 for ; Fri, 21 Oct 2016 12:49:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF5832A181 for ; Fri, 21 Oct 2016 12:49:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B448C2A183; Fri, 21 Oct 2016 12:49:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5363E2A181 for ; Fri, 21 Oct 2016 12:49:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933128AbcJUMtP (ORCPT ); Fri, 21 Oct 2016 08:49:15 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:45998 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932488AbcJUMtM (ORCPT ); Fri, 21 Oct 2016 08:49:12 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id 0091A24E0001; Fri, 21 Oct 2016 14:49:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail.sigma-star.at Received: from linux.site (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id E40C524E0004; Fri, 21 Oct 2016 14:49:07 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dedekind1@gmail.com, adrian.hunter@intel.com, tytso@mit.edu, jaegeuk@kernel.org, david@sigma-star.at, wd@denx.de, sbabic@denx.de, dengler@linutronix.de, Richard Weinberger Subject: [PATCH 02/26] fscrypto: Constify struct inode pointer Date: Fri, 21 Oct 2016 14:48:17 +0200 Message-Id: <1477054121-10198-3-git-send-email-richard@nod.at> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1477054121-10198-1-git-send-email-richard@nod.at> References: <1477054121-10198-1-git-send-email-richard@nod.at> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some filesystems, such as UBIFS, maintain a const pointer for struct inode. Signed-off-by: Richard Weinberger --- fs/crypto/crypto.c | 12 +++++++----- include/linux/fscrypto.h | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index 1c2f9516b4be..8c59912feebb 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -147,7 +147,7 @@ typedef enum { FS_ENCRYPT, } fscrypt_direction_t; -static int do_crypto(struct inode *inode, +static int do_crypto(const struct inode *inode, fscrypt_direction_t rw, pgoff_t index, struct scatterlist *src, struct scatterlist *dst, unsigned int cryptlen, gfp_t gfp_flags) @@ -212,7 +212,7 @@ static int do_page_crypto(struct inode *inode, return do_crypto(inode, rw, index, &src, &dst, PAGE_SIZE, gfp_flags); } -static int do_buf_crypto(struct inode *inode, +static int do_buf_crypto(const struct inode *inode, fscrypt_direction_t rw, pgoff_t index, const void *src_buf, const void *dst_buf, unsigned int buflen, gfp_t gfp_flags) @@ -287,7 +287,7 @@ errout: } EXPORT_SYMBOL(fscrypt_encrypt_page); -int fscrypt_encrypt_buffer(struct inode *inode, const void *plaintext_buf, +int fscrypt_encrypt_buffer(const struct inode *inode, const void *plaintext_buf, const void *ciphertext_buf, unsigned int buflen, pgoff_t index, gfp_t gfp_flags) { @@ -296,8 +296,10 @@ int fscrypt_encrypt_buffer(struct inode *inode, const void *plaintext_buf, } EXPORT_SYMBOL(fscrypt_encrypt_buffer); -int fscrypt_decrypt_buffer(struct inode *inode, const void *ciphertext_buf, - const void *plaintext_buf, unsigned int buflen, +int fscrypt_decrypt_buffer(const struct inode *inode, + const void *ciphertext_buf, + const void *plaintext_buf, + unsigned int buflen, pgoff_t index, gfp_t gfp_flags) { return do_buf_crypto(inode, FS_DECRYPT, index, ciphertext_buf, diff --git a/include/linux/fscrypto.h b/include/linux/fscrypto.h index a9628b4882e7..d18ee29cf69a 100644 --- a/include/linux/fscrypto.h +++ b/include/linux/fscrypto.h @@ -273,11 +273,13 @@ extern void fscrypt_pullback_bio_page(struct page **, bool); extern void fscrypt_restore_control_page(struct page *); extern int fscrypt_zeroout_range(struct inode *, pgoff_t, sector_t, unsigned int); -int fscrypt_encrypt_buffer(struct inode *inode, const void *plaintext_buf, +int fscrypt_encrypt_buffer(const struct inode *inode, const void *plaintext_buf, const void *ciphertext_buf, unsigned int buflen, pgoff_t index, gfp_t gfp_flags); -int fscrypt_decrypt_buffer(struct inode *inode, const void *ciphertext_buf, - const void *plaintext_buf, unsigned int buflen, +int fscrypt_decrypt_buffer(const struct inode *inode, + const void *ciphertext_buf, + const void *plaintext_buf, + unsigned int buflen, pgoff_t index, gfp_t gfp_flags); /* policy.c */ extern int fscrypt_process_policy(struct file *, const struct fscrypt_policy *); @@ -291,8 +293,8 @@ extern int fscrypt_get_encryption_info(struct inode *); extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *); /* fname.c */ -extern int fscrypt_setup_filename(struct inode *, const struct qstr *, - int lookup, struct fscrypt_name *); +extern int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname, + int lookup, struct fscrypt_name *fname); extern void fscrypt_free_filename(struct fscrypt_name *); extern u32 fscrypt_fname_encrypted_size(struct inode *, u32); extern int fscrypt_fname_alloc_buffer(struct inode *, u32,