From: Alistair Francis <alistair.francis@wdc.com>
To: libc-alpha@sourceware.org
Cc: joseph@codesourcery.com, alistair.francis@wdc.com, macro@wdc.com,
alistair23@gmail.com
Subject: [PATCH v2 2/2] sysdeps/statfs: Handle 64-bit ino_t types on 32-bit hosts
Date: Wed, 18 Sep 2019 23:59:00 -0000 [thread overview]
Message-ID: <20190918235448.5037-2-alistair.francis@wdc.com> (raw)
In-Reply-To: <20190918235448.5037-1-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.
2019-09-16 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.
---
v2:
- Fix the #if logic
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 3472084ade0..eab1439acff 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 7ae01c189eb..8ac7a1da4bf 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 __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.23.0
next prev parent reply other threads:[~2019-09-18 23:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-18 23:59 [PATCH v2 1/2] sysdeps/stat: " Alistair Francis
2019-09-18 23:59 ` Alistair Francis [this message]
2019-09-19 20:36 ` [PATCH v2 2/2] sysdeps/statfs: " Joseph Myers
2019-09-23 23:11 ` Alistair Francis
2019-09-19 20:33 ` [PATCH v2 1/2] sysdeps/stat: " Joseph Myers
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190918235448.5037-2-alistair.francis@wdc.com \
--to=alistair.francis@wdc.com \
--cc=alistair23@gmail.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=macro@wdc.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).