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