162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef __ASM_GENERIC_STAT_H
362306a36Sopenharmony_ci#define __ASM_GENERIC_STAT_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/*
662306a36Sopenharmony_ci * Everybody gets this wrong and has to stick with it for all
762306a36Sopenharmony_ci * eternity. Hopefully, this version gets used by new architectures
862306a36Sopenharmony_ci * so they don't fall into the same traps.
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * stat64 is copied from powerpc64, with explicit padding added.
1162306a36Sopenharmony_ci * stat is the same structure layout on 64-bit, without the 'long long'
1262306a36Sopenharmony_ci * types.
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci * By convention, 64 bit architectures use the stat interface, while
1562306a36Sopenharmony_ci * 32 bit architectures use the stat64 interface. Note that we don't
1662306a36Sopenharmony_ci * provide an __old_kernel_stat here, which new architecture should
1762306a36Sopenharmony_ci * not have to start with.
1862306a36Sopenharmony_ci */
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#include <asm/bitsperlong.h>
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define STAT_HAVE_NSEC 1
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistruct stat {
2562306a36Sopenharmony_ci	unsigned long	st_dev;		/* Device.  */
2662306a36Sopenharmony_ci	unsigned long	st_ino;		/* File serial number.  */
2762306a36Sopenharmony_ci	unsigned int	st_mode;	/* File mode.  */
2862306a36Sopenharmony_ci	unsigned int	st_nlink;	/* Link count.  */
2962306a36Sopenharmony_ci	unsigned int	st_uid;		/* User ID of the file's owner.  */
3062306a36Sopenharmony_ci	unsigned int	st_gid;		/* Group ID of the file's group. */
3162306a36Sopenharmony_ci	unsigned long	st_rdev;	/* Device number, if device.  */
3262306a36Sopenharmony_ci	unsigned long	__pad1;
3362306a36Sopenharmony_ci	long		st_size;	/* Size of file, in bytes.  */
3462306a36Sopenharmony_ci	int		st_blksize;	/* Optimal block size for I/O.  */
3562306a36Sopenharmony_ci	int		__pad2;
3662306a36Sopenharmony_ci	long		st_blocks;	/* Number 512-byte blocks allocated. */
3762306a36Sopenharmony_ci	long		st_atime;	/* Time of last access.  */
3862306a36Sopenharmony_ci	unsigned long	st_atime_nsec;
3962306a36Sopenharmony_ci	long		st_mtime;	/* Time of last modification.  */
4062306a36Sopenharmony_ci	unsigned long	st_mtime_nsec;
4162306a36Sopenharmony_ci	long		st_ctime;	/* Time of last status change.  */
4262306a36Sopenharmony_ci	unsigned long	st_ctime_nsec;
4362306a36Sopenharmony_ci	unsigned int	__unused4;
4462306a36Sopenharmony_ci	unsigned int	__unused5;
4562306a36Sopenharmony_ci};
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
4862306a36Sopenharmony_ci#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
4962306a36Sopenharmony_cistruct stat64 {
5062306a36Sopenharmony_ci	unsigned long long st_dev;	/* Device.  */
5162306a36Sopenharmony_ci	unsigned long long st_ino;	/* File serial number.  */
5262306a36Sopenharmony_ci	unsigned int	st_mode;	/* File mode.  */
5362306a36Sopenharmony_ci	unsigned int	st_nlink;	/* Link count.  */
5462306a36Sopenharmony_ci	unsigned int	st_uid;		/* User ID of the file's owner.  */
5562306a36Sopenharmony_ci	unsigned int	st_gid;		/* Group ID of the file's group. */
5662306a36Sopenharmony_ci	unsigned long long st_rdev;	/* Device number, if device.  */
5762306a36Sopenharmony_ci	unsigned long long __pad1;
5862306a36Sopenharmony_ci	long long	st_size;	/* Size of file, in bytes.  */
5962306a36Sopenharmony_ci	int		st_blksize;	/* Optimal block size for I/O.  */
6062306a36Sopenharmony_ci	int		__pad2;
6162306a36Sopenharmony_ci	long long	st_blocks;	/* Number 512-byte blocks allocated. */
6262306a36Sopenharmony_ci	int		st_atime;	/* Time of last access.  */
6362306a36Sopenharmony_ci	unsigned int	st_atime_nsec;
6462306a36Sopenharmony_ci	int		st_mtime;	/* Time of last modification.  */
6562306a36Sopenharmony_ci	unsigned int	st_mtime_nsec;
6662306a36Sopenharmony_ci	int		st_ctime;	/* Time of last status change.  */
6762306a36Sopenharmony_ci	unsigned int	st_ctime_nsec;
6862306a36Sopenharmony_ci	unsigned int	__unused4;
6962306a36Sopenharmony_ci	unsigned int	__unused5;
7062306a36Sopenharmony_ci};
7162306a36Sopenharmony_ci#endif
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci#endif /* __ASM_GENERIC_STAT_H */
74