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