Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp80754imm; Wed, 5 Sep 2018 15:21:34 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZh5d3VCWaaJNHChn54qJr0D58N/Sha8FmLVdFH1v8CDZd5gsLZ/HI9+NY5NiVEGR3UFWHl X-Received: by 2002:a63:5055:: with SMTP id q21-v6mr38759977pgl.397.1536186094501; Wed, 05 Sep 2018 15:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536186094; cv=none; d=google.com; s=arc-20160816; b=kAa57dD2S5m7Exjndq/3FVVZEBREpr+MPvjJtULcDJIWk5AxUu2jsJgK0F0pX22Lcw 3RQST++l+gUvx8DtK/CZN6mskNEKF+2nXbsgWIhfU4bahymLWekLgD8dkv9Ow8XL2fNh t+BjzLbyAAH+YGfN4uxJ+0oQqNygAELjGSiufJhR/rOG++kup60QYfw1EPKhCFyQDVCT AXSwluh/jFV2yVdvy5NMkt13OIxo1KNPcODGxCgioXz+2g6zBJBTcCB7F4mbHuwfuP6J 0ZR4DjdAlxtgSRrerr4i6pSSEZnHsV1CtK0ymACuUSkNopFQiroWj8HMktt/1X5D7JDK uDNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=j/iuCX28P0W/34/P7Wn6X4dhaDEXTAkCvW+jhvrTqkg=; b=YguqNBekl4jqRCltcOaH88UT05tuxHhePjmLQ9qDv+bUvM3wqNW/fZMFugFNxkjcg2 o9hmMKoNYVJJC5ZT2Ho/dQw2d0gmNt3rxoezrmWfmfHjautP1XHcXurBApAsaC5Qe7DH 7SW257A0U2b1gIccXf8yp5uBTGMsKu7qrIuUxcFx5UQVcsMX+oTukltOvI1BBxy9ldg6 y0Xz0lHFY1hUhHFSd7m8lIZOJW9Jh+osJzV2DqFaEpDZvPXgWWgO68YT1QZR3BC98eoB 7LwkwdUozTXXsO8ysnN7IcNjOz9W+hskpzxDz7976tAgNQivrYDe2r6pit8Sy+l62uGX Hc9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15-v6si3058287plo.284.2018.09.05.15.21.19; Wed, 05 Sep 2018 15:21:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727821AbeIFCwZ (ORCPT + 99 others); Wed, 5 Sep 2018 22:52:25 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:34194 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727657AbeIFCwZ (ORCPT ); Wed, 5 Sep 2018 22:52:25 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fxg9d-00059p-Ca; Wed, 05 Sep 2018 22:20:05 +0000 Date: Wed, 5 Sep 2018 23:20:05 +0100 From: Al Viro To: David Howells Cc: linux-api@vger.kernel.org, linux-kbuild@vger.kernel.org, Ryusuke Konishi , linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 07/11] UAPI: nilfs2: Fix use of undefined byteswapping functions Message-ID: <20180905222005.GS19965@ZenIV.linux.org.uk> References: <153616286704.23468.584491117180383924.stgit@warthog.procyon.org.uk> <153616292366.23468.14988166998690800938.stgit@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <153616292366.23468.14988166998690800938.stgit@warthog.procyon.org.uk> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 05, 2018 at 04:55:23PM +0100, David Howells wrote: > nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ > { \ > - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ > + cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) | \ > (1UL << NILFS_CHECKPOINT_##flag)); \ How about sanitiziung the damn thing to cp->cp_flags |= __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag)); while you are at it? Or, perhaps, even #define NILFS2_CP_FLAG(flag) __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag) and cp->cp_flags |= NILFS2_CP_FLAG(flag) for this one, > } \ > static inline void \ > nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ > { \ > - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ > + cp->cp_flags = __cpu_to_le32(__le32_to_cpu(cp->cp_flags) & \ > ~(1UL << NILFS_CHECKPOINT_##flag)); \ cp->cp_flags &= ~NILFS2_CP_FLAG(flag); here > } \ > static inline int \ > nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ > { \ > - return !!(le32_to_cpu(cp->cp_flags) & \ > + return !!(__le32_to_cpu(cp->cp_flags) & \ > (1UL << NILFS_CHECKPOINT_##flag)); \ and !!(cp->cp_flags & NILFS2_CP_FLAG(flag) here? Or maybe even make the damn thing bool and lose the !! here... )> } > and similar for those: > @@ -595,20 +596,20 @@ enum { > static inline void \ > nilfs_segment_usage_set_##name(struct nilfs_segment_usage *su) \ > { \ > - su->su_flags = cpu_to_le32(le32_to_cpu(su->su_flags) | \ > + su->su_flags = __cpu_to_le32(__le32_to_cpu(su->su_flags) | \ > (1UL << NILFS_SEGMENT_USAGE_##flag));\ > } \ > static inline void \ > nilfs_segment_usage_clear_##name(struct nilfs_segment_usage *su) \ > { \ > su->su_flags = \ > - cpu_to_le32(le32_to_cpu(su->su_flags) & \ > + __cpu_to_le32(__le32_to_cpu(su->su_flags) & \ > ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ > } \ > static inline int \ > nilfs_segment_usage_##name(const struct nilfs_segment_usage *su) \ > { \ > - return !!(le32_to_cpu(su->su_flags) & \ > + return !!(__le32_to_cpu(su->su_flags) & \ > (1UL << NILFS_SEGMENT_USAGE_##flag)); \ > } > @@ -619,15 +620,15 @@ NILFS_SEGMENT_USAGE_FNS(ERROR, error) > static inline void > nilfs_segment_usage_set_clean(struct nilfs_segment_usage *su) > { > - su->su_lastmod = cpu_to_le64(0); > - su->su_nblocks = cpu_to_le32(0); > - su->su_flags = cpu_to_le32(0); > + su->su_lastmod = __cpu_to_le64(0); > + su->su_nblocks = __cpu_to_le32(0); > + su->su_flags = __cpu_to_le32(0); > } > > static inline int > nilfs_segment_usage_clean(const struct nilfs_segment_usage *su) > { > - return !le32_to_cpu(su->su_flags); > + return !__le32_to_cpu(su->su_flags); "Check that after byteswap it becomes 0", is it? How is that different from return !su->su_flags; ?