From patchwork Thu Oct 3 17:41:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34820 Received: (qmail 97808 invoked by alias); 3 Oct 2019 17:46:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 97744 invoked by uid 89); 3 Oct 2019 17:46:07 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy= X-HELO: esa1.hgst.iphmx.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1570124766; x=1601660766; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nuAcFK9VA+VeEcZx8WMlBB074sLCt9iG8VLtblVLKVo=; b=anpNHJeVFtH5gNjvXSmJ3TFNoPR4YUkOCYUF8K0zrwIeAtD1QCv8PCV2 lqpszVxp99FbphsfS59srrRa4Jn7Y+9R6JDSs0V3HYSe06K0+4AmhILXw mp8oeW+qFvOcP/s/XZr2QiW2oub8EPvHFDsJd+hgEm50Ho+19Hm1Eq7G0 amzk5wFI70Tvfwv7tW7GDIH0s0w9opk+Txwbg6Yo7vv5Vx9BYpwfxVB0q yYzZ+JCq8iS7+r6uVf8PrOfhVGgfZnKrc2rXkG0eeLimOiXEsUcHun5Ku H3beuOfU5sAXXNj56F1wlLY9TQo11Cn65UDIsHP/vd0FbmLGp5NTPmMJG Q==; IronPort-SDR: YlZiE8+an9VL6f3OBw1GLKrTOPqlilveKYNkzRJ4YGu24k3Gsd0JkXmnS0U9iBcOkJlkGkBIgR 4q8o63yFdS9hJT7fsYp1Gixly5NhwG6XQzVq/RFwNzsUBppkRIK7iwpP7G8b6IAEEH4q1XJxhy Wu7GTKAT3YAn29JUggJkxzr0Pjg06pT2Ubhc2CE0797io8r4t1ILQW5AobYZ6pLX6uuZQIq33d m0l2GjbbQM+6SNe3AFfXQjn7CmuAODOhAlpZVnb/iiUW+cMTeGPwZPeXieizbEAxiKh6VkIabt fe8= IronPort-SDR: KZhV0EWPHh9Ncjp/3rGMVdOO2y1dU7/3tGmAL0IVW35p6/OQNIo1oCR8PqXza2AzyCpH+0QDcU +I5/PyZazty99Qw6aJ07XaJfIMCS6MA2X6sTVMkkv2VeQfMwacRi4VdtKZ8VHGghLnFqjUbrFG 5uvKijbAXRvcdozGWs+JKnmx4lJSr1IOFwr8+BwkY+E1E2Ed1mJ9rCwHb1R2c07+8KMjAtuaBZ HwhFejAg+AH6PaZTN17/RBOnQV0hGlCMJCxyJJdtvhvYcUrxLdAc+zj1+f5eYuXXtggrUBMnQV vnnhE3MhYRmEsUgBc6XGBkri IronPort-SDR: kpOxRizGvsIqEV3QZ4juRLh01b7ZJWbqIQT/dqI3Ik99ouVW8oC/BLOP3QX2nijII7+nDWDRCH AXh4zI7hvJ5M+6Hf2y5b+mIyhjdcFaMZRaKjgRytHtdbOkwnX8PT/AwFQ+apbHI+CAFPd5LP/G bKaqMlCiEZReoesgA8FYZXqcwlyIopbbKuSKrIE7rnnzx2J2AgsmSR4bhr/jdYhTvtSzDW6ndC u7h0OBR+hiaN6QbWfK0gwqTOWYEQhFDO6Ml6V2ejrLWEu4wQpFmMGMKSJPJV6yG4T0MlSIfisF +Oc= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v3 2/2] Define __STATFS_MATCHES_STATFS64 Date: Thu, 3 Oct 2019 10:41:31 -0700 Message-Id: <20191003174131.18673-2-alistair.francis@wdc.com> In-Reply-To: <20191003174131.18673-1-alistair.francis@wdc.com> References: <20191003174131.18673-1-alistair.francis@wdc.com> MIME-Version: 1.0 Add a new macro __STATFS_MATCHES_STATFS64 that specifies if fsblkcnt_t matches fsblkcnt64_t and if fsfilcnt_t matches fsfilcnt64_t. On a 32-bit platform with a 64-bit ino_t type (__STATFS_MATCHES_STATFS64 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. * sysdeps/unix/sysv/linux/generic/bits/statfs.h: Define __STATFS_MATCHES_STATFS64 to handle 64-bit __fsblkcnt_t and t__fsfilcnt_t types on 32-bit hosts. * sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h: Likewise. --- This change was tested by running user space tests for RV32 and RV64. This patch doesn't use the new macro. The RV32 port uses the macro, this is a preperation patch. v2: - Change to if defined instead of if == 1 - Introduce __STATFS_MATCHES_STATFS64 sysdeps/unix/sysv/linux/generic/bits/statfs.h | 2 +- sysdeps/unix/sysv/linux/generic/wordsize-32/overflow.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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 }