Re: Inconsistency about struct stat and dev_t on mips and mipsel

James Cowgill <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
On Mon, 2015-09-14 at 22:28 +0200, Thomas Schmitt wrote:
> Hi,
> 
> before i start bitching:
> 
> Is there a more specific way to recognize mips and mipsel
> in source at compile time, besides testing sizeof(dev_t)
> versus sizeof(stbuf.st_rdev) ?

Comparing those sizes is the correct way so the code will continue
working if struct stat ever gets fixed.

To test for 32-bit mips/mipsel use:
#if defined(__mips__) && _MIPS_SIM == _ABIO32

(__mips__ is defined on 64-bit mips as well)

> Now for bitching:
> 
> > Yes, for historical reasons mips (o32) defines struct stat with a 32
> > -bit dev_t even though it defines dev_t to be 64-bits. It's been
> > defined this way since at least 1997
> 
> How is this supposed to work semantically ?
> Is there a mips_stat(2) function with struct mips_stat which
> can retrieve the 64 bit device numbers ?

I don't think Linux (the kernel) currently supports 64-bit device
numbers on any arch. At least that's what this file indicates:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/types.h?id=refs/tags/v4.3-rc1

James
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABCgAGBQJV9zzGAAoJEMfxZ23qLQHvE/MP/R91FfkamsuQWnZJytQ0k2Fe
fF6B9ccyoUFdmpEwf7HDJE4d+3vr9/QzZf0KzZxS2br4TkuVgf60QOC8HWANzoOT
gqn15nywyemtgjG+7D4PjC5gA3ya9sG4Qg2WMMcY5ilMoJTcjFLMvYbf8hBuefde
cVSSYdvkEG6wa3f53fPr7hUqilfvD4D4kJxGZqY5JGlMXU1mytq9uVn8hwlqzyxR
1iLCSCDQx9a1bxRhUq6kZY/KFUaKI1bmp+zTs2lF6yeLO9KaSLyYPHqKyWS3nmmB
6+C6kOoutgzcb4bwGq6aWzL0Jmw3TuCk1/JEcqYNfi13KlVd/CdV+FGbgLymg3KU
6eqYcbPtVDaGIgH/k+894HfPLbODpmGIn00cns/ZwiWAm8Clalxg6Xty6HTBBI0m
d3vteLwJinhiwDiX+W/dG0AZqJ4V34ac3jSzqj1Cm65+Q5Jw/zeH6rbmfxJToYJK
E7drfdGHb/vr3nzf8+yHwjYQGgR2eomEZEsxkBpDGul0zKhabgNQlROYsnDkCbFG
jJb0HI195T/qWtXj/fGdkcwCWM/EriQxt86CXpUDdCnyD+n9YLQSYlXV8ADIvBxb
GMUCdgfbLw1zy9StUdKQlOPZbAFMRdw0xpNGwBfO/0IXYxJpWvQsd8uh+rakZvB5
b3O/LSuzcbuVsSxKnWVA
=HH5R
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.