From patchwork Wed Sep 18 23:54:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 34581 Received: (qmail 22570 invoked by alias); 18 Sep 2019 23:59:06 -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 22494 invoked by uid 89); 18 Sep 2019 23:59:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: esa3.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=1568851145; x=1600387145; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=N8xqMFzhorH1cRLrfqmzUiIhQJu0TpelaJewExdX8wk=; b=S4hignFwSJ671rB0QYuuGfxxhXTX4JE9iAo9u72DgMx0vxr+Go9MYIaI MtsMoJf0PJ/QEfTPCiSq+9zmZPthtNipa+1G2nlTursumnpe5SOdtMQzt +F77l6V8pDhrIb3BtkKx13f5b8IrX/Rh4JdlBvF7z1WhVi8/5AUd6bdLp aJY8KmxTVLFuInsbi6tLe5rFJ81g6aQrGs2W+1a58cdZnG8ZOuRPwZa0P D/giBDhjKcN8xuNNu3K9Uo0ZyHJ6g1KnaFjuYPTU2bHLebIhCXczkEihF R9G4FdvLZlsQmNTCRQ3XEeFy8Z/rnz77/yISXe2QYXf4SUIsscrShi5FA g==; IronPort-SDR: j7Bm6RX+ug9329LNn4llg9F5gEH1UpFCUosQOpmXLTDOzs6eR2LWApDsVa/X37ISpbNzKso4nJ PaUQxY4++D3l3D3k/D0MU12+hMMZ4zg7MapJDNs+XvZEqzW5MiIhWG1mIG4bBb6Ou+vs3foqt/ q4tLq6iKlQ86+4kXHc8X53uWFkG5bGI8pG/t3cCZT2oHEil8D4qdwig0fTJO0q9Ylg544ZSp3p zkYuqaPHVHq9iq8p2moymXtIR+BB2Dodz+FHArWNRwm3UIstlue2XVbwdNC3s+ZNo8isxVhy10 gZM= IronPort-SDR: 9srz77nM51S2pDCtd0cJqq1NWVT3O8Q4Qx4241yPiPCThWzFY+cXdz6P5btXxjReWsUpqbffd1 UdwUFW7tAZxjeaUIWbzUGW8xpdXDK6GB6maRvLUWVEv1SitCQmjNPTPgmLFoq/C0/TDQn748kl nPNpwaxf5tS9ZEtMMu4FnttixpvqwJJ0TSrn8D0pNEeaeOPafo+ZLtaBeLYwk16mPGu0rRH9+9 Tcg3ZdYrOIXUa62+1cyiVnClkWSsB5VZ083jjRbhbsnZYZ23sdyX70EGEcaqpxpmAoQa7OGHi9 z/vVKNQU3XyeCGdYs8BljRuL IronPort-SDR: YMrr24a++GNCUPlSQDA1Nxrs8Bw612PFqRa+9EmZkyquRWfwWjo6xC/zzJ/53gr8Fm3dtBr0AD o/5xlGfgRYGomtm1XKD0ua6nGenIgSzj+z4HAZcv7QVzD/Zdh/nJlSSTEabl7+ZGnoUS1fI6c3 cQJi5Rh9X2z3OxoRQRn3dPHNUjswxeUMCYEeC9uuvcmzD8WyeddR85hTZ2pZAgsBkalcDkDzzj iVT5UhU6ccz+/BdQTbnEL+hVudXqbu67+MNailCvNwpD1HxRTRb8cf9vl2Rku8E0rCbtvUtzF7 QnY= WDCIronportException: Internal From: Alistair Francis 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 16:54:48 -0700 Message-Id: <20190918235448.5037-2-alistair.francis@wdc.com> In-Reply-To: <20190918235448.5037-1-alistair.francis@wdc.com> References: <20190918235448.5037-1-alistair.francis@wdc.com> MIME-Version: 1.0 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 * 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 }