From patchwork Fri Dec 15 17:42:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10115677 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 80A38603FA for ; Fri, 15 Dec 2017 17:46:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EA0329EE1 for ; Fri, 15 Dec 2017 17:46:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6397B2A024; Fri, 15 Dec 2017 17:46:43 +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 0E2C229F27 for ; Fri, 15 Dec 2017 17:46:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755684AbdLORqm (ORCPT ); Fri, 15 Dec 2017 12:46:42 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:43098 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755711AbdLORqk (ORCPT ); Fri, 15 Dec 2017 12:46:40 -0500 Received: by mail-pf0-f193.google.com with SMTP id e3so6624618pfi.10; Fri, 15 Dec 2017 09:46:40 -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=rsxzDNudjN80MY7iFZbgphGahp25D0gfAQr8C1E+Ets=; b=gUDYHweHyH/IAmwmamNabgiXg9fFEiHdawj4rFctBsXxfsxN1PADC8GN+J9sTwmNnC YLiCZmwiXxE17BcwdZIA4pn8o3+7ivB8oYvWtxIvIfGMKMiWuyv75UDtSKc1INtECQ08 o0umDyUIttJzSAcYMpnvLaV30hdw/oUDSyMtvN5gUERcliGytPzV5aY2Ni7wTA/bbL4b 8XbQnhU/442nSN7mOkqr56R3d5f5nFdE5kYfj14gswWZFThFc0ykUQkm0AeF82hZJH9C /o5R3vYdkcxGxrKpnNmkvkrzn70aDVuHFXe80jGsNBz7Tuf2EtAl5Po3AoKHBUopF1i8 2khw== 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=rsxzDNudjN80MY7iFZbgphGahp25D0gfAQr8C1E+Ets=; b=V/TyaCnrLJePsRG5xGM6UmuPr9EgxPCV3A1npB9yKGTGyLzPi6bdy6Oqd/mVS+8ANN oV/p0S+gO2o1VzTynyTxy/7XnEClwfTRnsKp++S1ABU+c2xnpDeIOfHRF8adtCKvAWWz IEGZTylzsuJuKShFwJyOVUdRY5yFad5PGz51jTfkkFp7z9lxEFa76CMSnVxxgvFPQ7+M Mo4jEn1CDNn8/INjkxb1WhvrGI4KIhMIwHeZiBrUv8FKu01yiOsKubSeqcBLKaPxeZZk 3j9zqW1JaxFf87EMa4IenjbiX1+Ohfexda83c68Yf9LZwx7awg0pa9wN91DJ7sEqNICc P5NQ== X-Gm-Message-State: AKGB3mI2nGyp1H7J3BnBUKeYTlRTNtTlVfLZKuyjaqI8cZCE9acQB0vk QFymhGhFtkY8LuXy2/Xa/f5dlM3v908= X-Google-Smtp-Source: ACJfBos18Fa/qitVkwy5zp2RL9g5vNSaqrQf+NcSYQvu5fT0rrDXHRV9cE9CfskiVXUrMaz+n5/OGw== X-Received: by 10.159.249.9 with SMTP id bf9mr13618297plb.86.1513360000104; Fri, 15 Dec 2017 09:46:40 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 09:46:39 -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 02/24] fscrypt: move fscrypt_control_page() to supp/notsupp headers Date: Fri, 15 Dec 2017 09:42:03 -0800 Message-Id: <20171215174225.31583-3-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_control_page() is already split into two versions depending on whether the filesystem is being built with encryption support or not. Move them into the appropriate headers. Signed-off-by: Eric Biggers --- include/linux/fscrypt.h | 18 ++---------------- include/linux/fscrypt_notsupp.h | 5 +++++ include/linux/fscrypt_supp.h | 6 ++++++ 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index d1c891b5bd9c..c23b2f16129a 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -123,24 +123,10 @@ static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) } #if __FS_HAS_ENCRYPTION - -static inline struct page *fscrypt_control_page(struct page *page) -{ - return ((struct fscrypt_ctx *)page_private(page))->w.control_page; -} - #include - -#else /* !__FS_HAS_ENCRYPTION */ - -static inline struct page *fscrypt_control_page(struct page *page) -{ - WARN_ON_ONCE(1); - return ERR_PTR(-EINVAL); -} - +#else #include -#endif /* __FS_HAS_ENCRYPTION */ +#endif /** * fscrypt_require_key - require an inode's encryption key diff --git a/include/linux/fscrypt_notsupp.h b/include/linux/fscrypt_notsupp.h index 52e330285457..812dc701a5b3 100644 --- a/include/linux/fscrypt_notsupp.h +++ b/include/linux/fscrypt_notsupp.h @@ -48,6 +48,11 @@ static inline int fscrypt_decrypt_page(const struct inode *inode, return -EOPNOTSUPP; } +static inline struct page *fscrypt_control_page(struct page *page) +{ + WARN_ON_ONCE(1); + return ERR_PTR(-EINVAL); +} static inline void fscrypt_restore_control_page(struct page *page) { diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h index 79bb8beae018..ad40780d4653 100644 --- a/include/linux/fscrypt_supp.h +++ b/include/linux/fscrypt_supp.h @@ -25,6 +25,12 @@ extern struct page *fscrypt_encrypt_page(const struct inode *, struct page *, u64, gfp_t); extern int fscrypt_decrypt_page(const struct inode *, struct page *, unsigned int, unsigned int, u64); + +static inline struct page *fscrypt_control_page(struct page *page) +{ + return ((struct fscrypt_ctx *)page_private(page))->w.control_page; +} + extern void fscrypt_restore_control_page(struct page *); extern const struct dentry_operations fscrypt_d_ops;