Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp283573imm; Thu, 6 Sep 2018 02:21:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbiPJ3yh57CyZMdo7V+Vb53OeVfZbtIfMP40A4Ou/sIK4KlJ/LR7XhfDhEfQb58DoIla6Bz X-Received: by 2002:a62:41d6:: with SMTP id g83-v6mr1834240pfd.219.1536225666216; Thu, 06 Sep 2018 02:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536225666; cv=none; d=google.com; s=arc-20160816; b=UBgCZIdyDLISNZ3HN/WvH7DZfZlbBvXgGndcKSHmkV07TM9LKg3ct8Nfh2d6QsU9up bHOFkt+4ycSo67nHKIQ8XIlVLx939aGB2SBQZ1hnQFwqIr37ozjBTZVSaX5qNFdNJEE1 rbZYJThes0frHRct/S5bNLt7tkEH052tMetjrElPIu2GC82Cqf7LZdAqdq+woTBW0oU7 maH8ORxWDbLRuO3kWiDVHcDH52Bl8JHx5U6ocy73DEmzI3rnCZGr2BTEgkw+p180ZARi 5N6YWPNthAku3Itm39YvRm/3UroIX/tqnqXJOT1gkZrpJEMSn9jKD/Pc8os1Ep/q8875 Ox9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization; bh=jwniA5VRDIwwp07P1PklgX5VY5TmxVE/zDu4Oed/oQs=; b=qngv2Cv2eX+apuuLoDRcKV33WZ/2KMh0xhMrpiFGnVQNWm4jm7RdMKbG3KsnZr4EN/ fyroBydIRkPQnAlEEFsYpjbtzqiz9q1bNiGDF8zisZ61+6cgxYMYYUMgSSyXcktZWaub whIv4Ek1+yjtNrbPHXK6dCO82du3XklOmaPaNIQN03LW26UF0Hkd+Z6zaMv1CZSpshTH 5N4yn4tCa77TipSMO5h0elS6wT2BZePXLdiJiMo7OML7gWbxYNgQ3cP40AyN90GKKteN TuxSKEqVmEDlKLXaf1RG9J4q7+RY+jyD7xOSVqVd4Zr/SpIxwIRtTdQuSQgNqjWXw8dM a1gQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d13-v6si4295789plr.196.2018.09.06.02.20.51; Thu, 06 Sep 2018 02:21:06 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728673AbeIFNxw (ORCPT + 99 others); Thu, 6 Sep 2018 09:53:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45202 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728650AbeIFNxv (ORCPT ); Thu, 6 Sep 2018 09:53:51 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48CDC80401CC; Thu, 6 Sep 2018 09:19:19 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-123-84.rdu2.redhat.com [10.10.123.84]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C5CB10F1BE7; Thu, 6 Sep 2018 09:19:18 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 08/11] UAPI: nilfs2: Fix use of undefined byteswapping functions [ver #2] From: David Howells To: linux-api@vger.kernel.org, linux-kbuild@vger.kernel.org Cc: Ryusuke Konishi , linux-nilfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dhowells@redhat.com Date: Thu, 06 Sep 2018 10:19:17 +0100 Message-ID: <153622555770.14298.17748806314555967351.stgit@warthog.procyon.org.uk> In-Reply-To: <153622549721.14298.8116794954073122489.stgit@warthog.procyon.org.uk> References: <153622549721.14298.8116794954073122489.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 06 Sep 2018 09:19:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 06 Sep 2018 09:19:19 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org nilfs2 exports a load of inline functions to userspace that call kernel byteswapping functions that don't exist in UAPI. Fix this by making it #include asm/byteorder.h and use the functions declared there. A better way is probably to remove these inline functions from the nilfs2 header since they are technically broken. Signed-off-by: David Howells cc: Ryusuke Konishi cc: linux-nilfs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org --- include/uapi/linux/nilfs2_ondisk.h | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/include/uapi/linux/nilfs2_ondisk.h b/include/uapi/linux/nilfs2_ondisk.h index a7e66ab11d1d..47f8f596ff1c 100644 --- a/include/uapi/linux/nilfs2_ondisk.h +++ b/include/uapi/linux/nilfs2_ondisk.h @@ -29,6 +29,7 @@ #include #include +#include #define NILFS_INODE_BMAP_SIZE 7 @@ -533,20 +534,17 @@ enum { static inline void \ nilfs_checkpoint_set_##name(struct nilfs_checkpoint *cp) \ { \ - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) | \ - (1UL << NILFS_CHECKPOINT_##flag)); \ + cp->cp_flags |= __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag); \ } \ static inline void \ nilfs_checkpoint_clear_##name(struct nilfs_checkpoint *cp) \ { \ - cp->cp_flags = cpu_to_le32(le32_to_cpu(cp->cp_flags) & \ - ~(1UL << NILFS_CHECKPOINT_##flag)); \ + cp->cp_flags &= __cpu_to_le32(~(1UL << NILFS_CHECKPOINT_##flag)); \ } \ static inline int \ nilfs_checkpoint_##name(const struct nilfs_checkpoint *cp) \ { \ - return !!(le32_to_cpu(cp->cp_flags) & \ - (1UL << NILFS_CHECKPOINT_##flag)); \ + return !!(cp->cp_flags & __cpu_to_le32(1UL << NILFS_CHECKPOINT_##flag)); \ } NILFS_CHECKPOINT_FNS(SNAPSHOT, snapshot) @@ -595,21 +593,17 @@ 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) | \ - (1UL << NILFS_SEGMENT_USAGE_##flag));\ + su->su_flags |= __cpu_to_le32(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) & \ - ~(1UL << NILFS_SEGMENT_USAGE_##flag)); \ + su->su_flags &= __cpu_to_le32(~(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) & \ - (1UL << NILFS_SEGMENT_USAGE_##flag)); \ + return !!(su->su_flags & __cpu_to_le32(1UL << NILFS_SEGMENT_USAGE_##flag)); \ } NILFS_SEGMENT_USAGE_FNS(ACTIVE, active) @@ -619,15 +613,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 !su->su_flags; } /**