blob: bc03eb5d6360f8cf98ece5365ff2f8c5ea42c85c [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_STAT_H
2#define _ASM_X86_STAT_H
Thomas Gleixner79c74972007-10-23 22:37:24 +02003
H.J. Lub70fedc2013-12-16 16:09:51 -08004#include <asm/posix_types.h>
5
Thomas Gleixner79c74972007-10-23 22:37:24 +02006#define STAT_HAVE_NSEC 1
7
8#ifdef __i386__
9struct 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
Linus Torvalds8529f6132012-05-06 18:02:40 -070030/* 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
Thomas Gleixner79c74972007-10-23 22:37:24 +020036#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 */
41struct 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
Linus Torvalds8529f6132012-05-06 18:02:40 -070074/* 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
Thomas Gleixner79c74972007-10-23 22:37:24 +020080#else /* __i386__ */
81
82struct stat {
H.J. Lub70fedc2013-12-16 16:09:51 -080083 __kernel_ulong_t st_dev;
84 __kernel_ulong_t st_ino;
85 __kernel_ulong_t st_nlink;
Thomas Gleixner79c74972007-10-23 22:37:24 +020086
H.J. Lub70fedc2013-12-16 16:09:51 -080087 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. */
Thomas Gleixner79c74972007-10-23 22:37:24 +020095
H.J. Lub70fedc2013-12-16 16:09:51 -080096 __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];
Thomas Gleixner79c74972007-10-23 22:37:24 +0200103};
Linus Torvalds8529f6132012-05-06 18:02:40 -0700104
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
Thomas Gleixner79c74972007-10-23 22:37:24 +0200113#endif
114
115/* for 32bit emulation and 32 bit kernels */
116struct __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;
Thomas Gleixner96a388d2007-10-11 11:20:03 +0200129#else
Thomas Gleixner79c74972007-10-23 22:37:24 +0200130 unsigned int st_size;
131 unsigned int st_atime;
132 unsigned int st_mtime;
133 unsigned int st_ctime;
134#endif
135};
136
H. Peter Anvin1965aae2008-10-22 22:26:29 -0700137#endif /* _ASM_X86_STAT_H */