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 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 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