From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 8A54E3896C35 for ; Thu, 11 Feb 2021 00:38:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8A54E3896C35 Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-AtV92iemMvqfCOrvvwBnFA-1; Wed, 10 Feb 2021 19:38:17 -0500 X-MC-Unique: AtV92iemMvqfCOrvvwBnFA-1 Received: by mail-qv1-f70.google.com with SMTP id a12so2799838qvo.3 for ; Wed, 10 Feb 2021 16:38:17 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=FgIKym3AUPO+k7DlxhilXJnG3RhiIqauH9fziJcxWpA=; b=S4yDJJFYBYQzn48Kv6l7uZDVukzhthCFspA0aTrv2PB4N8za/TUUriWgPuYe7adyqZ QPhxeLbq75eJ9QMnIEVxubAtSP3rIDf3qoF0g/Nq6eIb7PXuG5jDVmMqzgCK33q6fvlI sx4dTm+KX7Cgt9H/HAyfteubtnyunTcf8GspglenX04B7WkeBBltXH87sttELBGsPPgJ Eo+mipZWYi/m6igbxH/3EwJOxbIur3ss1LOx/UEnsY4xJJ79mX3HMD3Sm+hToHOAgVCU 1JFQDe0RJYNaiY3yG/pYzsYqxZLk9z6VaHaX5JyZHLz2NVxLwvJe1KytzKhZhWyoHQS4 hR7w== X-Gm-Message-State: AOAM530GqFlivZlHA3pK5CbKYzEjnP9+5QONg9G+BPddKCCdWqo+HIxQ CKNakJWrq7zTdfj27pvTGBoGdqoQr1XiFZpaY0VshJEsRuth3htmUfx+thnNo7wss6b04xgs/B6 pQkocHsDIOp/s8BmvDcI6bbakxGkBr1tFt0WNTlYcE0hTOdq/Tcg5vJT9TvVYgU/x4chbpg== X-Received: by 2002:a05:622a:90:: with SMTP id o16mr5111825qtw.49.1613003896755; Wed, 10 Feb 2021 16:38:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJws45wGAw1PBw8Ja2ZY3WluHtPvzGhtqW6bRwnCqt+s3M/UjGHUB2nHUh49Rfd75cc2SD2QOQ== X-Received: by 2002:a05:622a:90:: with SMTP id o16mr5111812qtw.49.1613003896491; Wed, 10 Feb 2021 16:38:16 -0800 (PST) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id w28sm2315534qtv.93.2021.02.10.16.38.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 10 Feb 2021 16:38:16 -0800 (PST) Subject: Re: [PATCH 07/10] linux: Consolidate statvfs implementations To: Adhemerval Zanella , libc-alpha@sourceware.org References: <20210208214936.1502047-1-adhemerval.zanella@linaro.org> <20210208214936.1502047-8-adhemerval.zanella@linaro.org> From: Carlos O'Donell Organization: Red Hat Message-ID: <1eb34e8b-607b-fe68-e9b2-5310fcf3c57d@redhat.com> Date: Wed, 10 Feb 2021 19:38:15 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210208214936.1502047-8-adhemerval.zanella@linaro.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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-List-Received-Date: Thu, 11 Feb 2021 00:38:21 -0000 On 2/8/21 4:49 PM, Adhemerval Zanella via Libc-alpha wrote: > 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. LGTM. 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); OK. > 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. */ > -- Cheers, Carlos.