From patchwork Fri Jan 5 18:44:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10146955 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 D73166166D for ; Fri, 5 Jan 2018 18:57:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C398628537 for ; Fri, 5 Jan 2018 18:57:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86FF2893B; Fri, 5 Jan 2018 18:57:49 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 6731F28537 for ; Fri, 5 Jan 2018 18:57:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752612AbeAES5c (ORCPT ); Fri, 5 Jan 2018 13:57:32 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:35744 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752405AbeAES53 (ORCPT ); Fri, 5 Jan 2018 13:57:29 -0500 Received: by mail-it0-f66.google.com with SMTP id f143so2728367itb.0; Fri, 05 Jan 2018 10:57:28 -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=lxbLzj4fjedDf8hrfQ/8/DE3TcZx4J8kN1VmDJ1ue1E=; b=ZoOB148FPZzZFDRKT6QCW/qPtGPZ/46knbxQTMKG0SHw14WdhyPyVwDmzIR+zORv4T Rr+nV4sh0dRuO/uYCMCzdtzewH4r0YDtY3//Pzn6Na6jTc4pY1MUqW74LHyHxTRjeyU+ dNnxj/QAbc/lNRaJqeYRXCHHTcMmOinyV/MzGyg+Tnau5aOrtWuznG7dryI14jansJx8 jFAIudEWQDZGHYnrLXCBk0sJZjsw2/4ZEdNuF1G4YbpyejI+tynhtycdAeNOUlS/ogOA GzuCx4uerU538+8ESGrg9iDC9WY+acP8JRpyZpnO9q2Ptihi1u1l5ocKwNlpK/kD6mww ZdWg== 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=lxbLzj4fjedDf8hrfQ/8/DE3TcZx4J8kN1VmDJ1ue1E=; b=RwqF9f3bkcca5ASH2kSnHuK/9v1XQweB1NBYRsirQotQmWnQ0ETof/KZxQEhdMhvPK L9N/Lrwx2ooWaJkS8vh9L7zDmM4v0frNVtkp8s59Cs1j/x7cec1cjjsmu6x7yrFa7hVZ SfSC4m7/VlrirmyV4UXXv2FSmlivdwyOjwRBMc//SSrtJRKyiR9cLil/jzIGwOTMwuBS ZJQST7cW+1nd3vWQ22ilelEtree0V5CIq/6VPNCY8zgtx1MxzMKShfT3/cGJz84O6BuQ 9UYjodcGtK18HGegZow1o2/wKZwdL62mC5Ps1Cs1JqtyA8D2NBGR2Jnlo+Lpdoxc3jGT KSFQ== X-Gm-Message-State: AKGB3mJr2hPMe2Yos2OKqTqDdvqoye1Xvi55xeE+Gdahs+HtWsQbkQXu T3xTziiIp66p/RKgb5+dKQi64v0n X-Google-Smtp-Source: ACJfBot3wR8n90udh7JHE729Ihm2COhzk3HqEe4b2mBpAocTYnbWjDI2AxltaKOC1J9R9zQzoJt/Ng== X-Received: by 10.36.227.73 with SMTP id d70mr4087658ith.39.1515178647917; Fri, 05 Jan 2018 10:57:27 -0800 (PST) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.175.88]) by smtp.gmail.com with ESMTPSA id j68sm3863899iod.53.2018.01.05.10.57.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 10:57:27 -0800 (PST) From: Eric Biggers To: linux-fscrypt@vger.kernel.org, "Theodore Y . Ts'o" Cc: linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, Eric Biggers Subject: [PATCH v2 05/11] fscrypt: split fscrypt_dummy_context_enabled() into supp/notsupp versions Date: Fri, 5 Jan 2018 10:44:56 -0800 Message-Id: <20180105184502.48473-6-ebiggers3@gmail.com> X-Mailer: git-send-email 2.16.0.rc0.223.g4a4ac83678-goog In-Reply-To: <20180105184502.48473-1-ebiggers3@gmail.com> References: <20180105184502.48473-1-ebiggers3@gmail.com> 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 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 *);