From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F52EC38A24 for ; Thu, 7 May 2020 12:19:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F1B0208E4 for ; Thu, 7 May 2020 12:19:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="YX3pLZyP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726451AbgEGMTc (ORCPT ); Thu, 7 May 2020 08:19:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725857AbgEGMTb (ORCPT ); Thu, 7 May 2020 08:19:31 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2FB7C05BD43 for ; Thu, 7 May 2020 05:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=mzsJwHWYv2UKkw+xMDOojM+b8uTWu/IjQRuebgtn4kg=; b=YX3pLZyPvB3JDDbWT78D8283Yh dSF35qozw0lqYcM3v1+eaE/oU3QhpLRZMbeUkeUkbF6JTWR/IUBs8hNs2uca31pyJJ0iHROfH3sQ1 3ESfY5ZdfuJtKuYzb1OwecqMOPi8ENePomqr8TmDajwqEKSNy0kEIVyTcJ8SlY7ADs5GgQFpOPZpD D6PNCRJoOD8lCwOJFzeQq6dmtgUgzolWXMcNqOi9JQlUy2nE2rJdCE5EtcXdwkQoq8bTd5qX4B++W BV5SDjTvtMbq2OrNezMcXKH6eZdzg6nUeSQgjGwglT/tqkrq7IiIWREtA4tuk1qK/vKER5g/hIqTv SKCvvz5Q==; Received: from [2001:4bb8:180:9d3f:c70:4a89:bc61:2] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWfUx-00059L-6c; Thu, 07 May 2020 12:19:31 +0000 From: Christoph Hellwig To: sandeen@sandeen.net Cc: linux-xfs@vger.kernel.org, Dave Chinner , Chandan Rajendra , "Darrick J . Wong" Subject: [PATCH 15/58] xfs: remove ATTR_KERNOVAL Date: Thu, 7 May 2020 14:18:08 +0200 Message-Id: <20200507121851.304002-16-hch@lst.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200507121851.304002-1-hch@lst.de> References: <20200507121851.304002-1-hch@lst.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org Source kernel commit: e513e25c380ab98d401714077c8b8ff4dae9f98b We can just pass down the Linux convention of a zero valuelen to just query for the existance of an attribute to the low-level code instead. The use in the legacy xfs_attr_list code only used by the ioctl interface was already dead code, as the callers check that the flag is not present. Signed-off-by: Christoph Hellwig Reviewed-by: Dave Chinner Reviewed-by: Chandan Rajendra Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Christoph Hellwig --- libxfs/xfs_attr.c | 8 ++++---- libxfs/xfs_attr.h | 4 +--- libxfs/xfs_attr_leaf.c | 14 +++++++------- libxfs/xfs_attr_remote.c | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/libxfs/xfs_attr.c b/libxfs/xfs_attr.c index d18efb22..72e25256 100644 --- a/libxfs/xfs_attr.c +++ b/libxfs/xfs_attr.c @@ -94,9 +94,9 @@ xfs_attr_get_ilocked( /* * Retrieve an extended attribute by name, and its value if requested. * - * If ATTR_KERNOVAL is set in args->flags, then the caller does not want the - * value, just an indication whether the attribute exists and the size of the - * value if it exists. The size is returned in args.valuelen. + * If args->valuelen is zero, then the caller does not want the value, just an + * indication whether the attribute exists and the size of the value if it + * exists. The size is returned in args.valuelen. * * If the attribute is found, but exceeds the size limit set by the caller in * args->valuelen, return -ERANGE with the size of the attribute that was found @@ -115,7 +115,7 @@ xfs_attr_get( uint lock_mode; int error; - ASSERT((args->flags & (ATTR_ALLOC | ATTR_KERNOVAL)) || args->value); + ASSERT((args->flags & ATTR_ALLOC) || !args->valuelen || args->value); XFS_STATS_INC(args->dp->i_mount, xs_attr_get); diff --git a/libxfs/xfs_attr.h b/libxfs/xfs_attr.h index b8c4ed27..fe064cd8 100644 --- a/libxfs/xfs_attr.h +++ b/libxfs/xfs_attr.h @@ -34,12 +34,11 @@ struct xfs_attr_list_context; #define ATTR_REPLACE 0x0020 /* pure set: fail if attr does not exist */ #define ATTR_KERNOTIME 0x1000 /* [kernel] don't update inode timestamps */ -#define ATTR_KERNOVAL 0x2000 /* [kernel] get attr size only, not value */ #define ATTR_ALLOC 0x8000 /* [kernel] allocate xattr buffer on demand */ #define ATTR_KERNEL_FLAGS \ - (ATTR_KERNOTIME | ATTR_KERNOVAL | ATTR_ALLOC) + (ATTR_KERNOTIME | ATTR_ALLOC) #define XFS_ATTR_FLAGS \ { ATTR_DONTFOLLOW, "DONTFOLLOW" }, \ @@ -49,7 +48,6 @@ struct xfs_attr_list_context; { ATTR_CREATE, "CREATE" }, \ { ATTR_REPLACE, "REPLACE" }, \ { ATTR_KERNOTIME, "KERNOTIME" }, \ - { ATTR_KERNOVAL, "KERNOVAL" }, \ { ATTR_ALLOC, "ALLOC" } /* diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 541a1fff..8e07e2a0 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -461,7 +461,7 @@ xfs_attr_copy_value( /* * No copy if all we have to do is get the length */ - if (args->flags & ATTR_KERNOVAL) { + if (!args->valuelen) { args->valuelen = valuelen; return 0; } @@ -827,9 +827,9 @@ xfs_attr_shortform_lookup(xfs_da_args_t *args) /* * Retrieve the attribute value and length. * - * If ATTR_KERNOVAL is specified, only the length needs to be returned. - * Unlike a lookup, we only return an error if the attribute does not - * exist or we can't retrieve the value. + * If args->valuelen is zero, only the length needs to be returned. Unlike a + * lookup, we only return an error if the attribute does not exist or we can't + * retrieve the value. */ int xfs_attr_shortform_getvalue( @@ -2441,9 +2441,9 @@ xfs_attr3_leaf_lookup_int( * Get the value associated with an attribute name from a leaf attribute * list structure. * - * If ATTR_KERNOVAL is specified, only the length needs to be returned. - * Unlike a lookup, we only return an error if the attribute does not - * exist or we can't retrieve the value. + * If args->valuelen is zero, only the length needs to be returned. Unlike a + * lookup, we only return an error if the attribute does not exist or we can't + * retrieve the value. */ int xfs_attr3_leaf_getvalue( diff --git a/libxfs/xfs_attr_remote.c b/libxfs/xfs_attr_remote.c index b2a01567..a9a48b30 100644 --- a/libxfs/xfs_attr_remote.c +++ b/libxfs/xfs_attr_remote.c @@ -396,7 +396,7 @@ xfs_attr_rmtval_get( trace_xfs_attr_rmtval_get(args); - ASSERT(!(args->flags & ATTR_KERNOVAL)); + ASSERT(args->valuelen != 0); ASSERT(args->rmtvaluelen == args->valuelen); valuelen = args->rmtvaluelen; -- 2.26.2