Message ID | 20191003174131.18673-2-alistair.francis@wdc.com |
---|---|
State | New |
Headers | show |
Series | [v3,1/2] sysdeps/stat: Handle 64-bit ino_t types on 32-bit hosts | expand |
On Thu, 3 Oct 2019, Alistair Francis wrote: > Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t > matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t. As a new macro it would be better to use the 0/1 convention (always defined, at least for linux/generic configurations that need it) rather than undefined / defined. A default definition can go in bits/typesizes.h with a comment. > -#if defined __USE_FILE_OFFSET64 > +#if defined __USE_FILE_OFFSET64 || defined __STATFS_MATCHES_STATFS64 > # define __field64(type, type64, name) type64 name > #elif __WORDSIZE == 64 As in the stat case, I think it would be best to put the "|| defined __STATFS_MATCHES_STATFS64" in the __WORDSIZE == 64 case not the __USE_FILE_OFFSET64 case.
On Thu, Oct 3, 2019 at 1:03 PM Joseph Myers <joseph@codesourcery.com> wrote: > > On Thu, 3 Oct 2019, Alistair Francis wrote: > > > Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t > > matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t. > > As a new macro it would be better to use the 0/1 convention (always > defined, at least for linux/generic configurations that need it) rather > than undefined / defined. A default definition can go in bits/typesizes.h > with a comment. Ok, I have updated the patch. > > > -#if defined __USE_FILE_OFFSET64 > > +#if defined __USE_FILE_OFFSET64 || defined __STATFS_MATCHES_STATFS64 > > # define __field64(type, type64, name) type64 name > > #elif __WORDSIZE == 64 > > As in the stat case, I think it would be best to put the "|| defined > __STATFS_MATCHES_STATFS64" in the __WORDSIZE == 64 case not the > __USE_FILE_OFFSET64 case. Done, I'll send a v4 once my tests pass. Alistair > > -- > Joseph S. Myers > joseph@codesourcery.com
diff --git a/sysdeps/unix/sysv/linux/generic/bits/statfs.h b/sysdeps/unix/sysv/linux/generic/bits/statfs.h index c4069aba620..8c92e5d934e 100644 --- a/sysdeps/unix/sysv/linux/generic/bits/statfs.h +++ b/sysdeps/unix/sysv/linux/generic/bits/statfs.h @@ -32,7 +32,7 @@ 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 || defined __STATFS_MATCHES_STATFS64 # 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 66546b07ccd..b68244c94de 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 __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 @@ -61,4 +64,5 @@ static inline int statfs_overflow (struct statfs *buf) __set_errno (EOVERFLOW); return -1; +#endif }