xref: /linux/include/uapi/asm-generic/stat.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*6f52b16cSGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
28a1ab315SDavid Howells #ifndef __ASM_GENERIC_STAT_H
38a1ab315SDavid Howells #define __ASM_GENERIC_STAT_H
48a1ab315SDavid Howells 
58a1ab315SDavid Howells /*
68a1ab315SDavid Howells  * Everybody gets this wrong and has to stick with it for all
78a1ab315SDavid Howells  * eternity. Hopefully, this version gets used by new architectures
88a1ab315SDavid Howells  * so they don't fall into the same traps.
98a1ab315SDavid Howells  *
108a1ab315SDavid Howells  * stat64 is copied from powerpc64, with explicit padding added.
118a1ab315SDavid Howells  * stat is the same structure layout on 64-bit, without the 'long long'
128a1ab315SDavid Howells  * types.
138a1ab315SDavid Howells  *
148a1ab315SDavid Howells  * By convention, 64 bit architectures use the stat interface, while
158a1ab315SDavid Howells  * 32 bit architectures use the stat64 interface. Note that we don't
168a1ab315SDavid Howells  * provide an __old_kernel_stat here, which new architecture should
178a1ab315SDavid Howells  * not have to start with.
188a1ab315SDavid Howells  */
198a1ab315SDavid Howells 
208a1ab315SDavid Howells #include <asm/bitsperlong.h>
218a1ab315SDavid Howells 
228a1ab315SDavid Howells #define STAT_HAVE_NSEC 1
238a1ab315SDavid Howells 
248a1ab315SDavid Howells struct stat {
258a1ab315SDavid Howells 	unsigned long	st_dev;		/* Device.  */
268a1ab315SDavid Howells 	unsigned long	st_ino;		/* File serial number.  */
278a1ab315SDavid Howells 	unsigned int	st_mode;	/* File mode.  */
288a1ab315SDavid Howells 	unsigned int	st_nlink;	/* Link count.  */
298a1ab315SDavid Howells 	unsigned int	st_uid;		/* User ID of the file's owner.  */
308a1ab315SDavid Howells 	unsigned int	st_gid;		/* Group ID of the file's group. */
318a1ab315SDavid Howells 	unsigned long	st_rdev;	/* Device number, if device.  */
328a1ab315SDavid Howells 	unsigned long	__pad1;
338a1ab315SDavid Howells 	long		st_size;	/* Size of file, in bytes.  */
348a1ab315SDavid Howells 	int		st_blksize;	/* Optimal block size for I/O.  */
358a1ab315SDavid Howells 	int		__pad2;
368a1ab315SDavid Howells 	long		st_blocks;	/* Number 512-byte blocks allocated. */
378a1ab315SDavid Howells 	long		st_atime;	/* Time of last access.  */
388a1ab315SDavid Howells 	unsigned long	st_atime_nsec;
398a1ab315SDavid Howells 	long		st_mtime;	/* Time of last modification.  */
408a1ab315SDavid Howells 	unsigned long	st_mtime_nsec;
418a1ab315SDavid Howells 	long		st_ctime;	/* Time of last status change.  */
428a1ab315SDavid Howells 	unsigned long	st_ctime_nsec;
438a1ab315SDavid Howells 	unsigned int	__unused4;
448a1ab315SDavid Howells 	unsigned int	__unused5;
458a1ab315SDavid Howells };
468a1ab315SDavid Howells 
478a1ab315SDavid Howells /* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
488a1ab315SDavid Howells #if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
498a1ab315SDavid Howells struct stat64 {
508a1ab315SDavid Howells 	unsigned long long st_dev;	/* Device.  */
518a1ab315SDavid Howells 	unsigned long long st_ino;	/* File serial number.  */
528a1ab315SDavid Howells 	unsigned int	st_mode;	/* File mode.  */
538a1ab315SDavid Howells 	unsigned int	st_nlink;	/* Link count.  */
548a1ab315SDavid Howells 	unsigned int	st_uid;		/* User ID of the file's owner.  */
558a1ab315SDavid Howells 	unsigned int	st_gid;		/* Group ID of the file's group. */
568a1ab315SDavid Howells 	unsigned long long st_rdev;	/* Device number, if device.  */
578a1ab315SDavid Howells 	unsigned long long __pad1;
588a1ab315SDavid Howells 	long long	st_size;	/* Size of file, in bytes.  */
598a1ab315SDavid Howells 	int		st_blksize;	/* Optimal block size for I/O.  */
608a1ab315SDavid Howells 	int		__pad2;
618a1ab315SDavid Howells 	long long	st_blocks;	/* Number 512-byte blocks allocated. */
628a1ab315SDavid Howells 	int		st_atime;	/* Time of last access.  */
638a1ab315SDavid Howells 	unsigned int	st_atime_nsec;
648a1ab315SDavid Howells 	int		st_mtime;	/* Time of last modification.  */
658a1ab315SDavid Howells 	unsigned int	st_mtime_nsec;
668a1ab315SDavid Howells 	int		st_ctime;	/* Time of last status change.  */
678a1ab315SDavid Howells 	unsigned int	st_ctime_nsec;
688a1ab315SDavid Howells 	unsigned int	__unused4;
698a1ab315SDavid Howells 	unsigned int	__unused5;
708a1ab315SDavid Howells };
718a1ab315SDavid Howells #endif
728a1ab315SDavid Howells 
738a1ab315SDavid Howells #endif /* __ASM_GENERIC_STAT_H */
74