From patchwork Fri Dec 15 17:42:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10115685 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 17FF7603FA for ; Fri, 15 Dec 2017 17:46:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05B2029EE1 for ; Fri, 15 Dec 2017 17:46:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEB792A024; Fri, 15 Dec 2017 17:46:51 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 C28E029EE1 for ; Fri, 15 Dec 2017 17:46:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755987AbdLORqq (ORCPT ); Fri, 15 Dec 2017 12:46:46 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:41726 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755929AbdLORqo (ORCPT ); Fri, 15 Dec 2017 12:46:44 -0500 Received: by mail-pg0-f66.google.com with SMTP id o2so6250516pgc.8; Fri, 15 Dec 2017 09:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jUF/JQPTh3jsjB9deZnQDxzkKwQFRHw1TkpjONbJhq0=; b=lvAKQiIjQKWxYUf9Bw9LDyTGrH3E1dOJlWBu8lkINDW0oLuTxvCYjrf82AHSL3w1Id zqhr8TWvfrmuS1BIYaZRhZz2EN41llSrUH34jgPLaEpJAE1qpYiG+K6aFmdJ4OHiVl4B KDegWoatDVupJlqmv95xrYF9frPQYOI7M7zjzihZjOAiTWQzP6Yvdr8SLVBv3usYqBZD Xn/jUHAt/AU1KwtNIJQOLLIJ6xBOP6Oh1P3LdzBJT2joVG+31cst0oK4XsCXaEEisfEe KZ9p8N7odP1H01C7mJ25BZOV+r+WtVSa9L3yJp9bS8BlySiK9wEa9FBZSqL6MPu3kAmF lyGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jUF/JQPTh3jsjB9deZnQDxzkKwQFRHw1TkpjONbJhq0=; b=UxS/0NiKPV9aeWQ2fKJsQhiQZgN5ft6qwa86iqUSz2uEF1c/6M+l0+Tm3qr5O60hPu pMCqn2i8PW2PVjEo4L4eAhk6/O7M9vEq/aRMtEZ68KUaVGsBWQYtC/QBhz8mMrwjJ0ml 4iZyHb/XGHj5g1noMXQMPmuYNmG0m+VSD0nUreNP+3AwZeYnt0G9jPEKk12m6aXyJrfD dtBO9ypeG1/39th+zaJtSP0RHZcFs4xn6xwj67zZdDojxV9RbLPu96mbnCIeGcTFIxIL ghTqLFFSPEZIlPMu9RFCPyNEYGC8hOvqZ9ZWRgvk+Ye9yM7LAm/T9bQwvFuoI/SgTheL fyuA== X-Gm-Message-State: AKGB3mJHM5rl+NkyxCuCB6hocDCAK1kberUO/s1mEfyEM+eS9P2KJBuu 8b3jN91Wu6CfwuCGZvvOibJ9bB7ODKo= X-Google-Smtp-Source: ACJfBovycMjo33zEdGuc8VZJLjWq41yERuy3ioTh3qlrHos3Zx2LAYVFEzucVR2wuc5Rerh/+Bke4w== X-Received: by 10.98.59.139 with SMTP id w11mr14365722pfj.188.1513360003204; Fri, 15 Dec 2017 09:46:43 -0800 (PST) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id j62sm12980149pfc.18.2017.12.15.09.46.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 09:46:42 -0800 (PST) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 05/24] fscrypt: split fscrypt_dummy_context_enabled() into supp/notsupp versions Date: Fri, 15 Dec 2017 09:42:06 -0800 Message-Id: <20171215174225.31583-6-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171215174225.31583-1-ebiggers3@gmail.com> References: <20171215174225.31583-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers fscrypt_dummy_context_enabled() accesses ->s_cop, which now is only set when the filesystem is built with encryption support. This didn't actually matter because no filesystems called it. However, it will start being used soon, so fix it by moving it from fscrypt.h to fscrypt_supp.h and stubbing it out in fscrypt_notsupp.h. Signed-off-by: Eric Biggers --- include/linux/fscrypt.h | 8 -------- include/linux/fscrypt_notsupp.h | 5 +++++ include/linux/fscrypt_supp.h | 6 ++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index 0f94d087a6d1..b671a4eef47f 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -75,14 +75,6 @@ struct fscrypt_operations { /* Maximum value for the third parameter of fscrypt_operations.set_context(). */ #define FSCRYPT_SET_CONTEXT_MAX_SIZE 28 -static inline bool fscrypt_dummy_context_enabled(struct inode *inode) -{ - if (inode->i_sb->s_cop->dummy_context && - inode->i_sb->s_cop->dummy_context(inode)) - return true; - return false; -} - static inline bool fscrypt_valid_enc_modes(u32 contents_mode, u32 filenames_mode) { diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h index 812dc701a5b3..81e02201b215 100644 --- a/include/linux/fscrypt_notsupp.h +++ b/include/linux/fscrypt_notsupp.h @@ -19,6 +19,11 @@ static inline bool fscrypt_has_encryption_key(const struct inode *inode) return false; } +static inline bool fscrypt_dummy_context_enabled(struct inode *inode) +{ + return false; +} + /* crypto.c */ static inline struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *inode, gfp_t gfp_flags) diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h index fd6ee089ced0..e7dfa2974906 100644 --- a/include/linux/fscrypt_supp.h +++ b/include/linux/fscrypt_supp.h @@ -31,6 +31,12 @@ static inline bool fscrypt_has_encryption_key(const struct inode *inode) return (inode->i_crypt_info != NULL); } +static inline bool fscrypt_dummy_context_enabled(struct inode *inode) +{ + return inode->i_sb->s_cop->dummy_context && + inode->i_sb->s_cop->dummy_context(inode); +} + /* crypto.c */ extern struct fscrypt_ctx *fscrypt_get_ctx(const struct inode *, gfp_t); extern void fscrypt_release_ctx(struct fscrypt_ctx *);