[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

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



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

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: