xref: /openbmc/linux/include/uapi/asm-generic/stat.h (revision 8a1ab3155c2ac7fbe5f2038d6e26efeb607a1498)
1*8a1ab315SDavid Howells #ifndef __ASM_GENERIC_STAT_H
2*8a1ab315SDavid Howells #define __ASM_GENERIC_STAT_H
3*8a1ab315SDavid Howells 
4*8a1ab315SDavid Howells /*
5*8a1ab315SDavid Howells  * Everybody gets this wrong and has to stick with it for all
6*8a1ab315SDavid Howells  * eternity. Hopefully, this version gets used by new architectures
7*8a1ab315SDavid Howells  * so they don't fall into the same traps.
8*8a1ab315SDavid Howells  *
9*8a1ab315SDavid Howells  * stat64 is copied from powerpc64, with explicit padding added.
10*8a1ab315SDavid Howells  * stat is the same structure layout on 64-bit, without the 'long long'
11*8a1ab315SDavid Howells  * types.
12*8a1ab315SDavid Howells  *
13*8a1ab315SDavid Howells  * By convention, 64 bit architectures use the stat interface, while
14*8a1ab315SDavid Howells  * 32 bit architectures use the stat64 interface. Note that we don't
15*8a1ab315SDavid Howells  * provide an __old_kernel_stat here, which new architecture should
16*8a1ab315SDavid Howells  * not have to start with.
17*8a1ab315SDavid Howells  */
18*8a1ab315SDavid Howells 
19*8a1ab315SDavid Howells #include <asm/bitsperlong.h>
20*8a1ab315SDavid Howells 
21*8a1ab315SDavid Howells #define STAT_HAVE_NSEC 1
22*8a1ab315SDavid Howells 
23*8a1ab315SDavid Howells struct stat {
24*8a1ab315SDavid Howells 	unsigned long	st_dev;		/* Device.  */
25*8a1ab315SDavid Howells 	unsigned long	st_ino;		/* File serial number.  */
26*8a1ab315SDavid Howells 	unsigned int	st_mode;	/* File mode.  */
27*8a1ab315SDavid Howells 	unsigned int	st_nlink;	/* Link count.  */
28*8a1ab315SDavid Howells 	unsigned int	st_uid;		/* User ID of the file's owner.  */
29*8a1ab315SDavid Howells 	unsigned int	st_gid;		/* Group ID of the file's group. */
30*8a1ab315SDavid Howells 	unsigned long	st_rdev;	/* Device number, if device.  */
31*8a1ab315SDavid Howells 	unsigned long	__pad1;
32*8a1ab315SDavid Howells 	long		st_size;	/* Size of file, in bytes.  */
33*8a1ab315SDavid Howells 	int		st_blksize;	/* Optimal block size for I/O.  */
34*8a1ab315SDavid Howells 	int		__pad2;
35*8a1ab315SDavid Howells 	long		st_blocks;	/* Number 512-byte blocks allocated. */
36*8a1ab315SDavid Howells 	long		st_atime;	/* Time of last access.  */
37*8a1ab315SDavid Howells 	unsigned long	st_atime_nsec;
38*8a1ab315SDavid Howells 	long		st_mtime;	/* Time of last modification.  */
39*8a1ab315SDavid Howells 	unsigned long	st_mtime_nsec;
40*8a1ab315SDavid Howells 	long		st_ctime;	/* Time of last status change.  */
41*8a1ab315SDavid Howells 	unsigned long	st_ctime_nsec;
42*8a1ab315SDavid Howells 	unsigned int	__unused4;
43*8a1ab315SDavid Howells 	unsigned int	__unused5;
44*8a1ab315SDavid Howells };
45*8a1ab315SDavid Howells 
46*8a1ab315SDavid Howells /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
47*8a1ab315SDavid Howells #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
48*8a1ab315SDavid Howells struct stat64 {
49*8a1ab315SDavid Howells 	unsigned long long st_dev;	/* Device.  */
50*8a1ab315SDavid Howells 	unsigned long long st_ino;	/* File serial number.  */
51*8a1ab315SDavid Howells 	unsigned int	st_mode;	/* File mode.  */
52*8a1ab315SDavid Howells 	unsigned int	st_nlink;	/* Link count.  */
53*8a1ab315SDavid Howells 	unsigned int	st_uid;		/* User ID of the file's owner.  */
54*8a1ab315SDavid Howells 	unsigned int	st_gid;		/* Group ID of the file's group. */
55*8a1ab315SDavid Howells 	unsigned long long st_rdev;	/* Device number, if device.  */
56*8a1ab315SDavid Howells 	unsigned long long __pad1;
57*8a1ab315SDavid Howells 	long long	st_size;	/* Size of file, in bytes.  */
58*8a1ab315SDavid Howells 	int		st_blksize;	/* Optimal block size for I/O.  */
59*8a1ab315SDavid Howells 	int		__pad2;
60*8a1ab315SDavid Howells 	long long	st_blocks;	/* Number 512-byte blocks allocated. */
61*8a1ab315SDavid Howells 	int		st_atime;	/* Time of last access.  */
62*8a1ab315SDavid Howells 	unsigned int	st_atime_nsec;
63*8a1ab315SDavid Howells 	int		st_mtime;	/* Time of last modification.  */
64*8a1ab315SDavid Howells 	unsigned int	st_mtime_nsec;
65*8a1ab315SDavid Howells 	int		st_ctime;	/* Time of last status change.  */
66*8a1ab315SDavid Howells 	unsigned int	st_ctime_nsec;
67*8a1ab315SDavid Howells 	unsigned int	__unused4;
68*8a1ab315SDavid Howells 	unsigned int	__unused5;
69*8a1ab315SDavid Howells };
70*8a1ab315SDavid Howells #endif
71*8a1ab315SDavid Howells 
72*8a1ab315SDavid Howells #endif /* __ASM_GENERIC_STAT_H */
73