From patchwork Wed Sep 25 00:31:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34651 Received: (qmail 119246 invoked by alias); 25 Sep 2019 00:35:36 -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 119148 invoked by uid 89); 25 Sep 2019 00:35:35 -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: esa2.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=1569371752; x=1600907752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nHzFjDN4tIaQ5sa2osAw0xHP5zUkEdIRCSLgKxsYOIk=; b=GcfRVt/ycbblZAsopdosxDWwp8sgguOs+k72C2vFpTstcr+oTmtqLaXq Kci+AddCvmv53iBsOtICy/PJgti933Ohue3Bk1wU7+ODKFglgQFDgyatk 8hi3rnR+ka5xS0cBSCs4lakahwax6BvEP9JwRf8HCLsruxJqzC4vLM9ME AwtGlwYDegCEeif2Jg/DwYLTSA5mhEhFvrO2Qlsor5IzK6P39V2+vBmjM kSSrF8O2O+8qwMznVKjGcGtMXt6RY03rbU3ZN+KZ1oROtbLJAJqUh6EKY z/M81x43VYobTYP//WwzEErP/PbBIdQ0am+4Rd6Wi144Qonyn8KvVUagL w==; IronPort-SDR: Y9RKvxErx1LKvenPmZbVE5l9Vl5kG8KChwtxDpa1WkNdHdKe/ZM3hC4z8eCvR6k0kmh0ZPlOtd 8d9AADwlvHaRLmyv1toPjdj/8F4e69OW/66njz++edDlZudjc3l8vAVaj98ziLvHFCsrbS3SmK vC0I3tU9XggOMDlkGY7x3zTv5CBAMNymJivMkKBRhoB+SHMwC1e9+q4uv5VP66Rj6WxvETJABi TZMetCgcOs9oqtVTJEYIvtdD8BTAg6c3AGNnwh4325cCLtst4YAgCcvlzeNjN3toyaiigzl54n Wbo= IronPort-SDR: URmo1w0M47OPUNMaOmxWj9JDQXdvJVTfHHo5ZZbfa+C6cjsq3k3y4hSbdndRLm1sJH2MeVBZSG xJOa37ug6iXAdUQIxcXIdoIdlc6vfxgx46Z5DZcOhmWtdnwZDkyPmcL6eB4UBif0wVsWKBtt8m ycqWKbwh8/qWEtyWKckHGFLJkfcg6J1WeDr6ZQFA7lW3zkZAkwwlq5kSL6w7IuyZ7futSwyWQf j5LVLaG7hzeRxEnZyK7cfFGiIB9JSsRi01qA7XcaAinyRi4Ckf2toPjsMBJ5gCRl5mUw6fkkod zdQRrfIwEb8mX8xbp6r/AOmI IronPort-SDR: wqgKDPRk0+qZ+fB9/qt3+BpMWFqGFUoE0w2SZjH/3ZtQwvTHuRsqVdp5hMxcn/8d0opI1OSEYS x3jNdtSdM0BZpsoIreAXb2JTCn3y1yFh/WLw0r9MUsfAsVadMfh9DNMsuGcHwqDdYfn1sSCDCE LVOWwsI6datok2umDz/kEajdaOZD77D3KP0onyRRl5/qRqpPdlPqHX2kHZZOoDyb/fA7ya205A ifHo0SunI/nnB9NiwaSUP8Fgk1pdcdMJGMHrUyNUOBsQgjVWG3tL2x6Kf/L/P10HtdcB67LCy8 aF8= WDCIronportException: Internal From: Alistair Francis To: libc-alpha@sourceware.org Cc: alistair23@gmail.com, Alistair Francis Subject: [PATCH v2 2/2] Define __STATFS_MATCHES_STATFS64 Date: Tue, 24 Sep 2019 17:31:14 -0700 Message-Id: <20190925003114.21546-2-alistair.francis@wdc.com> In-Reply-To: <20190925003114.21546-1-alistair.francis@wdc.com> References: <20190925003114.21546-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. 2019-09-16 Alistair Francis * 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. 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..0ab96dc8c3e 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 3c21da501b2..eb4373efe48 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 }