From patchwork Fri Jan 5 18:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10146975 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 D9AE8604AB for ; Fri, 5 Jan 2018 18:58:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C649C28537 for ; Fri, 5 Jan 2018 18:58:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB3192893A; Fri, 5 Jan 2018 18:58:05 +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 7641B28537 for ; Fri, 5 Jan 2018 18:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752639AbeAES5z (ORCPT ); Fri, 5 Jan 2018 13:57:55 -0500 Received: from mail-it0-f68.google.com ([209.85.214.68]:34641 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752574AbeAES5b (ORCPT ); Fri, 5 Jan 2018 13:57:31 -0500 Received: by mail-it0-f68.google.com with SMTP id m11so5345251iti.1; Fri, 05 Jan 2018 10:57:31 -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=KgBvEyJd8/fIHCE06sddhZZ0Cn9SbBkU8qPdLD8afBk=; b=qUDpNPaEQ0MVV7RKSh09T45+Wzq15ZDSMjSoAtLbfYPdy4r6zAxF8gnPm7tKJZVtCq N42xO3l0CcTFhpeK7l+nJ/oqoAj6k6BY7ASzR8ejg3oU9A+wJ2cgi2obIhC7Xc1UtcDX +Ajxac7DU3dnQP4ND4j93RhxCGOKkX2Qkmalyp89zzQNQ5pqEoHSsKA6w7sz5/CzbHu+ AqtPAdYHWbmdH9tSspy2auy23t4hj94wnV5pg56YG2RUIpACh3+IXpbKK/52zE6UvjPz kEsqlYWBFim8tj0gRq5fKXFDT8+Xy3kylDDhZfnKfelySgCOlYwIyOFG08GyhNy3vIAZ Sj/A== 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=KgBvEyJd8/fIHCE06sddhZZ0Cn9SbBkU8qPdLD8afBk=; b=cue0AAsr3Ur9rztWifaVntHtBWxkjvesGSSdEuwgjwqUPu/4jmO9pTa1AfaLnwHl1C 8+qEt04GvL9iJA4hQen7xTrbklZhhx+BsEHyuS25lcw7lYOmV3NEXy8MADn9hxpC33fc pfPxW8umInTAelT04sD2qHxalC2P8td4Of0hzxwnv+q7kjpK6CijYTdTF47WTIa17RVw /Y2M2zI+Mb0jR1v7uiJQFGvmpS1PLs0aXunoond0/gzdbhX/ssMYnwJ47VDGTW7aBhy7 phciZyP4ZPq/ZoPL1KtLgDBrJWk8glASOrjTIu8/ClIy3Jjrhh+RvRpcxHntCQBmskou fkLA== X-Gm-Message-State: AKGB3mLUzqnsSgqca2Gc2LZDRIb98IgE7njX2yMjRlnaC2nYcLcR8nRO mFhy9hGBdvxwud6ClluiKoJrjjgy X-Google-Smtp-Source: ACJfBouMUAkHH0DT1fAsQhyEMzo1TG3KIupepKIr7+UxQFDfEAyIdvYnPOam+gk7Ojyc9iE49dMQNw== X-Received: by 10.36.17.208 with SMTP id 199mr4003216itf.103.1515178650798; Fri, 05 Jan 2018 10:57:30 -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.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 05 Jan 2018 10:57:30 -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 08/11] fscrypt: move fscrypt_is_dot_dotdot() to fs/crypto/fname.c Date: Fri, 5 Jan 2018 10:44:59 -0800 Message-Id: <20180105184502.48473-9-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 Only fs/crypto/fname.c cares about treating the "." and ".." filenames specially with regards to encryption, so move fscrypt_is_dot_dotdot() from fscrypt.h to there. Signed-off-by: Eric Biggers --- fs/crypto/fname.c | 11 +++++++++++ include/linux/fscrypt.h | 11 ----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c index 305541bcd108..b8c5061553b1 100644 --- a/fs/crypto/fname.c +++ b/fs/crypto/fname.c @@ -15,6 +15,17 @@ #include #include "fscrypt_private.h" +static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) +{ + if (str->len == 1 && str->name[0] == '.') + return true; + + if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') + return true; + + return false; +} + /** * fname_encrypt() - encrypt a filename * diff --git a/include/linux/fscrypt.h b/include/linux/fscrypt.h index 2e4dce0365cf..3045fc49d3ca 100644 --- a/include/linux/fscrypt.h +++ b/include/linux/fscrypt.h @@ -57,17 +57,6 @@ struct fscrypt_name { /* Maximum value for the third parameter of fscrypt_operations.set_context(). */ #define FSCRYPT_SET_CONTEXT_MAX_SIZE 28 -static inline bool fscrypt_is_dot_dotdot(const struct qstr *str) -{ - if (str->len == 1 && str->name[0] == '.') - return true; - - if (str->len == 2 && str->name[0] == '.' && str->name[1] == '.') - return true; - - return false; -} - #if __FS_HAS_ENCRYPTION #include #else