Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3635308iog; Tue, 21 Jun 2022 02:52:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tL8y67AF99RXKVkokcj5vjhCFurRb9ki8ES1hmc/yo59OOmbZYQE2v3iMjdMEFDiQL4YNJ X-Received: by 2002:a17:90b:4c8c:b0:1e8:5607:7ec0 with SMTP id my12-20020a17090b4c8c00b001e856077ec0mr32042855pjb.36.1655805147575; Tue, 21 Jun 2022 02:52:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655805147; cv=none; d=google.com; s=arc-20160816; b=XOxOwFusCDyUaio3+w3xnfDlClndMMNaaNg8uzyOfZOJbKcyjuea7/vfol7/30Dw9Z 6nGC8dfGBT0DH2e9r/Z9dIolomCmQF1eHm+NPrpPvShLzFg1rg6n235chOym4OI6ZYt9 VeQgXH/vkVJclJuDvMGCUtkDzqsHIBEMzdJX1T+siSKrXgpDFPEo4o+FHn44IF/2T1XV Aytwk4cdywhtdDTQrwXKi0tMfe/zzODQ1t5NR6dKmda5kEIyH0qr3cuJvhn0edh9tJIf B+W8JTWnwHC0/0lcJfiDueBLBm2uAuVdFXYvs4snwxSYeYIHcMjlhJ3toZwWBpydh8WD IcAQ== 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 :message-id:date:subject:cc:to:from; bh=RSbzmyzluNMlkKe0Bf5QKrXrxYEPNodJxBCh3xVpErI=; b=hxS50OI+5f/PXkimPTzlDvahhBscACLm004O7t46ZW8+UDSIgjFjuf8hYH1BTPwdvX QjzTs0uSmeAfB1p9ee4MAOnnUiMX0i+H0BtURRzKvyS+tWH+qmjp1wBEtC2bj5+gusRy vkzdiW44+INGP/BFsnU+YAIKO8Wx2CReBHw4nkFgidR8zCMMlf29P8V6RWwdvMU864hF oTjMEDyEZCuKuE93wcsS9wp8REQDoc4fpW5zDY6HHAk8PFkICGUDOig6c0oiMyFT0T5V CmxrXjPMaw4DUgmS3FD+PoAOeIS4vi5Ds1rQ4qOpxWXrkC2ElawTUr3PxQ9Q1TCQZN20 2Yjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q13-20020a170902a3cd00b0016a1746ef18si9365711plb.106.2022.06.21.02.52.11; Tue, 21 Jun 2022 02:52:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348640AbiFUJHw (ORCPT + 99 others); Tue, 21 Jun 2022 05:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348086AbiFUJHt (ORCPT ); Tue, 21 Jun 2022 05:07:49 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49E08186D0; Tue, 21 Jun 2022 02:07:48 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 055391FADF; Tue, 21 Jun 2022 09:07:47 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D895613A88; Tue, 21 Jun 2022 09:07:46 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qOaSMmKKsWKFHAAAMHmgww (envelope-from ); Tue, 21 Jun 2022 09:07:46 +0000 From: Cyril Hrubis To: linux-kernel@vger.kernel.org Cc: linux-arch@vger.kernel.org, linux-api@vger.kernel.org, libc-alpha@sourceware.org, arnd@arndb.de, ltp@lists.linux.it, David.Laight@aculab.com, zack@owlfolio.org, dhowells@redhat.com, Cyril Hrubis Subject: [PATCH v2] uapi: Make __{u,s}64 match {u,}int64_t in userspace Date: Tue, 21 Jun 2022 11:09:51 +0200 Message-Id: <20220621090951.29911-1-metan@ucw.cz> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org From: Cyril Hrubis This changes the __u64 and __s64 in userspace on 64bit platforms from long long (unsigned) int to just long (unsigned) int in order to match the uint64_t and int64_t size in userspace. This allows us to use the kernel structure definitions in userspace. For example we can use PRIu64 and PRId64 modifiers in printf() to print structure membere. Morever with this there would be no need to redefine these structures in an libc implementations as it is done now. Consider for example the newly added statx() syscall. If we use the header from uapi we will get warnings when attempting to print it's members as: printf("%" PRIu64 "\n", stx.stx_size); We get: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type '__u64' {aka 'long long unsigned int'} Signed-off-by: Cyril Hrubis --- include/uapi/asm-generic/types.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) v2: Make sure we do not break C++ applications diff --git a/include/uapi/asm-generic/types.h b/include/uapi/asm-generic/types.h index dfaa50d99d8f..11e468a39d1e 100644 --- a/include/uapi/asm-generic/types.h +++ b/include/uapi/asm-generic/types.h @@ -1,9 +1,16 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _ASM_GENERIC_TYPES_H #define _ASM_GENERIC_TYPES_H + +#include + /* - * int-ll64 is used everywhere now. + * int-ll64 is used everywhere in kernel now. */ -#include +#if !defined(__KERNEL__) && !defined(__cplusplus) && __BITSPERLONG == 64 +# include +#else +# include +#endif #endif /* _ASM_GENERIC_TYPES_H */ -- 2.35.1