xref: /openbmc/linux/arch/x86/include/uapi/asm/stat.h (revision 31b90347)
1 #ifndef _ASM_X86_STAT_H
2 #define _ASM_X86_STAT_H
3 
4 #define STAT_HAVE_NSEC 1
5 
6 #ifdef __i386__
7 struct stat {
8 	unsigned long  st_dev;
9 	unsigned long  st_ino;
10 	unsigned short st_mode;
11 	unsigned short st_nlink;
12 	unsigned short st_uid;
13 	unsigned short st_gid;
14 	unsigned long  st_rdev;
15 	unsigned long  st_size;
16 	unsigned long  st_blksize;
17 	unsigned long  st_blocks;
18 	unsigned long  st_atime;
19 	unsigned long  st_atime_nsec;
20 	unsigned long  st_mtime;
21 	unsigned long  st_mtime_nsec;
22 	unsigned long  st_ctime;
23 	unsigned long  st_ctime_nsec;
24 	unsigned long  __unused4;
25 	unsigned long  __unused5;
26 };
27 
28 /* We don't need to memset the whole thing just to initialize the padding */
29 #define INIT_STRUCT_STAT_PADDING(st) do {	\
30 	st.__unused4 = 0;			\
31 	st.__unused5 = 0;			\
32 } while (0)
33 
34 #define STAT64_HAS_BROKEN_ST_INO	1
35 
36 /* This matches struct stat64 in glibc2.1, hence the absolutely
37  * insane amounts of padding around dev_t's.
38  */
39 struct stat64 {
40 	unsigned long long	st_dev;
41 	unsigned char	__pad0[4];
42 
43 	unsigned long	__st_ino;
44 
45 	unsigned int	st_mode;
46 	unsigned int	st_nlink;
47 
48 	unsigned long	st_uid;
49 	unsigned long	st_gid;
50 
51 	unsigned long long	st_rdev;
52 	unsigned char	__pad3[4];
53 
54 	long long	st_size;
55 	unsigned long	st_blksize;
56 
57 	/* Number 512-byte blocks allocated. */
58 	unsigned long long	st_blocks;
59 
60 	unsigned long	st_atime;
61 	unsigned long	st_atime_nsec;
62 
63 	unsigned long	st_mtime;
64 	unsigned int	st_mtime_nsec;
65 
66 	unsigned long	st_ctime;
67 	unsigned long	st_ctime_nsec;
68 
69 	unsigned long long	st_ino;
70 };
71 
72 /* We don't need to memset the whole thing just to initialize the padding */
73 #define INIT_STRUCT_STAT64_PADDING(st) do {		\
74 	memset(&st.__pad0, 0, sizeof(st.__pad0));	\
75 	memset(&st.__pad3, 0, sizeof(st.__pad3));	\
76 } while (0)
77 
78 #else /* __i386__ */
79 
80 struct stat {
81 	unsigned long	st_dev;
82 	unsigned long	st_ino;
83 	unsigned long	st_nlink;
84 
85 	unsigned int	st_mode;
86 	unsigned int	st_uid;
87 	unsigned int	st_gid;
88 	unsigned int	__pad0;
89 	unsigned long	st_rdev;
90 	long		st_size;
91 	long		st_blksize;
92 	long		st_blocks;	/* Number 512-byte blocks allocated. */
93 
94 	unsigned long	st_atime;
95 	unsigned long	st_atime_nsec;
96 	unsigned long	st_mtime;
97 	unsigned long	st_mtime_nsec;
98 	unsigned long	st_ctime;
99 	unsigned long   st_ctime_nsec;
100 	long		__unused[3];
101 };
102 
103 /* We don't need to memset the whole thing just to initialize the padding */
104 #define INIT_STRUCT_STAT_PADDING(st) do {	\
105 	st.__pad0 = 0;				\
106 	st.__unused[0] = 0;			\
107 	st.__unused[1] = 0;			\
108 	st.__unused[2] = 0;			\
109 } while (0)
110 
111 #endif
112 
113 /* for 32bit emulation and 32 bit kernels */
114 struct __old_kernel_stat {
115 	unsigned short st_dev;
116 	unsigned short st_ino;
117 	unsigned short st_mode;
118 	unsigned short st_nlink;
119 	unsigned short st_uid;
120 	unsigned short st_gid;
121 	unsigned short st_rdev;
122 #ifdef __i386__
123 	unsigned long  st_size;
124 	unsigned long  st_atime;
125 	unsigned long  st_mtime;
126 	unsigned long  st_ctime;
127 #else
128 	unsigned int  st_size;
129 	unsigned int  st_atime;
130 	unsigned int  st_mtime;
131 	unsigned int  st_ctime;
132 #endif
133 };
134 
135 #endif /* _ASM_X86_STAT_H */
136