Skip to content

Commit e3f947a

Browse files
committedFeb 18, 2018
Add missing files
1 parent 4839b56 commit e3f947a

File tree

1 file changed

+200
-0
lines changed

1 file changed

+200
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
commit d3282d2512774dc5027c98930a3852b2b6e8407a
2+
Author: Shea Levy <shea@shealevy.com>
3+
Date: Sun Feb 18 13:50:11 2018 -0500
4+
5+
linux-user: Support f_flags in statfs when available.
6+
7+
Signed-off-by: Shea Levy <shea@shealevy.com>
8+
9+
diff --git a/configure b/configure
10+
index 913e14839d..52fe2bf941 100755
11+
--- a/configure
12+
+++ b/configure
13+
@@ -5303,6 +5303,22 @@ if compile_prog "" "" ; then
14+
have_utmpx=yes
15+
fi
16+
17+
+##########################################
18+
+# Check for newer fields of struct statfs on Linux
19+
+
20+
+if test "$linux_user" = "yes"; then
21+
+ cat > $TMPC <<EOF
22+
+#include <sys/vfs.h>
23+
+
24+
+int main(void) {
25+
+ struct statfs fs;
26+
+ fs.f_flags = 0;
27+
+}
28+
+EOF
29+
+ if compile_object ; then
30+
+ have_statfs_flags=yes
31+
+ fi
32+
+fi
33+
##########################################
34+
# checks for sanitizers
35+
36+
@@ -6518,6 +6534,10 @@ if test "$have_utmpx" = "yes" ; then
37+
echo "HAVE_UTMPX=y" >> $config_host_mak
38+
fi
39+
40+
+if test "$have_statfs_flags" = "yes" ; then
41+
+ echo "HAVE_STATFS_FLAGS=y" >> $config_host_mak
42+
+fi
43+
+
44+
if test "$ivshmem" = "yes" ; then
45+
echo "CONFIG_IVSHMEM=y" >> $config_host_mak
46+
fi
47+
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
48+
index 82b35a6bdf..77481eca2c 100644
49+
--- a/linux-user/syscall.c
50+
+++ b/linux-user/syscall.c
51+
@@ -9534,6 +9534,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
52+
__put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
53+
__put_user(stfs.f_namelen, &target_stfs->f_namelen);
54+
__put_user(stfs.f_frsize, &target_stfs->f_frsize);
55+
+#ifdef HAVE_STATFS_FLAGS
56+
+ __put_user(stfs.f_flags, &target_stfs->f_flags);
57+
+#endif
58+
memset(target_stfs->f_spare, 0, sizeof(target_stfs->f_spare));
59+
unlock_user_struct(target_stfs, arg2, 1);
60+
}
61+
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
62+
index a35c52a60a..9f90451caf 100644
63+
--- a/linux-user/syscall_defs.h
64+
+++ b/linux-user/syscall_defs.h
65+
@@ -362,7 +362,14 @@ struct kernel_statfs {
66+
int f_ffree;
67+
kernel_fsid_t f_fsid;
68+
int f_namelen;
69+
+#ifdef HAVE_STATFS_FLAGS
70+
+ int f_frsize;
71+
+ int f_flags;
72+
+ int f_spare[4];
73+
+#else
74+
int f_spare[6];
75+
+#endif
76+
+
77+
};
78+
79+
struct target_dirent {
80+
@@ -2223,7 +2230,13 @@ struct target_statfs {
81+
/* Linux specials */
82+
target_fsid_t f_fsid;
83+
int32_t f_namelen;
84+
+#ifdef HAVE_STATFS_FLAGS
85+
+ int32_t f_frsize;
86+
+ int32_t f_flags;
87+
+ int32_t f_spare[4];
88+
+#else
89+
int32_t f_spare[6];
90+
+#endif
91+
};
92+
#else
93+
struct target_statfs {
94+
@@ -2239,7 +2252,13 @@ struct target_statfs {
95+
/* Linux specials */
96+
target_fsid_t f_fsid;
97+
abi_long f_namelen;
98+
+#ifdef HAVE_STATFS_FLAGS
99+
+ abi_long f_frsize;
100+
+ abi_long f_flags;
101+
+ abi_long f_spare[4];
102+
+#else
103+
abi_long f_spare[6];
104+
+#endif
105+
};
106+
#endif
107+
108+
@@ -2255,7 +2274,13 @@ struct target_statfs64 {
109+
uint64_t f_bavail;
110+
target_fsid_t f_fsid;
111+
uint32_t f_namelen;
112+
+#ifdef HAVE_STATFS_FLAGS
113+
+ uint32_t f_frsize;
114+
+ uint32_t f_flags;
115+
+ uint32_t f_spare[4];
116+
+#else
117+
uint32_t f_spare[6];
118+
+#endif
119+
};
120+
#elif (defined(TARGET_PPC64) || defined(TARGET_X86_64) || \
121+
defined(TARGET_SPARC64) || defined(TARGET_AARCH64)) && \
122+
@@ -2271,7 +2296,12 @@ struct target_statfs {
123+
target_fsid_t f_fsid;
124+
abi_long f_namelen;
125+
abi_long f_frsize;
126+
+#ifdef HAVE_STATFS_FLAGS
127+
+ abi_long f_flags;
128+
+ abi_long f_spare[4];
129+
+#else
130+
abi_long f_spare[5];
131+
+#endif
132+
};
133+
134+
struct target_statfs64 {
135+
@@ -2285,7 +2315,12 @@ struct target_statfs64 {
136+
target_fsid_t f_fsid;
137+
abi_long f_namelen;
138+
abi_long f_frsize;
139+
+#ifdef HAVE_STATFS_FLAGS
140+
+ abi_long f_flags;
141+
+ abi_long f_spare[4];
142+
+#else
143+
abi_long f_spare[5];
144+
+#endif
145+
};
146+
#elif defined(TARGET_S390X)
147+
struct target_statfs {
148+
@@ -2299,7 +2334,13 @@ struct target_statfs {
149+
kernel_fsid_t f_fsid;
150+
int32_t f_namelen;
151+
int32_t f_frsize;
152+
+#ifdef HAVE_STATFS_FLAGS
153+
+ int32_t f_flags;
154+
+ int32_t f_spare[4];
155+
+#else
156+
int32_t f_spare[5];
157+
+#endif
158+
+
159+
};
160+
161+
struct target_statfs64 {
162+
@@ -2313,7 +2354,12 @@ struct target_statfs64 {
163+
kernel_fsid_t f_fsid;
164+
int32_t f_namelen;
165+
int32_t f_frsize;
166+
+#ifdef HAVE_STATFS_FLAGS
167+
+ int32_t f_flags;
168+
+ int32_t f_spare[4];
169+
+#else
170+
int32_t f_spare[5];
171+
+#endif
172+
};
173+
#else
174+
struct target_statfs {
175+
@@ -2327,7 +2373,12 @@ struct target_statfs {
176+
target_fsid_t f_fsid;
177+
uint32_t f_namelen;
178+
uint32_t f_frsize;
179+
+#ifdef HAVE_STATFS_FLAGS
180+
+ uint32_t f_flags;
181+
+ uint32_t f_spare[4];
182+
+#else
183+
uint32_t f_spare[5];
184+
+#endif
185+
};
186+
187+
struct target_statfs64 {
188+
@@ -2341,7 +2392,12 @@ struct target_statfs64 {
189+
target_fsid_t f_fsid;
190+
uint32_t f_namelen;
191+
uint32_t f_frsize;
192+
+#ifdef HAVE_STATFS_FLAGS
193+
+ uint32_t f_flags;
194+
+ uint32_t f_spare[4];
195+
+#else
196+
uint32_t f_spare[5];
197+
+#endif
198+
};
199+
#endif
200+

0 commit comments

Comments
 (0)
Please sign in to comment.