unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Alistair Francis <alistair.francis@wdc.com>
To: libc-alpha@sourceware.org
Cc: arnd@arndb.de, adhemerval.zanella@linaro.org, fweimer@redhat.com,
	palmer@sifive.com, macro@wdc.com, zongbox@gmail.com,
	alistair.francis@wdc.com, alistair23@gmail.com
Subject: [RFC v5 08/21] sysdeps/statfs: Handle 64-bit ino_t types on 32-bit hosts
Date: Thu, 29 Aug 2019 09:50:21 -0700	[thread overview]
Message-ID: <7aad2cad9fddcadf91a6b91b348029a8801554eb.1567097252.git.alistair.francis@wdc.com> (raw)
In-Reply-To: <cover.1567097252.git.alistair.francis@wdc.com>

On a 32-bit platform with a 64-bit ino_t type (__INO_T_MATCHES_INO64_T
defined) we want to update the statfs struct to remove the padding as it
isn't required. As we don't have the padding we also need to update the
overflow checker to not access the undefined members.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>

	* sysdeps/unix/sysv/linux/generic/bits/statfs.h: Handle 64-bit ino_t
	types on 32-bit hosts.
	* sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h: Likewise.
---
 sysdeps/unix/sysv/linux/generic/bits/statfs.h          | 5 ++++-
 sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h | 4 ++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
index 77de4d2fd00..a22e059ddc6 100644
--- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h
+++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h
@@ -32,7 +32,10 @@
    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
+#if defined(__USE_FILE_OFFSET64) || __INO_T_MATCHES_INO64_T == 1
+# if __INO_T_MATCHES_INO64_T == 1 && __OFF_T_MATCHES_OFF64_T != 1
+#  error "ino_t and off_t must both be the same type"
+# endif
 # define __field64(type, type64, name) type64 name
 #elif __WORDSIZE == 64
 # define __field64(type, type64, name) type name
diff --git a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
index d402d139329..4c2e43f9d67 100644
--- a/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
+++ b/sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h
@@ -51,6 +51,9 @@ static inline int stat_overflow (struct stat *buf)
 /* Note that f_files and f_ffree may validly be a sign-extended -1.  */
 static inline int statfs_overflow (struct statfs *buf)
 {
+#if defined (__INO_T_MATCHES_INO64_T)
+  return 0;
+#else
   if (buf->__f_blocks_pad == 0 && buf->__f_bfree_pad == 0
       && buf->__f_bavail_pad == 0
       && (buf->__f_files_pad == 0
@@ -61,4 +64,5 @@ static inline int statfs_overflow (struct statfs *buf)
 
   __set_errno (EOVERFLOW);
   return -1;
+#endif
 }
-- 
2.22.0


  parent reply	other threads:[~2019-08-29 16:55 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-29 16:50 [RFC v5 00/21] RISC-V glibc port for the 32-bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 01/21] sunrpc/clnt_udp: Ensure total_deadline is initalised Alistair Francis
2019-08-29 17:22   ` Joseph Myers
2019-08-29 17:34     ` Zack Weinberg
2019-09-05 14:53       ` Alistair Francis
2019-09-05 15:02         ` Joseph Myers
2019-09-05 15:06           ` Jeff Law
2019-09-05 15:21             ` Joseph Myers
2019-09-05 15:27               ` Jeff Law
2019-09-06  0:47               ` Alistair Francis
2019-09-05 15:12           ` Zack Weinberg
2019-09-06  0:46           ` Alistair Francis
2019-09-06  1:31             ` Jeff Law
2019-09-16 21:36               ` Alistair Francis
2019-09-05 15:07         ` Zack Weinberg
2019-08-29 16:50 ` [RFC v5 02/21] sysdeps/nanosleep: Use clock_nanosleep_time64 if avaliable Alistair Francis
2019-08-29 17:25   ` Joseph Myers
2019-08-30 17:40     ` Alistair Francis
2019-10-14 13:59   ` Lukasz Majewski
2019-10-15  0:06     ` Alistair Francis
2019-10-15 15:54       ` Lukasz Majewski
2019-10-15 22:28         ` Alistair Francis
2019-10-16 23:42           ` Alistair Francis
2019-10-17  0:08             ` Alistair Francis
2019-08-29 16:50 ` [RFC v5 03/21] sysdeps/gettimeofday: Use clock_gettime64 " Alistair Francis
2019-08-29 16:50 ` [RFC v5 04/21] sysdeps/wait: Use waitid " Alistair Francis
2019-08-29 16:50 ` [RFC v5 05/21] sysdeps/clock_gettime: Use clock_gettime64 " Alistair Francis
2019-10-29 12:00   ` Lukasz Majewski
2019-08-29 16:50 ` [RFC v5 06/21] sysdeps/timespec_get: " Alistair Francis
2019-08-29 16:50 ` [RFC v5 07/21] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts Alistair Francis
2019-08-29 16:50 ` Alistair Francis [this message]
2019-08-29 16:50 ` [RFC v5 09/21] Documentation for the RISC-V 32-bit port Alistair Francis
2019-08-29 16:50 ` [RFC v5 10/21] RISC-V: Use 64-bit time_t and off_t for RV32 and RV64 Alistair Francis
2019-08-29 16:50 ` [RFC v5 11/21] RISC-V: Define __NR_* as __NR_*_time64/64 for 32-bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 12/21] RISC-V: Use 64-bit timespec in clock_gettime vdso calls Alistair Francis
2019-08-29 16:50 ` [RFC v5 13/21] RISC-V: Support dynamic loader for the 32-bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 14/21] RISC-V: Add path of library directories for RV32 Alistair Francis
2019-08-29 16:50 ` [RFC v5 15/21] RISC-V: The ABI implementation for the 32-bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 16/21] RISC-V: Hard float support for the 32 bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 17/21] RISC-V: Add ABI lists Alistair Francis
2019-08-29 16:50 ` [RFC v5 18/21] RISC-V: Build Infastructure for the 32-bit Alistair Francis
2019-08-29 16:50 ` [RFC v5 19/21] RISC-V: Fix llrint and llround missing exceptions on RV32 Alistair Francis
2019-08-29 16:50 ` [RFC v5 20/21] RISC-V: Use 64-bit vdso syscalls for RV32 Alistair Francis
2019-08-29 16:50 ` [RFC v5 21/21] Add RISC-V 32-bit target to build-many-glibcs.py Alistair Francis
2019-08-29 17:28 ` [RFC v5 00/21] RISC-V glibc port for the 32-bit Joseph Myers
2019-08-29 17:42   ` Alistair Francis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/libc/involved.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7aad2cad9fddcadf91a6b91b348029a8801554eb.1567097252.git.alistair.francis@wdc.com \
    --to=alistair.francis@wdc.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair23@gmail.com \
    --cc=arnd@arndb.de \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=macro@wdc.com \
    --cc=palmer@sifive.com \
    --cc=zongbox@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).