Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp233741pxb; Thu, 21 Apr 2022 22:39:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEJYomH+0+NfWf5xv5QVBOXkrcSpmNwGDxvtk7vgcfbEUJU73VlVd8cwnJQv9Wej5EghIQ X-Received: by 2002:a05:6a00:14c4:b0:50a:9524:67bf with SMTP id w4-20020a056a0014c400b0050a952467bfmr3186758pfu.55.1650605942639; Thu, 21 Apr 2022 22:39:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650605942; cv=none; d=google.com; s=arc-20160816; b=HFYnOaHo/yR/ntaoPbPYbASEF5dQ7bxTY3jgHGsL5lsj8KHheU7UjIaXugCiEpzPEf Kp89c/uNN7CI5TPZ1b5t1cJcYCrWyz5ZdcjW1W21/GpvsUShKDa6y5wbz6PmyrOIyU4j dV7binDImby7UjEDQ8HmgWVTrFabYETyIx1pR5BgHWlctVDgmtP5JqVrmpTw0vxpsBpY 2aiM3Ca8RIesPayFRPXYmN5Izl/V7jgI+8tOHLW7Nxr63Xu62hOwu6X+OwwPIDcLu/Ah 7aDL6/W6wj0r2CjLtBVhPd1rY+2qY75t46yJ52csLkenVc+G/lyI5gEb3L3Z4njr19cW GF4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=nAKdB7OlNBPLSXEPrWPj54rwnqnTQlbZgYB1Swf5oy4=; b=cInSKc1dxFQAUvlM1i1GSLtitiKAWSloHlBOKUwbVEgaYi3Dam9HlfmZwvTVqP+ssB nXq7NPXFIHni6h9OggQyN/COHMK474EOAU9fMAVkkuKcodfDBdz+AM26D0JX5Rt8cFil JdBEfrFGqcUc8CNkVWPfQ7+d0kex8rf6RpC8tZFtj2OD9+5bu7ptWow6Us2azdJq1IEh HFunz34V0lTHTzRgHk92FbdgWsgRtWTjYFipZKmkHzvDhUPldtF3PQJAWGptJU0qrReG 2kMtj1yjK1khBGOpE+3SAmlOy1nb89Hk3jEsshulSDkvyOpLUsl4VpohvHksbRFaj41c tOrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fkYbjCMv; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v10-20020a1709028d8a00b00158ec58e06csi7265912plo.519.2022.04.21.22.38.37; Thu, 21 Apr 2022 22:39:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fkYbjCMv; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384305AbiDUF0k (ORCPT + 99 others); Thu, 21 Apr 2022 01:26:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233065AbiDUF0k (ORCPT ); Thu, 21 Apr 2022 01:26:40 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB6F0DFB1; Wed, 20 Apr 2022 22:23:51 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id l127so3973641pfl.6; Wed, 20 Apr 2022 22:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nAKdB7OlNBPLSXEPrWPj54rwnqnTQlbZgYB1Swf5oy4=; b=fkYbjCMvDg0qkUwF8guksF3TwEPZnQCCyg+zk1xlXSgeArgoyfGnKnrKLPBs0qThB4 PolkXz0oOctKv/X/ci91Slc/6IT+N3IjoYoOm69wDvrw4lOmyzZ9EgEoKVnz1GDu+c5c 80TZHM6EVilHh7s/SX5B9ryEUVpRJ74FC6sBBO5oABST8iQTsmyzqjCv6VYrrb7IXByE cRMqcMlh8OVPdj2h4XfI82griaJfgzR/uoH/GlSl17BZ0Nac50F/xIeNtD8vsMHPPYyG xLSItzsmxjaW3G3TNSqtTdEb3qPlsW7NvVI/ovPauLyXaxx+KalgDgY0dwIKRD9tdEL8 znnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nAKdB7OlNBPLSXEPrWPj54rwnqnTQlbZgYB1Swf5oy4=; b=eR/6215F6R+KEK+iTJhuY2qJMJz0VYtHK58CEfTiP29/y2wXE7d/pC4lRqJS2kIlRQ TkeTzjAIVaIIau6WFOZgC6p2Z9tZXeOKxoBkzljQgibbvdM52IMYjU2vqVLDdQUVjrYx Xk+t4MDeWY9rgjuWWuaKOsy36TKcyScKSF0p2PG0KiDV0RkD4wR4L4JAHSDZs/GxYHKX +UOb40YeJJ5yvWqP/aAI6iMBc5P72n8WH60soeC7TQiLwmg69ZhR4R7yUlppD7+z3gTJ E+pNoKClmVxoiJ17zrLD2opw7z4P+Z2bqZfSaCjj2Wza/gcjFK8v5kzGuocBJNw6AlLb HW1A== X-Gm-Message-State: AOAM530J/Nsz8JPGU1QbArVRykItswIRvpqZgVDL99elStEEM8N9b1K5 KggepoH1wzZZ8DxLyBtUsdxF2pCkyo8= X-Received: by 2002:a63:3e0a:0:b0:3aa:646f:f445 with SMTP id l10-20020a633e0a000000b003aa646ff445mr6597605pga.30.1650518631381; Wed, 20 Apr 2022 22:23:51 -0700 (PDT) Received: from localhost ([2406:7400:63:fca5:5639:1911:2ab6:cfe6]) by smtp.gmail.com with ESMTPSA id w187-20020a6230c4000000b00505cde77826sm21554169pfw.159.2022.04.20.22.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 22:23:51 -0700 (PDT) From: Ritesh Harjani To: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org Cc: Eric Biggers , Theodore Ts'o , Jan Kara , Ritesh Harjani Subject: [RFC 4/6] ext4: Cleanup function defs from ext4.h into ext4_crypto.c Date: Thu, 21 Apr 2022 10:53:20 +0530 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Some of these functions when CONFIG_FS_ENCRYPTION is enabled are not really inline (let compiler be the best judge of it). Remove inline and move them into ext4_crypto.c where they should be present. Signed-off-by: Ritesh Harjani --- fs/ext4/ext4.h | 70 ++++--------------------------------------- fs/ext4/ext4_crypto.c | 65 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 64 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 8bac8af25ed8..caf154db4680 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2731,73 +2731,15 @@ extern int ext4_fname_setup_ci_filename(struct inode *dir, extern const struct fscrypt_operations ext4_cryptops; #ifdef CONFIG_FS_ENCRYPTION -static inline void ext4_fname_from_fscrypt_name(struct ext4_filename *dst, - const struct fscrypt_name *src) -{ - memset(dst, 0, sizeof(*dst)); - - dst->usr_fname = src->usr_fname; - dst->disk_name = src->disk_name; - dst->hinfo.hash = src->hash; - dst->hinfo.minor_hash = src->minor_hash; - dst->crypto_buf = src->crypto_buf; -} - -static inline int ext4_fname_setup_filename(struct inode *dir, - const struct qstr *iname, - int lookup, - struct ext4_filename *fname) -{ - struct fscrypt_name name; - int err; +int ext4_fname_setup_filename(struct inode *dir, + const struct qstr *iname, int lookup, + struct ext4_filename *fname); - err = fscrypt_setup_filename(dir, iname, lookup, &name); - if (err) - return err; +int ext4_fname_prepare_lookup(struct inode *dir, struct dentry *dentry, + struct ext4_filename *fname); - ext4_fname_from_fscrypt_name(fname, &name); +void ext4_fname_free_filename(struct ext4_filename *fname); -#if IS_ENABLED(CONFIG_UNICODE) - err = ext4_fname_setup_ci_filename(dir, iname, fname); -#endif - return err; -} - -static inline int ext4_fname_prepare_lookup(struct inode *dir, - struct dentry *dentry, - struct ext4_filename *fname) -{ - struct fscrypt_name name; - int err; - - err = fscrypt_prepare_lookup(dir, dentry, &name); - if (err) - return err; - - ext4_fname_from_fscrypt_name(fname, &name); - -#if IS_ENABLED(CONFIG_UNICODE) - err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname); -#endif - return err; -} - -static inline void ext4_fname_free_filename(struct ext4_filename *fname) -{ - struct fscrypt_name name; - - name.crypto_buf = fname->crypto_buf; - fscrypt_free_filename(&name); - - fname->crypto_buf.name = NULL; - fname->usr_fname = NULL; - fname->disk_name.name = NULL; - -#if IS_ENABLED(CONFIG_UNICODE) - kfree(fname->cf_name.name); - fname->cf_name.name = NULL; -#endif -} #else /* !CONFIG_FS_ENCRYPTION */ static inline int ext4_fname_setup_filename(struct inode *dir, const struct qstr *iname, diff --git a/fs/ext4/ext4_crypto.c b/fs/ext4/ext4_crypto.c index e5413c0970ee..7e89f86a4429 100644 --- a/fs/ext4/ext4_crypto.c +++ b/fs/ext4/ext4_crypto.c @@ -6,6 +6,71 @@ #include "xattr.h" #include "ext4_jbd2.h" +void ext4_fname_from_fscrypt_name(struct ext4_filename *dst, + const struct fscrypt_name *src) +{ + memset(dst, 0, sizeof(*dst)); + + dst->usr_fname = src->usr_fname; + dst->disk_name = src->disk_name; + dst->hinfo.hash = src->hash; + dst->hinfo.minor_hash = src->minor_hash; + dst->crypto_buf = src->crypto_buf; +} + +int ext4_fname_setup_filename(struct inode *dir, const struct qstr *iname, + int lookup, struct ext4_filename *fname) +{ + struct fscrypt_name name; + int err; + + err = fscrypt_setup_filename(dir, iname, lookup, &name); + if (err) + return err; + + ext4_fname_from_fscrypt_name(fname, &name); + +#if IS_ENABLED(CONFIG_UNICODE) + err = ext4_fname_setup_ci_filename(dir, iname, fname); +#endif + return err; +} + +int ext4_fname_prepare_lookup(struct inode *dir, struct dentry *dentry, + struct ext4_filename *fname) +{ + struct fscrypt_name name; + int err; + + err = fscrypt_prepare_lookup(dir, dentry, &name); + if (err) + return err; + + ext4_fname_from_fscrypt_name(fname, &name); + +#if IS_ENABLED(CONFIG_UNICODE) + err = ext4_fname_setup_ci_filename(dir, &dentry->d_name, fname); +#endif + return err; +} + +void ext4_fname_free_filename(struct ext4_filename *fname) +{ + struct fscrypt_name name; + + name.crypto_buf = fname->crypto_buf; + fscrypt_free_filename(&name); + + fname->crypto_buf.name = NULL; + fname->usr_fname = NULL; + fname->disk_name.name = NULL; + +#if IS_ENABLED(CONFIG_UNICODE) + kfree(fname->cf_name.name); + fname->cf_name.name = NULL; +#endif +} + static int ext4_get_context(struct inode *inode, void *ctx, size_t len) { return ext4_xattr_get(inode, EXT4_XATTR_INDEX_ENCRYPTION, -- 2.31.1