162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef _ASM_X86_STAT_H
362306a36Sopenharmony_ci#define _ASM_X86_STAT_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <asm/posix_types.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define STAT_HAVE_NSEC 1
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifdef __i386__
1062306a36Sopenharmony_cistruct stat {
1162306a36Sopenharmony_ci	unsigned long  st_dev;
1262306a36Sopenharmony_ci	unsigned long  st_ino;
1362306a36Sopenharmony_ci	unsigned short st_mode;
1462306a36Sopenharmony_ci	unsigned short st_nlink;
1562306a36Sopenharmony_ci	unsigned short st_uid;
1662306a36Sopenharmony_ci	unsigned short st_gid;
1762306a36Sopenharmony_ci	unsigned long  st_rdev;
1862306a36Sopenharmony_ci	unsigned long  st_size;
1962306a36Sopenharmony_ci	unsigned long  st_blksize;
2062306a36Sopenharmony_ci	unsigned long  st_blocks;
2162306a36Sopenharmony_ci	unsigned long  st_atime;
2262306a36Sopenharmony_ci	unsigned long  st_atime_nsec;
2362306a36Sopenharmony_ci	unsigned long  st_mtime;
2462306a36Sopenharmony_ci	unsigned long  st_mtime_nsec;
2562306a36Sopenharmony_ci	unsigned long  st_ctime;
2662306a36Sopenharmony_ci	unsigned long  st_ctime_nsec;
2762306a36Sopenharmony_ci	unsigned long  __unused4;
2862306a36Sopenharmony_ci	unsigned long  __unused5;
2962306a36Sopenharmony_ci};
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* We don't need to memset the whole thing just to initialize the padding */
3262306a36Sopenharmony_ci#define INIT_STRUCT_STAT_PADDING(st) do {	\
3362306a36Sopenharmony_ci	st.__unused4 = 0;			\
3462306a36Sopenharmony_ci	st.__unused5 = 0;			\
3562306a36Sopenharmony_ci} while (0)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci#define STAT64_HAS_BROKEN_ST_INO	1
3862306a36Sopenharmony_ci
3962306a36Sopenharmony_ci/* This matches struct stat64 in glibc2.1, hence the absolutely
4062306a36Sopenharmony_ci * insane amounts of padding around dev_t's.
4162306a36Sopenharmony_ci */
4262306a36Sopenharmony_cistruct stat64 {
4362306a36Sopenharmony_ci	unsigned long long	st_dev;
4462306a36Sopenharmony_ci	unsigned char	__pad0[4];
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci	unsigned long	__st_ino;
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci	unsigned int	st_mode;
4962306a36Sopenharmony_ci	unsigned int	st_nlink;
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci	unsigned long	st_uid;
5262306a36Sopenharmony_ci	unsigned long	st_gid;
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci	unsigned long long	st_rdev;
5562306a36Sopenharmony_ci	unsigned char	__pad3[4];
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	long long	st_size;
5862306a36Sopenharmony_ci	unsigned long	st_blksize;
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci	/* Number 512-byte blocks allocated. */
6162306a36Sopenharmony_ci	unsigned long long	st_blocks;
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci	unsigned long	st_atime;
6462306a36Sopenharmony_ci	unsigned long	st_atime_nsec;
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci	unsigned long	st_mtime;
6762306a36Sopenharmony_ci	unsigned int	st_mtime_nsec;
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci	unsigned long	st_ctime;
7062306a36Sopenharmony_ci	unsigned long	st_ctime_nsec;
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	unsigned long long	st_ino;
7362306a36Sopenharmony_ci};
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci/* We don't need to memset the whole thing just to initialize the padding */
7662306a36Sopenharmony_ci#define INIT_STRUCT_STAT64_PADDING(st) do {		\
7762306a36Sopenharmony_ci	memset(&st.__pad0, 0, sizeof(st.__pad0));	\
7862306a36Sopenharmony_ci	memset(&st.__pad3, 0, sizeof(st.__pad3));	\
7962306a36Sopenharmony_ci} while (0)
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci#else /* __i386__ */
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_cistruct stat {
8462306a36Sopenharmony_ci	__kernel_ulong_t	st_dev;
8562306a36Sopenharmony_ci	__kernel_ulong_t	st_ino;
8662306a36Sopenharmony_ci	__kernel_ulong_t	st_nlink;
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ci	unsigned int		st_mode;
8962306a36Sopenharmony_ci	unsigned int		st_uid;
9062306a36Sopenharmony_ci	unsigned int		st_gid;
9162306a36Sopenharmony_ci	unsigned int		__pad0;
9262306a36Sopenharmony_ci	__kernel_ulong_t	st_rdev;
9362306a36Sopenharmony_ci	__kernel_long_t		st_size;
9462306a36Sopenharmony_ci	__kernel_long_t		st_blksize;
9562306a36Sopenharmony_ci	__kernel_long_t		st_blocks;	/* Number 512-byte blocks allocated. */
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	__kernel_ulong_t	st_atime;
9862306a36Sopenharmony_ci	__kernel_ulong_t	st_atime_nsec;
9962306a36Sopenharmony_ci	__kernel_ulong_t	st_mtime;
10062306a36Sopenharmony_ci	__kernel_ulong_t	st_mtime_nsec;
10162306a36Sopenharmony_ci	__kernel_ulong_t	st_ctime;
10262306a36Sopenharmony_ci	__kernel_ulong_t	st_ctime_nsec;
10362306a36Sopenharmony_ci	__kernel_long_t		__unused[3];
10462306a36Sopenharmony_ci};
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci/* We don't need to memset the whole thing just to initialize the padding */
10762306a36Sopenharmony_ci#define INIT_STRUCT_STAT_PADDING(st) do {	\
10862306a36Sopenharmony_ci	st.__pad0 = 0;				\
10962306a36Sopenharmony_ci	st.__unused[0] = 0;			\
11062306a36Sopenharmony_ci	st.__unused[1] = 0;			\
11162306a36Sopenharmony_ci	st.__unused[2] = 0;			\
11262306a36Sopenharmony_ci} while (0)
11362306a36Sopenharmony_ci
11462306a36Sopenharmony_ci#endif
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* for 32bit emulation and 32 bit kernels */
11762306a36Sopenharmony_cistruct __old_kernel_stat {
11862306a36Sopenharmony_ci	unsigned short st_dev;
11962306a36Sopenharmony_ci	unsigned short st_ino;
12062306a36Sopenharmony_ci	unsigned short st_mode;
12162306a36Sopenharmony_ci	unsigned short st_nlink;
12262306a36Sopenharmony_ci	unsigned short st_uid;
12362306a36Sopenharmony_ci	unsigned short st_gid;
12462306a36Sopenharmony_ci	unsigned short st_rdev;
12562306a36Sopenharmony_ci#ifdef __i386__
12662306a36Sopenharmony_ci	unsigned long  st_size;
12762306a36Sopenharmony_ci	unsigned long  st_atime;
12862306a36Sopenharmony_ci	unsigned long  st_mtime;
12962306a36Sopenharmony_ci	unsigned long  st_ctime;
13062306a36Sopenharmony_ci#else
13162306a36Sopenharmony_ci	unsigned int  st_size;
13262306a36Sopenharmony_ci	unsigned int  st_atime;
13362306a36Sopenharmony_ci	unsigned int  st_mtime;
13462306a36Sopenharmony_ci	unsigned int  st_ctime;
13562306a36Sopenharmony_ci#endif
13662306a36Sopenharmony_ci};
13762306a36Sopenharmony_ci
13862306a36Sopenharmony_ci#endif /* _ASM_X86_STAT_H */
139