From patchwork Fri Jan 5 18:44:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10146939 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 EE6F36166C for ; Fri, 5 Jan 2018 18:57:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB45028537 for ; Fri, 5 Jan 2018 18:57:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CFD052893A; Fri, 5 Jan 2018 18:57:31 +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=unavailable 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 8868428537 for ; Fri, 5 Jan 2018 18:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752349AbeAES52 (ORCPT ); Fri, 5 Jan 2018 13:57:28 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:44686 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752405AbeAES50 (ORCPT ); Fri, 5 Jan 2018 13:57:26 -0500 Received: by mail-it0-f66.google.com with SMTP id b5so2618433itc.3; Fri, 05 Jan 2018 10:57:25 -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=0xLSOSJVUDeYAAUSTkJpOVBx/+mD3eBaNWt7uGN9jCU=; b=Y/0YM3Us8E7FGNIbMjrpB0iq3oUe1VnoewdveeUEdEophQtVjnvNwYkzUSa79qzC4V Jbm4xWm24GMvqcvUvr2PTsOuti6JF3AZ6z32M17mHossDeEu5wo8/GfcdXTKitNs08ey ipCaPxyiJ+gBH71/EckLTq0o+5PctPlHkNGeiDJ3shjOLlAlFhFpjALolK2ma7101XRS f4nCUhJ3fpmBM8Lc4fw4jq7PZK/H3bTCpeLWwfHlDO79jbBeDBbi8Jw+2z0pesYVwYpc dNHvUKnyS28vRrZxvPx0UZGaOSrOWYo+inXqOxGVbHNTEk7I1CWh2tv5pjmLfMjkDD18 ShHQ== 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=0xLSOSJVUDeYAAUSTkJpOVBx/+mD3eBaNWt7uGN9jCU=; b=dRDYz+g4L2BgGql3N0GFpR7CCIhA7zVNrrTcQCAwU0/UeXzqR/jm0Fj+sxkc4i5hhD LbMcamdaKi634WzaD0fBDcjw2cJ5+Aa14XV7VFa4eDz/BeQx+aygA7wb0ZQKPebRU8cY /AYcixld/7cfZtJypaezycuNmuTryO5ce5odJ5Fqpisy8VseJsGF53msJpNcP/lCDame 4wVwRVwfvz/K7+wi+oVsMwWeXM0heTYVmPjDjJSauWprdJDC+dMD8apE/04RhwVM6lAu z+XMShPQmU26Dq/+WgHWUVQQ35VIMW4d1kq/VHoXILbUMbv2iJ18lVMEENNofoNGgAWD nK7w== X-Gm-Message-State: AKGB3mI+Hd9tuDV81MkTtsdTMUIs4sYhLzVDPCLn0Q1DfonWgNIV8vUb bHerzySo9PmBBer9hDmyiB3Y2Ct0 X-Google-Smtp-Source: ACJfBou4B0ooyJEsOzJM6zuqz6orBYnzJaIxZ4s/VeYDHF8oi3RfQDmtj4jTMQky1/ClDWSWEedTKg== X-Received: by 10.36.212.66 with SMTP id x63mr4169082itg.59.1515178644989; Fri, 05 Jan 2018 10:57:24 -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.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 10:57:24 -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 02/11] fscrypt: move fscrypt_control_page() to supp/notsupp headers Date: Fri, 5 Jan 2018 10:44:53 -0800 Message-Id: <20180105184502.48473-3-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-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;