From patchwork Mon Feb 8 21:49:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41967 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5F5BF3840C16; Mon, 8 Feb 2021 21:49:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F5BF3840C16 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612820997; bh=wVsC1p5bG1RLItV7zQyIAHiTxxmb8jhSmuh4QPFeUNE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=ibAY71+CUBm9h/iGSaYzyDWLKnsAKvyk4QO1rsEmnEnvWpnZn6iyhIGOoJHUuIg8P 7Yb6s5xUm2EMwASPpIxMIoUMXeXA9xsCQCCmxjBTpRnShRZ7NPljNDlqPG0rKxvT4U jomTOW3iP1jiqbcs7NHcHNEFce3LDX5kczA5wdJk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by sourceware.org (Postfix) with ESMTPS id 57AC93840C16 for ; Mon, 8 Feb 2021 21:49:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 57AC93840C16 Received: by mail-qk1-x730.google.com with SMTP id 19so5919960qkc.13 for ; Mon, 08 Feb 2021 13:49:54 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=wVsC1p5bG1RLItV7zQyIAHiTxxmb8jhSmuh4QPFeUNE=; b=Jgwi837f4z4OLtvX8gOK8m12cccL75eMpoiTA4XFx8FrY7cq0XRx/cp3QJUJdqh5z5 f/hPgB/C6a/gkSiqCLFqNCywjyEezE4x6q0WwWtWXIH4KVL8NdVYy7LfPjMo017FGEoQ 1njMtkGuj4Rj/m7AAQrONwwXiFbM1WsWPWNVpgFR7yQYox0Ab+1Y+mxOiu2SSLpEtqZD IgbBfxAnbmTtBh320n0kzcvnviD/qex87OzBrBNDtGWd23S2fiI9lPqMxGBX/iOhbxWm wF7pLJN9QoSGh3Ht0zakYWOaaPrIO4S0MoCTgr5wBLjbzfiGku1xsBV4azdhyEmapRCt hUKQ== X-Gm-Message-State: AOAM531nsbIK8n4ZHAmJxk5EPCEImHLF6/TnNt4VD6dSBF+Qo0C3Nevb vuFY/cdb1S+yR4kcpPiwALRrONaH8dPXOw== X-Google-Smtp-Source: ABdhPJzXzolblhKx04pfU34f0n85jpibXyIGW8zGopn7SV3EnU5I4K23pQz0wCNLt/nyWdjZKpZWnA== X-Received: by 2002:a05:620a:12d5:: with SMTP id e21mr18869725qkl.131.1612820992943; Mon, 08 Feb 2021 13:49:52 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.49.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:49:52 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 01/10] linux: Fix STATFS_IS_STATFS64 definition Date: Mon, 8 Feb 2021 18:49:27 -0300 Message-Id: <20210208214936.1502047-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" aarch64, arc, ia64, mips64, powerpc64, riscv32, riscv64, s390x, sparc64, and x86_64 defines STATFS_IS_STATFS64 to 0, but all of them alias both statfs to statfs64 and struct statfs has the same and layout of struct statfs64. The correct definition will be used on the {f}statfs{64} consolidation. This patch does not change code generation since the symbols are implemented using the auto-generation syscall for all the aforementioned abis. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/aarch64/kernel_stat.h | 21 +++++++++++++++++++ sysdeps/unix/sysv/linux/ia64/kernel_stat.h | 2 +- sysdeps/unix/sysv/linux/mips/kernel_stat.h | 6 +++++- .../linux/powerpc/powerpc64/kernel_stat.h | 2 +- sysdeps/unix/sysv/linux/riscv/kernel_stat.h | 2 +- .../sysv/linux/s390/s390-64/kernel_stat.h | 2 +- .../sysv/linux/sparc/sparc64/kernel_stat.h | 7 +++++-- sysdeps/unix/sysv/linux/x86_64/kernel_stat.h | 2 +- 8 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 sysdeps/unix/sysv/linux/aarch64/kernel_stat.h diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h b/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h new file mode 100644 index 0000000000..33ad1b622b --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h @@ -0,0 +1,21 @@ +/* Internal definitions for stat functions. Linux/AARch64 version. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h index e1eac69850..ee05a15590 100644 --- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h @@ -19,4 +19,4 @@ #define STAT_IS_KERNEL_STAT 1 #define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 +#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/mips/kernel_stat.h b/sysdeps/unix/sysv/linux/mips/kernel_stat.h index 21dba2de73..e4b0f211ca 100644 --- a/sysdeps/unix/sysv/linux/mips/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/mips/kernel_stat.h @@ -62,6 +62,10 @@ struct kernel_stat #define STAT_IS_KERNEL_STAT 0 #define STAT64_IS_KERNEL_STAT64 0 #define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 +#if _MIPS_SIM == _ABI64 +# define STATFS_IS_STATFS64 1 +#else +# define STATFS_IS_STATFS64 0 +#endif #endif diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h index a1f66bcece..bc7390c9ff 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h @@ -19,4 +19,4 @@ #define STAT_IS_KERNEL_STAT 1 #define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 +#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h index ee8b37a9eb..4ad7913762 100644 --- a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/riscv/kernel_stat.h @@ -20,4 +20,4 @@ #define STAT_IS_KERNEL_STAT 1 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 +#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h index e1eac69850..ee05a15590 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h @@ -19,4 +19,4 @@ #define STAT_IS_KERNEL_STAT 1 #define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 +#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h index 0f3d405239..29d18908da 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/kernel_stat.h @@ -50,6 +50,9 @@ struct kernel_stat64 #define STAT_IS_KERNEL_STAT 0 #define STAT64_IS_KERNEL_STAT64 0 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 - +#ifdef __arch64__ +# define STATFS_IS_STATFS64 1 +#else +# define STATFS_IS_STATFS64 0 +#endif #endif /* _KERNEL_STAT_H */ diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h index e1eac69850..ee05a15590 100644 --- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h @@ -19,4 +19,4 @@ #define STAT_IS_KERNEL_STAT 1 #define STAT64_IS_KERNEL_STAT64 1 #define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 0 +#define STATFS_IS_STATFS64 1 From patchwork Mon Feb 8 21:49:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41968 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E953B393BC27; Mon, 8 Feb 2021 21:50:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E953B393BC27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821002; bh=0h/PdvOUUWcZL5pfxZWnA83j1gdDoJbA56XCS2Y2lQo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bys0j56DhCJayUsMF/YyLTuDPdZQ16jI6c6txh/hdH0drIg+F5QwjNmxeyv966r5U WSSGvKzw0Q14rlgtE+3e+jkxB/r+PWYg13WMSD4JhEii0el5Aw57oi0b2MulLqa1YP bG8x/zHNou0dl46dMWxhreYST8gzamtZiGlA61FA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by sourceware.org (Postfix) with ESMTPS id E1C6B393BC13 for ; Mon, 8 Feb 2021 21:49:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E1C6B393BC13 Received: by mail-qk1-x72f.google.com with SMTP id r77so16040562qka.12 for ; Mon, 08 Feb 2021 13:49:57 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=0h/PdvOUUWcZL5pfxZWnA83j1gdDoJbA56XCS2Y2lQo=; b=l1slnrkQBj3hSL7HJWQEgRR+o8IRNvq4johwNr1iiDPExPs6mY6rQSThT17w43me46 mZ4lgu3wxBJDkdIr430fZewefLsZb0D2crasDuq8E89A1LjmKV1z3phVTQU9JzrDsRyl RqnZo1bYIccoW46WqGPboM8tKkneLAunslnsNl7Uq1oKBQnAlUA0xXImKKH4KgsS2e3J n8KrEoOpaeBU1eiq7P/zA2BA6Yc9M5cnn3nJicY5scXMl8gWTePJ5y296giclkr4/WOg h2UbkzKGxm3P3h5WsS8NvqBgNSq9ETlbcFBnSjsfg3+TGcKyerIVTDKjjT8SEeLwKFhX jN+g== X-Gm-Message-State: AOAM530PdCkAd2j/tYXD/LAVQaWT4PLMfQXed88D+IaEiypeVjKSXL1d QLVzFC2o9LNei85kkGY7PuXJdA2d+w20ug== X-Google-Smtp-Source: ABdhPJwO1amc79unxEAjZo9IuJBQsTC4BQ33IiJq7eXDZDOkEAdYri5p6mJQuM3R+23HooEY3AfWZQ== X-Received: by 2002:a05:620a:ec9:: with SMTP id x9mr18972397qkm.333.1612820996940; Mon, 08 Feb 2021 13:49:56 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:49:56 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 02/10] linux: Set default kernel_stat.h to LFS Date: Mon, 8 Feb 2021 18:49:28 -0300 Message-Id: <20210208214936.1502047-3-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The XSTAT_IS_XSTAT64 and STAT_IS_KERNEL_STAT flags are now set to 1 and STATFS_IS_STATFS64 is set to __STATFS_MATCHES_STATFS64. This makes the default ABI for newer ports to provide only LFS calls. A copy of non-LFS support is provided to 32-bit ABIS with non-LFS support (arm, csky, i386, m68k, nios2, s390, and sh). Is also allows to remove the 64-bit ports, which already uses the default values. This patch does not change the code generation. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/arc/kernel_stat.h | 27 --------- sysdeps/unix/sysv/linux/arm/kernel_stat.h | 40 +++++++++++++ .../sysv/linux/{riscv => csky}/kernel_stat.h | 12 ++-- sysdeps/unix/sysv/linux/generic/kernel_stat.h | 30 ---------- sysdeps/unix/sysv/linux/i386/kernel_stat.h | 40 +++++++++++++ sysdeps/unix/sysv/linux/ia64/kernel_stat.h | 22 ------- sysdeps/unix/sysv/linux/kernel_stat.h | 58 +++++++------------ sysdeps/unix/sysv/linux/m68k/kernel_stat.h | 40 +++++++++++++ .../linux/{aarch64 => nios2}/kernel_stat.h | 9 +-- .../linux/powerpc/powerpc64/kernel_stat.h | 22 ------- .../sysv/linux/s390/s390-32/kernel_stat.h | 40 +++++++++++++ .../sysv/linux/s390/s390-64/kernel_stat.h | 22 ------- sysdeps/unix/sysv/linux/sh/kernel_stat.h | 40 +++++++++++++ sysdeps/unix/sysv/linux/x86_64/kernel_stat.h | 22 ------- sysdeps/unix/sysv/linux/xstatconv.c | 7 +-- 15 files changed, 231 insertions(+), 200 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/arc/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/arm/kernel_stat.h rename sysdeps/unix/sysv/linux/{riscv => csky}/kernel_stat.h (77%) delete mode 100644 sysdeps/unix/sysv/linux/generic/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/i386/kernel_stat.h delete mode 100644 sysdeps/unix/sysv/linux/ia64/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/m68k/kernel_stat.h rename sysdeps/unix/sysv/linux/{aarch64 => nios2}/kernel_stat.h (78%) delete mode 100644 sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h delete mode 100644 sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h create mode 100644 sysdeps/unix/sysv/linux/sh/kernel_stat.h delete mode 100644 sysdeps/unix/sysv/linux/x86_64/kernel_stat.h diff --git a/sysdeps/unix/sysv/linux/arc/kernel_stat.h b/sysdeps/unix/sysv/linux/arc/kernel_stat.h deleted file mode 100644 index edd96b1b94..0000000000 --- a/sysdeps/unix/sysv/linux/arc/kernel_stat.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright (C) 2020-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include - -/* Needed to elide the itemized copy code in common xstatconv.c. */ -#define STAT_IS_KERNEL_STAT 1 -#define STAT64_IS_KERNEL_STAT64 1 - -/* Nice side-effect of 64-bit time_t switch is these are same. */ -#define XSTAT_IS_XSTAT64 1 - -#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/arm/kernel_stat.h b/sysdeps/unix/sysv/linux/arm/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/arm/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h b/sysdeps/unix/sysv/linux/csky/kernel_stat.h similarity index 77% rename from sysdeps/unix/sysv/linux/riscv/kernel_stat.h rename to sysdeps/unix/sysv/linux/csky/kernel_stat.h index 4ad7913762..e993021a81 100644 --- a/sysdeps/unix/sysv/linux/riscv/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/csky/kernel_stat.h @@ -1,4 +1,5 @@ -/* Copyright (C) 2020-2021 Free Software Foundation, Inc. +/* Internal definitions for stat functions. Linux/csky. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -15,9 +16,6 @@ License along with the GNU C Library. If not, see . */ -#include - -#define STAT_IS_KERNEL_STAT 1 - -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/generic/kernel_stat.h b/sysdeps/unix/sysv/linux/generic/kernel_stat.h deleted file mode 100644 index 350f0cc1bb..0000000000 --- a/sysdeps/unix/sysv/linux/generic/kernel_stat.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include - -#define STAT_IS_KERNEL_STAT 1 - -/* We provide separate 32-bit API versions that check for EOVERFLOW. */ -#if __WORDSIZE == 64 -# define XSTAT_IS_XSTAT64 1 -#else -# define XSTAT_IS_XSTAT64 0 -#endif - -#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/i386/kernel_stat.h b/sysdeps/unix/sysv/linux/i386/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h b/sysdeps/unix/sysv/linux/ia64/kernel_stat.h deleted file mode 100644 index ee05a15590..0000000000 --- a/sysdeps/unix/sysv/linux/ia64/kernel_stat.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definition of `struct stat' used in the kernel. - Copyright (C) 2003-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define STAT_IS_KERNEL_STAT 1 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/kernel_stat.h b/sysdeps/unix/sysv/linux/kernel_stat.h index b1bc1459f0..6c1b175cb4 100644 --- a/sysdeps/unix/sysv/linux/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/kernel_stat.h @@ -1,40 +1,22 @@ -/* Definition of `struct stat' used in the kernel.. */ -struct kernel_stat - { - unsigned short int st_dev; - unsigned short int __pad1; -#define _HAVE___PAD1 - unsigned long int st_ino; - unsigned short int st_mode; - unsigned short int st_nlink; - unsigned short int st_uid; - unsigned short int st_gid; - unsigned short int st_rdev; - unsigned short int __pad2; -#define _HAVE___PAD2 - unsigned long int st_size; - unsigned long int st_blksize; - unsigned long int st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long int __glibc_reserved4; -#define _HAVE___UNUSED4 - unsigned long int __glibc_reserved5; -#define _HAVE___UNUSED5 - }; +/* Internal definitions for stat functions. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. -#define _HAVE_STAT___UNUSED4 -#define _HAVE_STAT___UNUSED5 -#define _HAVE_STAT___PAD1 -#define _HAVE_STAT___PAD2 -#define _HAVE_STAT_NSEC -#define _HAVE_STAT64___PAD1 -#define _HAVE_STAT64___PAD2 -#define _HAVE_STAT64___ST_INO -#define _HAVE_STAT64_NSEC + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. -#define STAT_IS_KERNEL_STAT 0 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 0 -#define STATFS_IS_STATFS64 0 + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* The default Linux ABI assumes only LFS support. */ +#define XSTAT_IS_XSTAT64 1 +#define STATFS_IS_STATFS64 __STATFS_MATCHES_STATFS64 +#define STAT_IS_KERNEL_STAT 1 diff --git a/sysdeps/unix/sysv/linux/m68k/kernel_stat.h b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/m68k/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h similarity index 78% rename from sysdeps/unix/sysv/linux/aarch64/kernel_stat.h rename to sysdeps/unix/sysv/linux/nios2/kernel_stat.h index 33ad1b622b..1af30dab6f 100644 --- a/sysdeps/unix/sysv/linux/aarch64/kernel_stat.h +++ b/sysdeps/unix/sysv/linux/nios2/kernel_stat.h @@ -1,6 +1,7 @@ -/* Internal definitions for stat functions. Linux/AARch64 version. +/* Internal definitions for stat functions. Linux/nios2. Copyright (C) 2021 Free Software Foundation, Inc. This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -16,6 +17,6 @@ License along with the GNU C Library. If not, see . */ -#define STAT_IS_KERNEL_STAT 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 +#define STAT_IS_KERNEL_STAT 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h b/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h deleted file mode 100644 index bc7390c9ff..0000000000 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/kernel_stat.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definition of `struct stat' used in the kernel. - Copyright (C) 2002-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define STAT_IS_KERNEL_STAT 1 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/s390/s390-32/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h b/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h deleted file mode 100644 index ee05a15590..0000000000 --- a/sysdeps/unix/sysv/linux/s390/s390-64/kernel_stat.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definition of `struct stat' used in the kernel. - Copyright (C) 2003-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define STAT_IS_KERNEL_STAT 1 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/sh/kernel_stat.h b/sysdeps/unix/sysv/linux/sh/kernel_stat.h new file mode 100644 index 0000000000..b1bc1459f0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/sh/kernel_stat.h @@ -0,0 +1,40 @@ +/* Definition of `struct stat' used in the kernel.. */ +struct kernel_stat + { + unsigned short int st_dev; + unsigned short int __pad1; +#define _HAVE___PAD1 + unsigned long int st_ino; + unsigned short int st_mode; + unsigned short int st_nlink; + unsigned short int st_uid; + unsigned short int st_gid; + unsigned short int st_rdev; + unsigned short int __pad2; +#define _HAVE___PAD2 + unsigned long int st_size; + unsigned long int st_blksize; + unsigned long int st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long int __glibc_reserved4; +#define _HAVE___UNUSED4 + unsigned long int __glibc_reserved5; +#define _HAVE___UNUSED5 + }; + +#define _HAVE_STAT___UNUSED4 +#define _HAVE_STAT___UNUSED5 +#define _HAVE_STAT___PAD1 +#define _HAVE_STAT___PAD2 +#define _HAVE_STAT_NSEC +#define _HAVE_STAT64___PAD1 +#define _HAVE_STAT64___PAD2 +#define _HAVE_STAT64___ST_INO +#define _HAVE_STAT64_NSEC + +#define STAT_IS_KERNEL_STAT 0 +#define STAT64_IS_KERNEL_STAT64 1 +#define XSTAT_IS_XSTAT64 0 +#define STATFS_IS_STATFS64 0 diff --git a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h b/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h deleted file mode 100644 index ee05a15590..0000000000 --- a/sysdeps/unix/sysv/linux/x86_64/kernel_stat.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Definition of `struct stat' used in the kernel. - Copyright (C) 2003-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#define STAT_IS_KERNEL_STAT 1 -#define STAT64_IS_KERNEL_STAT64 1 -#define XSTAT_IS_XSTAT64 1 -#define STATFS_IS_STATFS64 1 diff --git a/sysdeps/unix/sysv/linux/xstatconv.c b/sysdeps/unix/sysv/linux/xstatconv.c index 5dfe7c5fb5..4d049d4555 100644 --- a/sysdeps/unix/sysv/linux/xstatconv.c +++ b/sysdeps/unix/sysv/linux/xstatconv.c @@ -21,12 +21,7 @@ #include #include -#if STAT_IS_KERNEL_STAT - -/* Dummy. */ -struct kernel_stat; - -#else +#if !STAT_IS_KERNEL_STAT #include From patchwork Mon Feb 8 21:49:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41969 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 04B6A393C86E; Mon, 8 Feb 2021 21:50:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04B6A393C86E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821004; bh=O4Bxp08Ia/mmn2wWNnldXu2UupyW6Sh0AC+NXdIrS98=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Bc5s08ZDEoN6IuZkaab2/uXM/W7N2G8jeddqZ3f0OPPIU5VHFnP5LIP+pP45dBOHa uDYlCkTiTd9UyBYzER59eAYMLoSEXXrbSjS0OIwWJ0ZuhCbgcXITiYWKHfIsuLmCdI wR9VcNOWk7JTESSc4SRFGrFUy1RAAogbGunZBXII= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) by sourceware.org (Postfix) with ESMTPS id DEBCB386F033 for ; Mon, 8 Feb 2021 21:49:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DEBCB386F033 Received: by mail-qt1-x830.google.com with SMTP id e11so11501840qtg.6 for ; Mon, 08 Feb 2021 13:49:59 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=O4Bxp08Ia/mmn2wWNnldXu2UupyW6Sh0AC+NXdIrS98=; b=DKOtp05CdnL9LX9ojwHeG7m5KzvXmIDklavwod+FiKYuMRDcgOBn/rOHNe4+JoEJzz OkpsUEZpjF5+ekokggxlVgY5nU1wGI4aj0pMTtarzWmIeHrslr4sfHinLsmBvlH1xqor eVACSefKkxmzj76agRKdbo1QGEh7/YCO5UmqoGS6peJGyZXQEjNxcrwHpNLts5SFM59G mBX3cmYSh/Re2MWMwJtrQ3e8slH8EIoyphy7FBArkeGynqBB+cQLR7lVLRr1gFM7fO2p hDujre/VJIDI3UloI6qyR5E87k/rRiKa+Um4UTz185WIQdOGuVMzD7ufyH8+Z29+0cXG ApBg== X-Gm-Message-State: AOAM531xsN6OHLZmMJJoVmhMvdn+08MNQzebLgGN8EwT/g7gbiojnMWs sZfXiOBm61Mvvr92v7eyPkabULmc6kLMBg== X-Google-Smtp-Source: ABdhPJz4B8Zr367a2Y4iw3tH6MXmBjZa1LnDJ0jRudSxriR2FSFz7EExlOS7KWTIbDMmuCc5xYoB+w== X-Received: by 2002:ac8:7502:: with SMTP id u2mr13099940qtq.54.1612820999249; Mon, 08 Feb 2021 13:49:59 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.49.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:49:58 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 03/10] linux: Set LFS statfs as default Date: Mon, 8 Feb 2021 18:49:29 -0300 Message-Id: <20210208214936.1502047-4-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Currently glibc has three different struct statfs{64} definitions: 1. Non-LFS support where non-LFS and LFS struct have different size: alpha, arm, hppa, i686, m68k, microblaze, mips (all abis), powerpc32, s390, sh4, and sparc. 2. Non-LFS support where non-LFS and LFS struct have the same size: csky and nios2. 3. Only LFS support (where both struct have the same size): arc, ia64, powerpc64 (including LE), riscv (both 32 and 64 bits), s390x, sparc64, and x86 (including x32). The STATFS_IS_STATFS64/__STATFS_MATCHES_STATFS64 does not tell apart between 1. and 2.; since for both the only difference is the struct size (for 2. both non-LFS and LFS uses the same syscall, where for 1. the old non-LFS is used for {f}statfs). This patch move the generic statfs.h for both csky and nios2, and make the default definitions for newer ABIs to assume that only LFS will be support (so there is no need to keep no-LFS and LFS struct statfs with the same size, it will be implicit). This patch does not change the code generation. Reviewed-by: Carlos O'Donell --- .../linux/{generic => csky}/bits/statfs.h | 11 --- sysdeps/unix/sysv/linux/nios2/bits/statfs.h | 75 +++++++++++++++++++ 2 files changed, 75 insertions(+), 11 deletions(-) rename sysdeps/unix/sysv/linux/{generic => csky}/bits/statfs.h (79%) create mode 100644 sysdeps/unix/sysv/linux/nios2/bits/statfs.h diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/csky/bits/statfs.h similarity index 79% rename from sysdeps/unix/sysv/linux/generic/bits/statfs.h rename to sysdeps/unix/sysv/linux/csky/bits/statfs.h index bef18a3696..131b6adfba 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h +++ b/sysdeps/unix/sysv/linux/csky/bits/statfs.h @@ -1,6 +1,5 @@ /* Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -24,18 +23,8 @@ #include #include -/* 64-bit libc uses the kernel's 'struct statfs', accessed via the - statfs() syscall; 32-bit libc uses the kernel's 'struct statfs64' - and accesses it via the statfs64() syscall. All the various - APIs offered by libc use the kernel shape for their struct statfs - structure; the only difference is that 32-bit programs not - using __USE_FILE_OFFSET64 only see the low 32 bits of some - of the fields (the __fsblkcnt_t and __fsfilcnt_t fields). */ - #if defined __USE_FILE_OFFSET64 # define __field64(type, type64, name) type64 name -#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64 -# define __field64(type, type64, name) type name #elif __BYTE_ORDER == __LITTLE_ENDIAN # define __field64(type, type64, name) \ type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad diff --git a/sysdeps/unix/sysv/linux/nios2/bits/statfs.h b/sysdeps/unix/sysv/linux/nios2/bits/statfs.h new file mode 100644 index 0000000000..131b6adfba --- /dev/null +++ b/sysdeps/unix/sysv/linux/nios2/bits/statfs.h @@ -0,0 +1,75 @@ +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#ifndef _SYS_STATFS_H +# error "Never include directly; use instead." +#endif + +#include +#include +#include + +#if defined __USE_FILE_OFFSET64 +# define __field64(type, type64, name) type64 name +#elif __BYTE_ORDER == __LITTLE_ENDIAN +# define __field64(type, type64, name) \ + type name __attribute__((__aligned__ (__alignof__ (type64)))); int __##name##_pad +#else +# define __field64(type, type64, name) \ + int __##name##_pad __attribute__((__aligned__ (__alignof__ (type64)))); type name +#endif + +struct statfs + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_blocks); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bfree); + __field64(__fsblkcnt_t, __fsblkcnt64_t, f_bavail); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_files); + __field64(__fsfilcnt_t, __fsfilcnt64_t, f_ffree); + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; + +#undef __field64 + +#ifdef __USE_LARGEFILE64 +struct statfs64 + { + __SWORD_TYPE f_type; + __SWORD_TYPE f_bsize; + __fsblkcnt64_t f_blocks; + __fsblkcnt64_t f_bfree; + __fsblkcnt64_t f_bavail; + __fsfilcnt64_t f_files; + __fsfilcnt64_t f_ffree; + __fsid_t f_fsid; + __SWORD_TYPE f_namelen; + __SWORD_TYPE f_frsize; + __SWORD_TYPE f_flags; + __SWORD_TYPE f_spare[4]; + }; +#endif + +/* Tell code we have these members. */ +#define _STATFS_F_NAMELEN +#define _STATFS_F_FRSIZE +#define _STATFS_F_FLAGS From patchwork Mon Feb 8 21:49:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41970 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8DECB393C87D; Mon, 8 Feb 2021 21:50:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8DECB393C87D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821006; bh=5wMAVYplms+p9cl5xPo+Ks8DYgJDtXI8Hg+3TYepW5w=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=dQ5IHOx4N63jD9/Zfk5CpwF8Qd1CJ+HEqyhUObwkT8Rtwb1kzcrwkxi2vvNqLr+8q wJfYeSgbdEsNJLomVMxck459J3vhfjhL+VLAGT+/IbTUfVHAPNuhXY3QZpOr5XgjFP FIE4uicD4ggkdBi2ITEx+fQI6tB2DqbV3VoB71AI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) by sourceware.org (Postfix) with ESMTPS id 89EE0393C853 for ; Mon, 8 Feb 2021 21:50:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 89EE0393C853 Received: by mail-qk1-x734.google.com with SMTP id q85so3784423qke.8 for ; Mon, 08 Feb 2021 13:50:02 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=5wMAVYplms+p9cl5xPo+Ks8DYgJDtXI8Hg+3TYepW5w=; b=b8HptiDuDS59HRwAqEndpJt0WZtP1KTpT6pXPRBZUnRpb6fUem8ThJxAYgmSRIeCnU txrl058VQWGSKz/XSYWXNeNt2lZ1VY+rMr+lFVWS3wT7onfXh5dWMqpYEwW0R30n/mce Lmu6tYbUeKPtPlZmMb1amofO/DjrvRgGbFqoF7dtdMu9WVL/WGYBuFV1m+7I4tjPBKEw y7x1KwpVOczh1nQ6BLqwd5mY7/0XVYFg8HAQ7q6U8CKFDWiqUnbeXYWsV+jiRwpnerU6 kpjjbVljgmEQJJdXPXcVsG8KYMhfpqf9ZfgM9SB6t4WmYUbFL2kxHrKbPkm3Sld1siPT YUPg== X-Gm-Message-State: AOAM530XWnsSe5oQ5wJhqokZQ7unmjaKj9ZOoJp2dRv8w+p41KzUC22i vqJ0M7i4wfFINk6tn4EfAvx0FCoDIxGnkA== X-Google-Smtp-Source: ABdhPJxpxyTFXNo+eZpb/gBwCXZ2ep/ur4+A2rP5qK6vbUpejFrh0fqVc0OMLLCNA53g1Pvn5rPIAg== X-Received: by 2002:a37:4a49:: with SMTP id x70mr1124368qka.118.1612821001758; Mon, 08 Feb 2021 13:50:01 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.49.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:01 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 04/10] linux: Consolidate fstatfs implementations Date: Mon, 8 Feb 2021 18:49:30 -0300 Message-Id: <20210208214936.1502047-5-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The __NR_fstatfs64 syscall is supported on all architectures but aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses the new fstatfs64 interface (where the struct size is used as second argument). So the default implementation now uses: 1. __NR_fstatfs64 for non-LFS call and handle overflow directly There is no need to handle __NR_fstatfs since all architecture that only support is are LFS only. 2. __NR_fstatfs if defined or __NR_fstatfs64 otherwise for LFS call. Alpha the only outlier, since it is a 64-bit architecture which provides non-LFS interface and only provides __NR_fstatfs64 on newer kernels. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- include/sys/statfs.h | 7 +- .../{generic/wordsize-32 => alpha}/fstatfs.c | 13 ++-- sysdeps/unix/sysv/linux/alpha/fstatfs64.c | 52 +++++++++++++- sysdeps/unix/sysv/linux/alpha/syscalls.list | 1 - sysdeps/unix/sysv/linux/fstatfs.c | 62 +++++++++++++++++ sysdeps/unix/sysv/linux/fstatfs64.c | 67 +++---------------- .../sysv/linux/mips/mips64/n64/fstatfs64.c | 1 - .../sysv/linux/mips/mips64/n64/syscalls.list | 1 - .../unix/sysv/linux/wordsize-64/fstatfs64.c | 1 - .../unix/sysv/linux/wordsize-64/syscalls.list | 1 - 10 files changed, 129 insertions(+), 77 deletions(-) rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => alpha}/fstatfs.c (76%) create mode 100644 sysdeps/unix/sysv/linux/fstatfs.c delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/fstatfs64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/fstatfs64.c diff --git a/include/sys/statfs.h b/include/sys/statfs.h index 8a9f5a7b3b..756930a247 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -6,12 +6,11 @@ /* Now define the internal interfaces. */ extern int __statfs (const char *__file, struct statfs *__buf); libc_hidden_proto (__statfs) -extern int __fstatfs (int __fildes, struct statfs *__buf) - attribute_hidden; +extern int __fstatfs (int __fildes, struct statfs *__buf); +libc_hidden_proto (__fstatfs) extern int __statfs64 (const char *__file, struct statfs64 *__buf) attribute_hidden; -extern int __fstatfs64 (int __fildes, struct statfs64 *__buf) - attribute_hidden; +extern int __fstatfs64 (int __fildes, struct statfs64 *__buf); # endif /* !_ISOMAC */ #endif diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c b/sysdeps/unix/sysv/linux/alpha/fstatfs.c similarity index 76% rename from sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c rename to sysdeps/unix/sysv/linux/alpha/fstatfs.c index a611f33128..32c38d0db2 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/fstatfs.c +++ b/sysdeps/unix/sysv/linux/alpha/fstatfs.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. +/* Get filesystem statistics. Linux/alpha. + Copyright (C) 2011-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -18,18 +18,13 @@ #include #include -#include #include -#if !STATFS_IS_STATFS64 -#include "overflow.h" - /* Return information about the filesystem on which FD resides. */ int __fstatfs (int fd, struct statfs *buf) { - int rc = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf); - return rc ?: statfs_overflow (buf); + return INLINE_SYSCALL_CALL (fstatfs, fd, buf); } +libc_hidden_def (__fstatfs) weak_alias (__fstatfs, fstatfs) -#endif diff --git a/sysdeps/unix/sysv/linux/alpha/fstatfs64.c b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c index 5639959adb..0391c08338 100644 --- a/sysdeps/unix/sysv/linux/alpha/fstatfs64.c +++ b/sysdeps/unix/sysv/linux/alpha/fstatfs64.c @@ -1 +1,51 @@ -#include +/* Get filesystem statistics. Linux/alpha. + Copyright (C) 1996-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FILE resides. */ +int +__fstatfs64 (int fd, struct statfs64 *buf) +{ + int r = INLINE_SYSCALL_CALL (fstatfs64, fd, sizeof (*buf), buf); +#if __ASSUME_STATFS64 == 0 + if (r == -1 && errno == ENOSYS) + { + struct statfs buf32; + if (__fstatfs (fd, &buf32) < 0) + return -1; + + buf->f_type = buf32.f_type; + buf->f_bsize = buf32.f_bsize; + buf->f_blocks = buf32.f_blocks; + buf->f_bfree = buf32.f_bfree; + buf->f_bavail = buf32.f_bavail; + buf->f_files = buf32.f_files; + buf->f_ffree = buf32.f_ffree; + buf->f_fsid = buf32.f_fsid; + buf->f_namelen = buf32.f_namelen; + buf->f_frsize = buf32.f_frsize; + buf->f_flags = buf32.f_flags; + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + } +#endif + return r; +} +weak_alias (__fstatfs64, fstatfs64) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index c7cbe886ea..8cb588cb2c 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -29,5 +29,4 @@ utimes - utimes i:sp __utimes utimes@@GLIBC_2.1 getrusage - getrusage i:ip __getrusage getrusage@@GLIBC_2.1 # avoid 64-bit aliases on 32-bit statfs syscalls -fstatfs - fstatfs i:ip __fstatfs fstatfs statfs - statfs i:sp __statfs statfs diff --git a/sysdeps/unix/sysv/linux/fstatfs.c b/sysdeps/unix/sysv/linux/fstatfs.c new file mode 100644 index 0000000000..38d621967e --- /dev/null +++ b/sysdeps/unix/sysv/linux/fstatfs.c @@ -0,0 +1,62 @@ +/* Get filesystem statistics. Linux version. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include + +#if !STATFS_IS_STATFS64 + +/* Return information about the filesystem on which FILE resides. */ +int +__fstatfs (int fd, struct statfs *buf) +{ + struct statfs64 buf64; + int rc = INLINE_SYSCALL_CALL (fstatfs64, fd, sizeof (buf64), &buf64); + if (rc != 0) + return rc; + + buf->f_type = buf64.f_type; + buf->f_bsize = buf64.f_bsize; + buf->f_blocks = buf64.f_blocks; + buf->f_bfree = buf64.f_bfree; + buf->f_bavail = buf64.f_bavail; + buf->f_files = buf64.f_files; + buf->f_ffree = buf64.f_ffree; + buf->f_fsid = buf64.f_fsid; + buf->f_namelen = buf64.f_namelen; + buf->f_frsize = buf64.f_frsize; + buf->f_flags = buf64.f_flags; + memcpy (buf->f_spare, buf64.f_spare, sizeof (buf64.f_spare)); + + if ((fsblkcnt_t) buf64.f_blocks != buf64.f_blocks + || (fsblkcnt_t) buf64.f_bfree != buf64.f_bfree + || (fsblkcnt_t) buf64.f_bavail != buf64.f_bavail + || (fsblkcnt_t) buf64.f_files != buf64.f_files + || (fsblkcnt_t) buf64.f_ffree != buf64.f_ffree) + { + __set_errno (EOVERFLOW); + return -1; + } + + return 0; +} +libc_hidden_def (__fstatfs) +weak_alias (__fstatfs, fstatfs) +#endif diff --git a/sysdeps/unix/sysv/linux/fstatfs64.c b/sysdeps/unix/sysv/linux/fstatfs64.c index b5ff74d66c..e6aa643477 100644 --- a/sysdeps/unix/sysv/linux/fstatfs64.c +++ b/sysdeps/unix/sysv/linux/fstatfs64.c @@ -16,77 +16,28 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include +#define __fstatfs __fstatfs_disable +#define fstatfs fstatfs_disable +#include #include #include - -/* Hide the prototypes for __fstatfs and fstatfs so that GCC will not - complain about the different function signatures if they are aliased - to __fstat64. If STATFS_IS_STATFS64 is not zero then the statfs and - statfs64 structures have an identical layout but different type names. */ - -#if STATFS_IS_STATFS64 -# define __fstatfs __fstatfs_disable -# define fstatfs fstatfs_disable -#endif -#include - -#include - -/* Defined in statfs64.c. */ -extern int __no_statfs64 attribute_hidden; +#undef __fstatfs +#undef fstatfs /* Return information about the filesystem on which FD resides. */ int __fstatfs64 (int fd, struct statfs64 *buf) { #ifdef __NR_fstatfs64 -# if __ASSUME_STATFS64 == 0 - if (! __no_statfs64) -# endif - { - int result = INLINE_SYSCALL (fstatfs64, 3, fd, sizeof (*buf), buf); - -# if __ASSUME_STATFS64 == 0 - if (result == 0 || errno != ENOSYS) -# endif - return result; - -# if __ASSUME_STATFS64 == 0 - __no_statfs64 = 1; -# endif - } -#endif - -#if __ASSUME_STATFS64 == 0 - struct statfs buf32; - - if (__fstatfs (fd, &buf32) < 0) - return -1; - - buf->f_type = buf32.f_type; - buf->f_bsize = buf32.f_bsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_fsid = buf32.f_fsid; - buf->f_namelen = buf32.f_namelen; - buf->f_frsize = buf32.f_frsize; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); - - return 0; + return INLINE_SYSCALL_CALL (fstatfs64, fd, sizeof (*buf), buf); +#else + return INLINE_SYSCALL_CALL (fstatfs, fd, buf); #endif } weak_alias (__fstatfs64, fstatfs64) -#undef __fstatfs -#undef fstatfs - #if STATFS_IS_STATFS64 weak_alias (__fstatfs64, __fstatfs) weak_alias (__fstatfs64, fstatfs) +libc_hidden_ver (__fstatfs64, __fstatfs) #endif diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatfs64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatfs64.c deleted file mode 100644 index 6e25b021ab..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/fstatfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list index 8e7d516a2a..b6a0c92829 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list @@ -4,7 +4,6 @@ prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark -fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64 statfs - statfs i:sp __statfs statfs statfs64 __statfs64 sendfile - sendfile i:iipi sendfile sendfile64 diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fstatfs64.c b/sysdeps/unix/sysv/linux/wordsize-64/fstatfs64.c deleted file mode 100644 index 2be4e59ba4..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/fstatfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* fstatfs64 is the same as fstatfs. */ diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list index 5de6ec823a..5a0c910847 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list @@ -1,6 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names -fstatfs - fstatfs i:ip __fstatfs fstatfs fstatfs64 __fstatfs64 statfs - statfs i:sp __statfs statfs statfs64 sendfile - sendfile i:iipi sendfile sendfile64 prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 From patchwork Mon Feb 8 21:49:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41971 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D69D3945065; Mon, 8 Feb 2021 21:50:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D69D3945065 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821008; bh=NwJPdnvVBf2c/iiZw0QC4X0xMXi8Kz2SzK93O/RFxj8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=aq4Ghfy72YOWrbf5tTHqC6xHjaTn/pd41kNnSEiaDw7KlU4JrkmXGsuU9gq95IBnK Ro+52Qbi35g7fKhNZWDLIV4WQXiVE2nCi1uzk74tnqht68xeK9F1WAAvF8aoHa+1zS aR84d330uANiKANl/8kubrT+u0ZW6Dht7K1Va7D4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id B89A6393C875 for ; Mon, 8 Feb 2021 21:50:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B89A6393C875 Received: by mail-qt1-x82a.google.com with SMTP id o21so2635681qtr.3 for ; Mon, 08 Feb 2021 13:50:04 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=NwJPdnvVBf2c/iiZw0QC4X0xMXi8Kz2SzK93O/RFxj8=; b=LSFuYdNTyMbeQSdhcqAj7ACOAWHEGQ2bYEfkZSdvZ1LPVbqbg/Rr+wjhE7yXsBKzN1 3tIWWMmbRdmoz9udtng9sPOhgyIBZbBJcb5tcVyQpNrrgTiw3/LdQ2DdEy9lAgmX4/fC 90QMD9JNEE5brWRXc+BaaMF+w7mBvFHyS4EorpcneyGx6YlGKnPMrsOJcJt98FetWlAV zyhW34tvS2VKkTANupmak35UA5JZbeVLJbgl/XgjeU9oy/UTlVo1mk3nHqVpwgD3LUu+ Pzk8NL2xKPtfDgfstmEIlbEiXacygRU8ITGxL+lbvoc0XCcXjMdHDCxegbIkIQ9jy2mY bwHw== X-Gm-Message-State: AOAM533TEnF3Kell/8O82PIrQHrqzHQZ4XXayu/n0IdEFlOOAgSWBZMe 5xvOYq2PSffAjoPd5JF3+TYcOlVmU8xDkQ== X-Google-Smtp-Source: ABdhPJx6g95nVJlr/cgGrpLTpEssL+OboHqvWH2VSxMqZPmUPxeSoktXkiRRzsIdMxyIhPWOFQKxSw== X-Received: by 2002:ac8:4501:: with SMTP id q1mr5780624qtn.268.1612821003905; Mon, 08 Feb 2021 13:50:03 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:03 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 05/10] linux: Consolidate statfs implementations Date: Mon, 8 Feb 2021 18:49:31 -0300 Message-Id: <20210208214936.1502047-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The __NR_statfs64 syscall is supported on all architectures but aarch64, mips64, riscv64, and x86_64. And newer ABIs also uses the new statfs64 interface (where the struct size is used as second argument). So the default implementation now uses: 1. __NR_statfs64 for non-LFS call and handle overflow directly There is no need to handle __NR_statfs since all architecture that only support is are LFS only. 2. __NR_statfs if defined or __NR_statfs64 otherwise for LFS call. Alpha is the only outlier, since it is a 64-bit architecture which provides non-LFS interface and only provides __NR_fstatfs64 on newer kernels. Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- .../{generic/wordsize-32 => alpha}/statfs.c | 16 ++--- sysdeps/unix/sysv/linux/alpha/statfs64.c | 52 +++++++++++++- sysdeps/unix/sysv/linux/alpha/syscalls.list | 3 - .../sysv/linux/mips/mips64/n64/statfs64.c | 1 - .../sysv/linux/mips/mips64/n64/syscalls.list | 2 - sysdeps/unix/sysv/linux/statfs.c | 61 ++++++++++++++++ sysdeps/unix/sysv/linux/statfs64.c | 69 +++---------------- .../unix/sysv/linux/wordsize-64/statfs64.c | 1 - .../unix/sysv/linux/wordsize-64/syscalls.list | 1 - 9 files changed, 125 insertions(+), 81 deletions(-) rename sysdeps/unix/sysv/linux/{generic/wordsize-32 => alpha}/statfs.c (72%) delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/n64/statfs64.c create mode 100644 sysdeps/unix/sysv/linux/statfs.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/statfs64.c diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c b/sysdeps/unix/sysv/linux/alpha/statfs.c similarity index 72% rename from sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c rename to sysdeps/unix/sysv/linux/alpha/statfs.c index 2c51fbf1b0..33789768ed 100644 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/statfs.c +++ b/sysdeps/unix/sysv/linux/alpha/statfs.c @@ -1,6 +1,6 @@ -/* Copyright (C) 2011-2021 Free Software Foundation, Inc. +/* Return information about the filesystem on which FILE resides. Linux/alpha. + Copyright (C) 1996-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -13,24 +13,18 @@ Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see + License along with the GNU C Library; if not, see . */ -#include #include -#include #include - -#if !STATFS_IS_STATFS64 -#include "overflow.h" +#include /* Return information about the filesystem on which FILE resides. */ int __statfs (const char *file, struct statfs *buf) { - int rc = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf); - return rc ?: statfs_overflow (buf); + return INLINE_SYSCALL_CALL (statfs, file, buf); } libc_hidden_def (__statfs) weak_alias (__statfs, statfs) -#endif diff --git a/sysdeps/unix/sysv/linux/alpha/statfs64.c b/sysdeps/unix/sysv/linux/alpha/statfs64.c index fe39cc4685..083b9a59f3 100644 --- a/sysdeps/unix/sysv/linux/alpha/statfs64.c +++ b/sysdeps/unix/sysv/linux/alpha/statfs64.c @@ -1 +1,51 @@ -#include +/* Return information about the filesystem on which FILE resides. Linux/alpha. + Copyright (C) 1996-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs64 (const char *file, struct statfs64 *buf) +{ + int r = INLINE_SYSCALL_CALL (statfs64, file, sizeof (*buf), buf); +#if __ASSUME_STATFS64 == 0 + if (r == -1 && errno == ENOSYS) + { + struct statfs buf32; + if (__statfs (file, &buf32) < 0) + return -1; + + buf->f_type = buf32.f_type; + buf->f_bsize = buf32.f_bsize; + buf->f_blocks = buf32.f_blocks; + buf->f_bfree = buf32.f_bfree; + buf->f_bavail = buf32.f_bavail; + buf->f_files = buf32.f_files; + buf->f_ffree = buf32.f_ffree; + buf->f_fsid = buf32.f_fsid; + buf->f_namelen = buf32.f_namelen; + buf->f_frsize = buf32.f_frsize; + buf->f_flags = buf32.f_flags; + memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); + } +#endif + return r; +} +weak_alias (__statfs64, statfs64) diff --git a/sysdeps/unix/sysv/linux/alpha/syscalls.list b/sysdeps/unix/sysv/linux/alpha/syscalls.list index 8cb588cb2c..c848fcbd99 100644 --- a/sysdeps/unix/sysv/linux/alpha/syscalls.list +++ b/sysdeps/unix/sysv/linux/alpha/syscalls.list @@ -27,6 +27,3 @@ getitimer - getitimer i:ip __getitimer getitimer@@GLIBC_2.1 setitimer - setitimer i:ipP __setitimer setitimer@@GLIBC_2.1 utimes - utimes i:sp __utimes utimes@@GLIBC_2.1 getrusage - getrusage i:ip __getrusage getrusage@@GLIBC_2.1 - -# avoid 64-bit aliases on 32-bit statfs syscalls -statfs - statfs i:sp __statfs statfs diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/statfs64.c b/sysdeps/unix/sysv/linux/mips/mips64/n64/statfs64.c deleted file mode 100644 index 6e25b021ab..0000000000 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/statfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* Empty. */ diff --git a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list index b6a0c92829..e4e16dfa49 100644 --- a/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list +++ b/sysdeps/unix/sysv/linux/mips/mips64/n64/syscalls.list @@ -4,6 +4,4 @@ prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 fanotify_mark EXTRA fanotify_mark i:iiiis fanotify_mark -statfs - statfs i:sp __statfs statfs statfs64 __statfs64 - sendfile - sendfile i:iipi sendfile sendfile64 diff --git a/sysdeps/unix/sysv/linux/statfs.c b/sysdeps/unix/sysv/linux/statfs.c new file mode 100644 index 0000000000..ee248b4212 --- /dev/null +++ b/sysdeps/unix/sysv/linux/statfs.c @@ -0,0 +1,61 @@ +/* Copyright (C) 2011-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Chris Metcalf , 2011. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library. If not, see + . */ + +#include +#include +#include +#include + +#if !STATFS_IS_STATFS64 + +/* Return information about the filesystem on which FILE resides. */ +int +__statfs (const char *file, struct statfs *buf) +{ + struct statfs64 buf64; + int rc = INLINE_SYSCALL_CALL (statfs64, file, sizeof (buf64), &buf64); + if (rc == 0) + { + buf->f_type = buf64.f_type; + buf->f_bsize = buf64.f_bsize; + buf->f_blocks = buf64.f_blocks; + buf->f_bfree = buf64.f_bfree; + buf->f_bavail = buf64.f_bavail; + buf->f_files = buf64.f_files; + buf->f_ffree = buf64.f_ffree; + buf->f_fsid = buf64.f_fsid; + buf->f_namelen = buf64.f_namelen; + buf->f_frsize = buf64.f_frsize; + buf->f_flags = buf64.f_flags; + memcpy (buf->f_spare, buf64.f_spare, sizeof (buf64.f_spare)); + + if ((fsblkcnt_t) buf64.f_blocks != buf64.f_blocks + || (fsblkcnt_t) buf64.f_bfree != buf64.f_bfree + || (fsblkcnt_t) buf64.f_bavail != buf64.f_bavail + || (fsblkcnt_t) buf64.f_files != buf64.f_files + || (fsblkcnt_t) buf64.f_ffree != buf64.f_ffree) + { + __set_errno (EOVERFLOW); + return -1; + } + } + return rc; +} +libc_hidden_def (__statfs) +weak_alias (__statfs, statfs) +#endif diff --git a/sysdeps/unix/sysv/linux/statfs64.c b/sysdeps/unix/sysv/linux/statfs64.c index c52b3d8ae6..4f68212e9f 100644 --- a/sysdeps/unix/sysv/linux/statfs64.c +++ b/sysdeps/unix/sysv/linux/statfs64.c @@ -16,79 +16,26 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include +#define __statfs __statfs_disable +#define statfs statfs_disable +#include #include #include - -/* Hide the prototypes for __statfs and statfs so that GCC will not - complain about the different function signatures if they are aliased - to __stat64. If STATFS_IS_STATFS64 is not zero then the statfs and - statfs64 structures have an identical layout but different type names. */ - -#if STATFS_IS_STATFS64 -# define __statfs __statfs_disable -# define statfs statfs_disable -#endif -#include - -#include - - -# if __ASSUME_STATFS64 == 0 -int __no_statfs64 attribute_hidden; -#endif +#undef __statfs +#undef statfs /* Return information about the filesystem on which FILE resides. */ int __statfs64 (const char *file, struct statfs64 *buf) { #ifdef __NR_statfs64 -# if __ASSUME_STATFS64 == 0 - if (! __no_statfs64) -# endif - { - int result = INLINE_SYSCALL (statfs64, 3, file, sizeof (*buf), buf); - -# if __ASSUME_STATFS64 == 0 - if (result == 0 || errno != ENOSYS) -# endif - return result; - -# if __ASSUME_STATFS64 == 0 - __no_statfs64 = 1; -# endif - } -#endif - -#if __ASSUME_STATFS64 == 0 - struct statfs buf32; - - if (__statfs (file, &buf32) < 0) - return -1; - - buf->f_type = buf32.f_type; - buf->f_bsize = buf32.f_bsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_fsid = buf32.f_fsid; - buf->f_namelen = buf32.f_namelen; - buf->f_frsize = buf32.f_frsize; - buf->f_flags = buf32.f_flags; - memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare)); - - return 0; + return INLINE_SYSCALL_CALL (statfs64, file, sizeof (*buf), buf); +#else + return INLINE_SYSCALL_CALL (statfs, file, buf); #endif } weak_alias (__statfs64, statfs64) -#undef __statfs -#undef statfs - #if STATFS_IS_STATFS64 weak_alias (__statfs64, __statfs) weak_alias (__statfs64, statfs) diff --git a/sysdeps/unix/sysv/linux/wordsize-64/statfs64.c b/sysdeps/unix/sysv/linux/wordsize-64/statfs64.c deleted file mode 100644 index 06bc68826f..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/statfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* statfs64 is the same as statfs. */ diff --git a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list index 5a0c910847..68e3c60536 100644 --- a/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list +++ b/sysdeps/unix/sysv/linux/wordsize-64/syscalls.list @@ -1,6 +1,5 @@ # File name Caller Syscall name # args Strong name Weak names -statfs - statfs i:sp __statfs statfs statfs64 sendfile - sendfile i:iipi sendfile sendfile64 prlimit EXTRA prlimit64 i:iipp prlimit prlimit64 From patchwork Mon Feb 8 21:49:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41972 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21DBB394EC3C; Mon, 8 Feb 2021 21:50:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21DBB394EC3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821010; bh=f20BcoSSYjc6RiSz318eYiEg2OgbhvN6LZrVSemM4iM=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MlWL6WodWa6thN6JOErGQSo4oRlwBaGQZPNVaFp//MwoCgd9hrTtVeVMG8fLS2KMy 5D/EYiNtRSjDOrxf5ZYdNDPGRDzlfDkwnRTR0kiCtz+g2CiXphpkReVF4yboWvNi92 5qoKpnr0hc5A2yBH4Fq5YvVD+7yRHmq5A4RFp+Wc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) by sourceware.org (Postfix) with ESMTPS id 2F47D393C865 for ; Mon, 8 Feb 2021 21:50:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F47D393C865 Received: by mail-qk1-x72d.google.com with SMTP id s77so16088840qke.4 for ; Mon, 08 Feb 2021 13:50:06 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=f20BcoSSYjc6RiSz318eYiEg2OgbhvN6LZrVSemM4iM=; b=UeRSjaeE4NCR3PlOc4+fuSFzPynsFB2JXWnoLlCWAubBc5TNP1AWAGqvNaxmShzw82 pkNZGooyNuU30WYVNCb93NIQP/KhuU0QiwR3si4z7uBpyfBYoI1WrIvtDWRimftb/WeT d4/HbSka6tJHcDjB/hN6vZ+0FCKGB+v5mAEy0yAtZ/vKw+uiBhgSWYV8giOHGZpba12I fO6K/CHJByNu2xZVTopRK34T9+4fFLLmp6VmRxpIX3/NPHCQdVE2KhInfEZLryMzC1H0 30QWz5k6aUqisEsuXISqoWv8lL1pqI+SpCmvj0mqQyYR9B1nCIivq4YJpv1CFcLkN+SI 95Dw== X-Gm-Message-State: AOAM530mHjRAIayac+nbn6Ek0cn+Bxgt+OOm828gU4c/szRonY9lyN2h a7e63aAdhaoNz7BIa/TOHqrB44V+9WqsmA== X-Google-Smtp-Source: ABdhPJzhSXE+87CTmJApX3+Ncbk9WxK/BW11WSMGIuKj3ka29Gt4s9BGrmhc48wwq/BEVeA/qUn1ig== X-Received: by 2002:a37:a6d8:: with SMTP id p207mr4878874qke.478.1612821005551; Mon, 08 Feb 2021 13:50:05 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:05 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 06/10] linux: Consolidate fstatvfs implementations Date: Mon, 8 Feb 2021 18:49:32 -0300 Message-Id: <20210208214936.1502047-7-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" There is no need to handle ENOSYS on fstatfs64 call, required only for alpha (where is already fallbacks to fstatfs). The wordsize internal_statvfs64.c is removed, since how the LFS support is provided by fstatvfs64.c (used on 64-bit architectures as well). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/alpha/fstatvfs.c | 1 - sysdeps/unix/sysv/linux/alpha/fstatvfs64.c | 1 - sysdeps/unix/sysv/linux/fstatvfs.c | 9 ++-- sysdeps/unix/sysv/linux/fstatvfs64.c | 53 +++++++------------ .../unix/sysv/linux/wordsize-64/fstatvfs.c | 5 -- .../unix/sysv/linux/wordsize-64/fstatvfs64.c | 1 - .../linux/wordsize-64/internal_statvfs64.c | 1 - 7 files changed, 25 insertions(+), 46 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/fstatvfs.c delete mode 100644 sysdeps/unix/sysv/linux/alpha/fstatvfs64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/fstatvfs64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c diff --git a/sysdeps/unix/sysv/linux/alpha/fstatvfs.c b/sysdeps/unix/sysv/linux/alpha/fstatvfs.c deleted file mode 100644 index 92e772347b..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/fstatvfs.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c b/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c deleted file mode 100644 index 0f1e71027a..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/fstatvfs64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/fstatvfs.c b/sysdeps/unix/sysv/linux/fstatvfs.c index 8b67951ab6..0f56a13ca9 100644 --- a/sysdeps/unix/sysv/linux/fstatvfs.c +++ b/sysdeps/unix/sysv/linux/fstatvfs.c @@ -16,11 +16,13 @@ License along with the GNU C Library; if not, see . */ -#include -#include +#include #include -#include "internal_statvfs.h" +#include +#include +#include +#if !STATFS_IS_STATFS64 int __fstatvfs (int fd, struct statvfs *buf) { @@ -38,3 +40,4 @@ __fstatvfs (int fd, struct statvfs *buf) } weak_alias (__fstatvfs, fstatvfs) libc_hidden_weak (fstatvfs) +#endif diff --git a/sysdeps/unix/sysv/linux/fstatvfs64.c b/sysdeps/unix/sysv/linux/fstatvfs64.c index 6d2dbc5285..b95745e8b8 100644 --- a/sysdeps/unix/sysv/linux/fstatvfs64.c +++ b/sysdeps/unix/sysv/linux/fstatvfs64.c @@ -16,48 +16,33 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include +#define __fstatvfs __fstatvfs_disable +#define fstatvfs fstatvfs_disable +#include #include -#include "internal_statvfs.h" -#include +#include +#include +#include /* Return information about the filesystem on which FD resides. */ int __fstatvfs64 (int fd, struct statvfs64 *buf) { struct statfs64 fsbuf; - int res = __fstatfs64 (fd, &fsbuf); - -#ifndef __ASSUME_STATFS64 - if (res < 0 && errno == ENOSYS) - { - struct statvfs buf32; - - res = fstatvfs (fd, &buf32); - if (res == 0) - { - buf->f_bsize = buf32.f_bsize; - buf->f_frsize = buf32.f_frsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_favail = buf32.f_favail; - buf->f_fsid = buf32.f_fsid; - buf->f_flag = buf32.f_flag; - buf->f_namemax = buf32.f_namemax; - memcpy (buf->__f_spare, buf32.__f_spare, sizeof (buf32.__f_spare)); - } - } -#endif + if (__fstatfs64 (fd, &fsbuf) < 0) + return -1; - if (res == 0) - /* Convert the result. */ - __internal_statvfs64 (NULL, buf, &fsbuf, fd); + /* Convert the result. */ + __internal_statvfs64 (NULL, buf, &fsbuf, fd); - return res; + return 0; } weak_alias (__fstatvfs64, fstatvfs64) + +#undef __fstatvfs +#undef fstatvfs + +#if STATFS_IS_STATFS64 +weak_alias (__fstatvfs64, __fstatvfs) +weak_alias (__fstatvfs64, fstatvfs) +#endif diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c b/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c deleted file mode 100644 index 5803b6f882..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs.c +++ /dev/null @@ -1,5 +0,0 @@ -#define __fstatvfs64(file, buf) __no_fstatvfs64(file, buf) -#define fstatvfs64(file, buf) no_fstatvfs64(file, buf) -#include "../fstatvfs.c" -strong_alias (__fstatvfs, __fstatvfs64) -weak_alias (__fstatvfs, fstatvfs64) diff --git a/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs64.c b/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs64.c deleted file mode 100644 index 60f3dfec61..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/fstatvfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* fstatvfs64 is the same as fstatvfs. */ diff --git a/sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c b/sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c deleted file mode 100644 index d2a3509c6d..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* Nothing. */ From patchwork Mon Feb 8 21:49:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41973 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A57D23950408; Mon, 8 Feb 2021 21:50:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A57D23950408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821010; bh=/C+FoUgPYBLdYcvprsVUOgWSqNnHsjOWcWdrOarjPNo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nsDwD/EV2WHTkld7JNbRW9mq596ntvAGXL3aaPkfPxDEf7oYbH9nawaTWeijDbyub oI7O+1AW0REzMQCAjyB9/IvJb4C8nQznYC/qHUdTrYF+/7hBCs/Y8ihd5xxyrNjqUR NNhQXJ5r5DoJ1Uv1mmXw/XtNlARg1q03fsJPdDSY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by sourceware.org (Postfix) with ESMTPS id D7C32393C865 for ; Mon, 8 Feb 2021 21:50:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D7C32393C865 Received: by mail-qk1-x733.google.com with SMTP id u20so16080833qku.7 for ; Mon, 08 Feb 2021 13:50:07 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=/C+FoUgPYBLdYcvprsVUOgWSqNnHsjOWcWdrOarjPNo=; b=s6onv+ZW4KjiCvnPcFIXbJmvszxezzQTzTSk+3qlAzqnMVP9McYSYGCOuVzW00rpFd avMYW+QB2qt2ga/exAXHFaaTNBQXAMyISx7Yos+hHZ9zhhtpO9rNdnjwygLvHDHGriwf tE3+elBh/EcQnVr8y8m49AkUNBPP3LcGGvqxraSn+cD0asTqs5Gehvr2RViO+owGTBAi clMq+/BFWg8kj2d2hlpK/aZgtdvNEUJOxOaQY1LpAnemfKEebGF9X3oqAN1cbEvMT+gv rshYrF7Rmlp5VmRSXwUdcQyOkIEz7BwFHfd2AjVjHH1GPp0y7obAEpr0i/2XqPRNGCny UsRA== X-Gm-Message-State: AOAM533fDB8E6PcvDsUS2O2A02KR3UWa9gknMOnTlRYdRpvs+ZXsXJj6 tglooezwcidzAlxZZDreDnrw8svtM2MCtw== X-Google-Smtp-Source: ABdhPJzYotpMt1IBexzuayQ97XyHD7Oeli1+Ns9so/Oy1GmO2gKUN7bGD4GbEdUtGBsSm+tx8XeM5g== X-Received: by 2002:a05:620a:10a2:: with SMTP id h2mr19128744qkk.463.1612821007249; Mon, 08 Feb 2021 13:50:07 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:06 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 07/10] linux: Consolidate statvfs implementations Date: Mon, 8 Feb 2021 18:49:33 -0300 Message-Id: <20210208214936.1502047-8-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" There is no need to handle ENOSYS on fstatfs64 call, required only for alpha (where is already fallbacks to fstatfs). Checked on x86_64-linux-gnu. Reviewed-by: Carlos O'Donell --- include/sys/statvfs.h | 3 +- sysdeps/unix/sysv/linux/alpha/statvfs.c | 1 - sysdeps/unix/sysv/linux/alpha/statvfs64.c | 1 - sysdeps/unix/sysv/linux/statvfs.c | 9 ++-- sysdeps/unix/sysv/linux/statvfs64.c | 54 +++++++------------ sysdeps/unix/sysv/linux/wordsize-64/statvfs.c | 5 -- .../unix/sysv/linux/wordsize-64/statvfs64.c | 1 - 7 files changed, 26 insertions(+), 48 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/statvfs.c delete mode 100644 sysdeps/unix/sysv/linux/alpha/statvfs64.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/statvfs.c delete mode 100644 sysdeps/unix/sysv/linux/wordsize-64/statvfs64.c diff --git a/include/sys/statvfs.h b/include/sys/statvfs.h index 4cd1977c35..d7fe33119a 100644 --- a/include/sys/statvfs.h +++ b/include/sys/statvfs.h @@ -3,8 +3,7 @@ #ifndef _ISOMAC /* Now define the internal interfaces. */ -extern int __statvfs64 (const char *__file, struct statvfs64 *__buf) - attribute_hidden; +extern int __statvfs64 (const char *__file, struct statvfs64 *__buf); extern int __fstatvfs64 (int __fildes, struct statvfs64 *__buf) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/alpha/statvfs.c b/sysdeps/unix/sysv/linux/alpha/statvfs.c deleted file mode 100644 index 78069e96f4..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/statvfs.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/alpha/statvfs64.c b/sysdeps/unix/sysv/linux/alpha/statvfs64.c deleted file mode 100644 index c80e17751d..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/statvfs64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/statvfs.c b/sysdeps/unix/sysv/linux/statvfs.c index 8895694e5d..f165899711 100644 --- a/sysdeps/unix/sysv/linux/statvfs.c +++ b/sysdeps/unix/sysv/linux/statvfs.c @@ -16,11 +16,13 @@ License along with the GNU C Library; if not, see . */ -#include -#include +#include #include -#include "internal_statvfs.h" +#include +#include +#include +#if !STATFS_IS_STATFS64 int __statvfs (const char *file, struct statvfs *buf) { @@ -38,3 +40,4 @@ __statvfs (const char *file, struct statvfs *buf) } weak_alias (__statvfs, statvfs) libc_hidden_weak (statvfs) +#endif diff --git a/sysdeps/unix/sysv/linux/statvfs64.c b/sysdeps/unix/sysv/linux/statvfs64.c index b03a88816c..3d29908afa 100644 --- a/sysdeps/unix/sysv/linux/statvfs64.c +++ b/sysdeps/unix/sysv/linux/statvfs64.c @@ -16,49 +16,33 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include -#include +#define __statvfs __statvfs_disable +#define statvfs statvfs_disable +#include #include -#include "internal_statvfs.h" -#include +#include +#include +#include /* Return information about the filesystem on which FILE resides. */ int __statvfs64 (const char *file, struct statvfs64 *buf) { struct statfs64 fsbuf; - int res = __statfs64 (file, &fsbuf); + if (__statfs64 (file, &fsbuf) < 0) + return -1; -#ifndef __ASSUME_STATFS64 - if (res < 0 && errno == ENOSYS) - { - struct statvfs buf32; + /* Convert the result. */ + __internal_statvfs64 (file, buf, &fsbuf, -1); - res = statvfs (file, &buf32); - if (res == 0) - { - buf->f_bsize = buf32.f_bsize; - buf->f_frsize = buf32.f_frsize; - buf->f_blocks = buf32.f_blocks; - buf->f_bfree = buf32.f_bfree; - buf->f_bavail = buf32.f_bavail; - buf->f_files = buf32.f_files; - buf->f_ffree = buf32.f_ffree; - buf->f_favail = buf32.f_favail; - buf->f_fsid = buf32.f_fsid; - buf->f_flag = buf32.f_flag; - buf->f_namemax = buf32.f_namemax; - memcpy (buf->__f_spare, buf32.__f_spare, sizeof (buf32.__f_spare)); - } - } -#endif - - if (res == 0) - /* Convert the result. */ - __internal_statvfs64 (file, buf, &fsbuf, -1); - - return res; + return 0; } weak_alias (__statvfs64, statvfs64) + +#undef __statvfs +#undef statvfs + +#if STATFS_IS_STATFS64 +weak_alias (__statvfs64, __statvfs) +weak_alias (__statvfs64, statvfs) +#endif diff --git a/sysdeps/unix/sysv/linux/wordsize-64/statvfs.c b/sysdeps/unix/sysv/linux/wordsize-64/statvfs.c deleted file mode 100644 index 1e1c96333b..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/statvfs.c +++ /dev/null @@ -1,5 +0,0 @@ -#define __statvfs64(file, buf) __no_statvfs64(file, buf) -#define statvfs64(file, buf) no_statvfs64(file, buf) -#include "../statvfs.c" -strong_alias (__statvfs, __statvfs64) -weak_alias (__statvfs, statvfs64) diff --git a/sysdeps/unix/sysv/linux/wordsize-64/statvfs64.c b/sysdeps/unix/sysv/linux/wordsize-64/statvfs64.c deleted file mode 100644 index 510015e420..0000000000 --- a/sysdeps/unix/sysv/linux/wordsize-64/statvfs64.c +++ /dev/null @@ -1 +0,0 @@ -/* statvfs64 is the same as statvfs. */ From patchwork Mon Feb 8 21:49:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41974 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3A3B5395041B; Mon, 8 Feb 2021 21:50:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A3B5395041B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821012; bh=REkQHxx01CgUQ9MyOD4eykOaSvSNPWE8j8gZrrH4zjA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XXIHV2xntRav8bJcgoV48dXInpAsNHZJiLNUIIhjZDvvYunWhRBNlyGKFhdYI4iha ITyLuMBstT7Q+Uok+Yyg5/tDDmtCMziIlAKGRNIRcA+9HdFb/1kQ+x0sNvZqKQMg64 rLOkQ5rtDp9PSTE1E8xmbAGzCzJnsxHT0EDVq7bQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by sourceware.org (Postfix) with ESMTPS id 9AB9C393C853 for ; Mon, 8 Feb 2021 21:50:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9AB9C393C853 Received: by mail-qt1-x829.google.com with SMTP id o21so2635864qtr.3 for ; Mon, 08 Feb 2021 13:50:09 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=REkQHxx01CgUQ9MyOD4eykOaSvSNPWE8j8gZrrH4zjA=; b=QuIwTOrWvMjMngSnDyqinUpQrE975JbdddHqQFZFDQEI1hq/ORV8QHQQKhI++5capF /qi5OiMXnDuWGOyYAVgNfKY1NmJIrMHzWBeM/eUHTgF13MBR6ov2BSuuen6AMyrXep2P 8VZ8UIin0+oo7EyRbC8kqs58HUmmZyiOIfZrXxgSHvwrGvaBdJk54x2fVgZXnB8HMldR as5uevqaRKuBXlbNmkpqIejTWAF7PnjLWOcS19onC1b2KNVmtEhjIqqWPjqIeT4Cjnjn ahzpZfb5IDooLogtHqzywvFws7YUA95Ogiwgpp9KUVGFT6x/Z+n99LDUReDmjevMCdIh juzA== X-Gm-Message-State: AOAM532Rc75qucDfUMfh04YOaq1OWT+yVVFFhaY1a6blyWM+Cw4hLKr5 Eh9hpXoZKlkg5aR9jPxWJ8dJAbxEmImPjw== X-Google-Smtp-Source: ABdhPJyTQvsWFUBWJEI3GYFC1xJGsLvNPNJUUjll5IIAlqekrVA9RIXGHgoMoONZwQOloOTDGyD4OQ== X-Received: by 2002:ac8:7151:: with SMTP id h17mr13881760qtp.291.1612821008897; Mon, 08 Feb 2021 13:50:08 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:08 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 08/10] linux: Consolidate internal_statvfs Date: Mon, 8 Feb 2021 18:49:34 -0300 Message-Id: <20210208214936.1502047-9-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Remove the internal_statvfs64.c and open code the implementation on internal_statvfs.c. The alpha is now unrequired, the generic implementation also handles it. Also, removed unused includes on internal_statvfs.c, and remove unused arguments on __internal_statvfs{64}. Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/Makefile | 2 +- .../sysv/linux/alpha/internal_statvfs64.c | 1 - sysdeps/unix/sysv/linux/fstatvfs.c | 2 +- sysdeps/unix/sysv/linux/fstatvfs64.c | 2 +- sysdeps/unix/sysv/linux/internal_statvfs.c | 70 +++++++++++++------ sysdeps/unix/sysv/linux/internal_statvfs.h | 8 +-- sysdeps/unix/sysv/linux/internal_statvfs64.c | 4 -- sysdeps/unix/sysv/linux/statvfs.c | 2 +- sysdeps/unix/sysv/linux/statvfs64.c | 2 +- 9 files changed, 56 insertions(+), 37 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c delete mode 100644 sysdeps/unix/sysv/linux/internal_statvfs64.c diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index a0a6dcef17..488114a41e 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -273,7 +273,7 @@ CFLAGS-ypclnt.c = -DUSE_BINDINGDIR=1 endif ifeq ($(subdir),io) -sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ +sysdep_routines += xstatconv internal_statvfs \ sync_file_range fallocate fallocate64 \ close_nocancel fcntl_nocancel \ open_nocancel open64_nocancel \ diff --git a/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c b/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c deleted file mode 100644 index 81d18f7bb2..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/internal_statvfs64.c +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/sysdeps/unix/sysv/linux/fstatvfs.c b/sysdeps/unix/sysv/linux/fstatvfs.c index 0f56a13ca9..ba3fd22cfb 100644 --- a/sysdeps/unix/sysv/linux/fstatvfs.c +++ b/sysdeps/unix/sysv/linux/fstatvfs.c @@ -33,7 +33,7 @@ __fstatvfs (int fd, struct statvfs *buf) return -1; /* Convert the result. */ - __internal_statvfs (NULL, buf, &fsbuf, fd); + __internal_statvfs (buf, &fsbuf); /* We signal success if the statfs call succeeded. */ return 0; diff --git a/sysdeps/unix/sysv/linux/fstatvfs64.c b/sysdeps/unix/sysv/linux/fstatvfs64.c index b95745e8b8..ba869f594c 100644 --- a/sysdeps/unix/sysv/linux/fstatvfs64.c +++ b/sysdeps/unix/sysv/linux/fstatvfs64.c @@ -33,7 +33,7 @@ __fstatvfs64 (int fd, struct statvfs64 *buf) return -1; /* Convert the result. */ - __internal_statvfs64 (NULL, buf, &fsbuf, fd); + __internal_statvfs64 (buf, &fsbuf); return 0; } diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.c b/sysdeps/unix/sysv/linux/internal_statvfs.c index 4d9064141c..39fcb5d429 100644 --- a/sysdeps/unix/sysv/linux/internal_statvfs.c +++ b/sysdeps/unix/sysv/linux/internal_statvfs.c @@ -16,37 +16,61 @@ License along with the GNU C Library; if not, see . */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include "internal_statvfs.h" -#include "linux_fsinfo.h" -#include - +#include +#include +#include +#include +#include /* Special internal-only bit value. */ -#define ST_VALID 0x0020 +# define ST_VALID 0x0020 - -#ifndef STATFS -# define STATFS statfs -# define STATVFS statvfs -# define INTERNAL_STATVFS __internal_statvfs -#else -extern int __statvfs_getflags (const char *name, int fstype, int fd); +#if !STATFS_IS_STATFS64 +void +__internal_statvfs (struct statvfs *buf, const struct statfs *fsbuf) +{ + /* Now fill in the fields we have information for. */ + buf->f_bsize = fsbuf->f_bsize; + /* Linux has the f_frsize size only in later version of the kernel. + If the value is not filled in use f_bsize. */ + buf->f_frsize = fsbuf->f_frsize ?: fsbuf->f_bsize; + buf->f_blocks = fsbuf->f_blocks; + buf->f_bfree = fsbuf->f_bfree; + buf->f_bavail = fsbuf->f_bavail; + buf->f_files = fsbuf->f_files; + buf->f_ffree = fsbuf->f_ffree; + if (sizeof (buf->f_fsid) == sizeof (fsbuf->f_fsid)) + /* The shifting uses 'unsigned long long int' even though the target + field might only have 32 bits. This is OK since the 'if' branch + is not used in this case but the compiler would still generate + warnings. */ + buf->f_fsid = ((fsbuf->f_fsid.__val[0] + & ((1ULL << (8 * sizeof (fsbuf->f_fsid.__val[0]))) - 1)) + | ((unsigned long long int) fsbuf->f_fsid.__val[1] + << (8 * (sizeof (buf->f_fsid) + - sizeof (fsbuf->f_fsid.__val[0]))))); + else + /* We cannot help here. The statvfs element is not large enough to + contain both words of the statfs f_fsid field. */ + buf->f_fsid = fsbuf->f_fsid.__val[0]; +#ifdef _STATVFSBUF_F_UNUSED + buf->__f_unused = 0; #endif + buf->f_namemax = fsbuf->f_namelen; + memset (buf->__f_spare, '\0', sizeof (buf->__f_spare)); + + /* What remains to do is to fill the fields f_favail and f_flag. */ + + /* XXX I have no idea how to compute f_favail. Any idea??? */ + buf->f_favail = buf->f_ffree; + buf->f_flag = fsbuf->f_flags ^ ST_VALID; +} +#endif void -INTERNAL_STATVFS (const char *name, struct STATVFS *buf, - struct STATFS *fsbuf, int fd) +__internal_statvfs64 (struct statvfs64 *buf, const struct statfs64 *fsbuf) { /* Now fill in the fields we have information for. */ buf->f_bsize = fsbuf->f_bsize; diff --git a/sysdeps/unix/sysv/linux/internal_statvfs.h b/sysdeps/unix/sysv/linux/internal_statvfs.h index 9ac675c2e8..a8e9aec2c8 100644 --- a/sysdeps/unix/sysv/linux/internal_statvfs.h +++ b/sysdeps/unix/sysv/linux/internal_statvfs.h @@ -18,9 +18,9 @@ #include -extern void __internal_statvfs (const char *name, struct statvfs *buf, - struct statfs *fsbuf, int fd) +extern void __internal_statvfs (struct statvfs *buf, + const struct statfs *fsbuf) attribute_hidden; -extern void __internal_statvfs64 (const char *name, struct statvfs64 *buf, - struct statfs64 *fsbuf, int fd) +extern void __internal_statvfs64 (struct statvfs64 *buf, + const struct statfs64 *fsbuf) attribute_hidden; diff --git a/sysdeps/unix/sysv/linux/internal_statvfs64.c b/sysdeps/unix/sysv/linux/internal_statvfs64.c deleted file mode 100644 index 49e7689f8b..0000000000 --- a/sysdeps/unix/sysv/linux/internal_statvfs64.c +++ /dev/null @@ -1,4 +0,0 @@ -#define STATFS statfs64 -#define STATVFS statvfs64 -#define INTERNAL_STATVFS __internal_statvfs64 -#include "internal_statvfs.c" diff --git a/sysdeps/unix/sysv/linux/statvfs.c b/sysdeps/unix/sysv/linux/statvfs.c index f165899711..210242b9a0 100644 --- a/sysdeps/unix/sysv/linux/statvfs.c +++ b/sysdeps/unix/sysv/linux/statvfs.c @@ -33,7 +33,7 @@ __statvfs (const char *file, struct statvfs *buf) return -1; /* Convert the result. */ - __internal_statvfs (file, buf, &fsbuf, -1); + __internal_statvfs (buf, &fsbuf); /* We signal success if the statfs call succeeded. */ return 0; diff --git a/sysdeps/unix/sysv/linux/statvfs64.c b/sysdeps/unix/sysv/linux/statvfs64.c index 3d29908afa..3f03b7edb8 100644 --- a/sysdeps/unix/sysv/linux/statvfs64.c +++ b/sysdeps/unix/sysv/linux/statvfs64.c @@ -33,7 +33,7 @@ __statvfs64 (const char *file, struct statvfs64 *buf) return -1; /* Convert the result. */ - __internal_statvfs64 (file, buf, &fsbuf, -1); + __internal_statvfs64 (buf, &fsbuf); return 0; } From patchwork Mon Feb 8 21:49:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41975 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6C18394EC18; Mon, 8 Feb 2021 21:50:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6C18394EC18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821014; bh=9XdBatFE3YjZxVFHnWvsSkGzmlzlvsMVTBkM9q3LLBo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=eAwAqY2LZ1zxmtTvzdUbNU3Ta51TuDzmOmsrkgyJAacFABpeJA7AiIZMvaeUJTfp9 KJ5SG/G/ywW5J5TcK/f2b0BXOiGw/dEqPP88t68ZH1tffvj1imviOrZgatTYxkxG8b EqA9u46GmB4BZA/2GmKyc+DgH4VfGE0Oqhel8O+8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by sourceware.org (Postfix) with ESMTPS id 3CD80394EC32 for ; Mon, 8 Feb 2021 21:50:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3CD80394EC32 Received: by mail-qt1-x82a.google.com with SMTP id n28so4522067qtv.12 for ; Mon, 08 Feb 2021 13:50:11 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=9XdBatFE3YjZxVFHnWvsSkGzmlzlvsMVTBkM9q3LLBo=; b=tvCsv4vlT4Coflkyc2eybwEiU6eJrq+swesPheRI4dfRjfdEjaemxFsMbgo6krB5CN 0AV9H507fe1JJ7nNnyso6lNblo73eFyGt2iZekhdtbvt54tGwyhfda3ZCu+kCR9deDi+ DB1ntkwWUMGdG1n9kjojjBPg6C2qhzY59JuTeOQcAl2zaMLLJRR/XaabMBdZ28yYH3/q DSLhcIItN+kLEYHd2txrEwy3kZrW+u0neH/32/6A6rzxutqQliXziPahvmVSgoVpU/yu H3H3Cv7VSjyX3zagC/Cs2k0Mi9nvh/iryu5yQGUrFEMlfUo56l9Bkh3xh60nI+NeS9ps wrKA== X-Gm-Message-State: AOAM531gLGRxmXX4qzWiV8UrAUYUrJfNY4la9tmIjxmE7adb4onjLzuV T/VL/7CCStfmfbiXwF85EczPdAcpU6rzTQ== X-Google-Smtp-Source: ABdhPJzuP3dxc03LI2qoN7F8/WfAZWgzj1BW96Ls1yTjh+Apw8qcibgIWcnlvM/eHfStVXZOJe34NA== X-Received: by 2002:ac8:8b1:: with SMTP id v46mr5029288qth.252.1612821010654; Mon, 08 Feb 2021 13:50:10 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:10 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 09/10] linux: Remove overflow.h Date: Mon, 8 Feb 2021 18:49:35 -0300 Message-Id: <20210208214936.1502047-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The header is not used anywhere, the required functions are provided by other implementations. Reviewed-by: Carlos O'Donell --- .../sysv/linux/generic/wordsize-32/overflow.h | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h deleted file mode 100644 index f2a58d654f..0000000000 --- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Overflow tests for stat, statfs, and lseek functions. - Copyright (C) 2011-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include -#include - -/* Test for overflows of structures where we ask the kernel to fill them - in with standard 64-bit syscalls but return them through APIs that - only expose the low 32 bits of some fields. */ - -static inline off_t lseek_overflow (loff_t res) -{ - off_t retval = (off_t) res; - if (retval == res) - return retval; - - __set_errno (EOVERFLOW); - return (off_t) -1; -} - -static inline int stat_overflow (struct stat *buf) -{ -#if defined __INO_T_MATCHES_INO64_T - return 0; -#else - if (buf->__st_ino_pad == 0 && buf->__st_size_pad == 0 - && buf->__st_blocks_pad == 0) - return 0; - - __set_errno (EOVERFLOW); - return -1; -#endif -} - -/* Note that f_files and f_ffree may validly be a sign-extended -1. */ -static inline int statfs_overflow (struct statfs *buf) -{ -#if __STATFS_MATCHES_STATFS64 - return 0; -#else - if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0 - && buf->__f_bavail_pad == 0 - && (buf->__f_files_pad == 0 - || (buf->f_files == -1U && buf->__f_files_pad == -1)) - && (buf->__f_ffree_pad == 0 - || (buf->f_ffree == -1U && buf->__f_ffree_pad == -1))) - return 0; - - __set_errno (EOVERFLOW); - return -1; -#endif -} From patchwork Mon Feb 8 21:49:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41976 X-Patchwork-Delegate: carlos@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 16F37395042D; Mon, 8 Feb 2021 21:50:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16F37395042D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1612821016; bh=EpcPtI7CyvloYaB7CBHj1jG8nwbvot9lZ2M11k6wqMg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lAaZaujn8J7cLcaSh3IFESwjUec7/6lvqqhhhWoKIgjuVITbyb5VLpGYeEvE4GVrW 17zfD5lzHdnQq5ERLGFt50p6mDptQwN22+ytQ7pH7jxE4gasjme+/nkzmJxQtTuiXv vn1F/RUfoqE4+cmX744YkWupTFbblJUVehQGwR1w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by sourceware.org (Postfix) with ESMTPS id BCDEA3950423 for ; Mon, 8 Feb 2021 21:50:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BCDEA3950423 Received: by mail-qk1-x72c.google.com with SMTP id a19so16131904qka.2 for ; Mon, 08 Feb 2021 13:50:12 -0800 (PST) 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:mime-version:content-transfer-encoding; bh=EpcPtI7CyvloYaB7CBHj1jG8nwbvot9lZ2M11k6wqMg=; b=MLHzQDYj6jCKvUlDOVDU6gVSFnYIpvrW55zQbV08AQtPnJ6edaJ6hi31JOnUjz8rme SJeu1i1MbFpiDv6tGtdAb7y0S9giJ4Ruw2ttNdHNSoMx0kTOUPk5XxCz0W0ygoyYKeYZ OaJwUwjsya4/wKS9BIBMGTYRlRxA1l9UTlRCMZN13NQG94F3cC3FiZm51zeuJ2xTYv+D +Yt452/O8BgRF3UmZPGNl3QW7h0H4CJGaUufzL6ThPh3dA6fVa/jvSW2pv42UoMtJczh qOr1caMy36PrJMbG5LNEZBZEpsQ3JzOCMEW5I2vzeO8ShyGUq1fa6wmTxyIIXtHSLCgh BFUg== X-Gm-Message-State: AOAM532fQstnXY3wcNc/5IJFs+GGYqIq9+lS0P5UNCzmkIkrN3ALH6lB f3wkgCbCU5RINCbzAokjREnC6m+XbI1tKw== X-Google-Smtp-Source: ABdhPJxXwo74/Idkb5YGT/gF6bgsV3pqLDDbJVZyeNZU/6oPBd5JLVqavD4KOCzdlrBnCJahd/sK6Q== X-Received: by 2002:a05:620a:530:: with SMTP id h16mr19107184qkh.136.1612821012193; Mon, 08 Feb 2021 13:50:12 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id e15sm12720078qtq.43.2021.02.08.13.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 13:50:11 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 10/10] linux: Remove stat-check.c Date: Mon, 8 Feb 2021 18:49:36 -0300 Message-Id: <20210208214936.1502047-11-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The check is moved to LFS fstatat implementation (since it is the code that actually implements the syscall). Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/fstatat64.c | 12 ++++++++ sysdeps/unix/sysv/linux/generic/Makefile | 2 +- sysdeps/unix/sysv/linux/generic/stat-check.c | 29 -------------------- 3 files changed, 13 insertions(+), 30 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/stat-check.c diff --git a/sysdeps/unix/sysv/linux/fstatat64.c b/sysdeps/unix/sysv/linux/fstatat64.c index ab41f19e94..a609b4d3ff 100644 --- a/sysdeps/unix/sysv/linux/fstatat64.c +++ b/sysdeps/unix/sysv/linux/fstatat64.c @@ -28,6 +28,18 @@ #include #include +#if __TIMESIZE == 64 \ + && (__WORDSIZE == 32 \ + && (!defined __SYSCALL_WORDSIZE || __SYSCALL_WORDSIZE == 32)) +/* Sanity check to avoid newer 32-bit ABI to support non-LFS calls. */ +_Static_assert (sizeof (__off_t) == sizeof (__off64_t), + "__blkcnt_t and __blkcnt64_t must match"); +_Static_assert (sizeof (__ino_t) == sizeof (__ino64_t), + "__blkcnt_t and __blkcnt64_t must match"); +_Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t), + "__blkcnt_t and __blkcnt64_t must match"); +#endif + int __fstatat64_time64 (int fd, const char *file, struct __stat64_t64 *buf, int flag) diff --git a/sysdeps/unix/sysv/linux/generic/Makefile b/sysdeps/unix/sysv/linux/generic/Makefile index 124f83a0ab..7e27e79772 100644 --- a/sysdeps/unix/sysv/linux/generic/Makefile +++ b/sysdeps/unix/sysv/linux/generic/Makefile @@ -1,3 +1,3 @@ ifeq ($(subdir),misc) -sysdep_routines += epoll_create inotify_init stat-check +sysdep_routines += epoll_create inotify_init endif diff --git a/sysdeps/unix/sysv/linux/generic/stat-check.c b/sysdeps/unix/sysv/linux/generic/stat-check.c deleted file mode 100644 index e09264dd3a..0000000000 --- a/sysdeps/unix/sysv/linux/generic/stat-check.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Static assert for __blkcnt64_t when __INO_T_MATCHES_INO64_T is defined. - Copyright (C) 2019-2021 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library. If not, see - . */ - -#include -#include - -/* This is due to the layout code in bits/stat.h and the overflow handling in - wordsize-32/overflow.h, requiring either all or none of the three types - concerned to have padding. */ - -#if defined __INO_T_MATCHES_INO64_T -_Static_assert (sizeof (__blkcnt_t) == sizeof (__blkcnt64_t), - "__blkcnt_t and __blkcnt64_t must match"); -#endif