Skip to contentSkip to conversation

Fix statfs(64) syscall wrapper

PATCH New Andreas Schwab 1 participant 1 message Jul 2, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix statfs(64) syscall wrapper

The kernel's idea of fsid_t has always been a structure with 2 ints, identical to the user space definition.

Andreas.

syscall.c renamed from syscall.c.~1.111.~ +4 -2
@@ -3346,7 +3346,8 @@ long do_syscall(void *cpu_env, int num, 
             put_user(stfs.f_bavail, &target_stfs->f_bavail);
             put_user(stfs.f_files, &target_stfs->f_files);
             put_user(stfs.f_ffree, &target_stfs->f_ffree);
-            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid);
+            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
+            put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
             put_user(stfs.f_namelen, &target_stfs->f_namelen);
             unlock_user_struct(target_stfs, arg2, 1);
         }
@@ -3372,7 +3373,8 @@ long do_syscall(void *cpu_env, int num, 
             put_user(stfs.f_bavail, &target_stfs->f_bavail);
             put_user(stfs.f_files, &target_stfs->f_files);
             put_user(stfs.f_ffree, &target_stfs->f_ffree);
-            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid);
+            put_user(stfs.f_fsid.__val[0], &target_stfs->f_fsid.val[0]);
+            put_user(stfs.f_fsid.__val[1], &target_stfs->f_fsid.val[1]);
             put_user(stfs.f_namelen, &target_stfs->f_namelen);
             unlock_user_struct(target_stfs, arg3, 0);
         }
syscall_defs.h renamed from syscall_defs.h.~1.35.~ +8 -4
@@ -1305,6 +1305,10 @@ struct target_stat64 {
 #error unsupported CPU
 #endif
 
+typedef struct {
+        int     val[2];
+} target_fsid_t;
+
 #ifdef TARGET_MIPS
 struct target_statfs {
 	target_long		f_type;
@@ -1317,7 +1321,7 @@ struct target_statfs {
 	target_long		f_bavail;
 
 	/* Linux specials */
-	int	f_fsid;
+	target_fsid_t		f_fsid;
 	target_long		f_namelen;
 	target_long		f_spare[6];
 };
@@ -1332,7 +1336,7 @@ struct target_statfs64 {
 	uint64_t	f_files;
 	uint64_t	f_ffree;
 	uint64_t	f_bavail;
-	int f_fsid;
+	target_fsid_t	f_fsid;
 	uint32_t	f_namelen;
 	uint32_t	f_spare[6];
 };
@@ -1345,7 +1349,7 @@ struct target_statfs {
 	uint32_t f_bavail;
 	uint32_t f_files;
 	uint32_t f_ffree;
-	int f_fsid;
+	target_fsid_t f_fsid;
 	uint32_t f_namelen;
 	uint32_t f_frsize;
 	uint32_t f_spare[5];
@@ -1359,7 +1363,7 @@ struct target_statfs64 {
 	uint64_t f_bavail;
 	uint64_t f_files;
 	uint64_t f_ffree;
-	int f_fsid;
+	target_fsid_t f_fsid;
         uint32_t f_namelen;
 	uint32_t f_frsize;
 	uint32_t f_spare[5];
Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."