Skip to contentSkip to conversation

Fixed hostfs tv_usec / tv_nsec conversion in 2.6.22.9

PATCH In review Dominique Quatravaux 2 participants 4 messages Nov 20, 2007 – Nov 21, 2007 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fixed hostfs tv_usec / tv_nsec conversion in 2.6.22.9

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear UML developpers and users,

The attached patch against Linux 2.6.22.9 fixes an issue with emulating the utimes() and futimes() system calls, that used to cause
- -EINVAL to be returned from such.

Regards,

- --
<< Tout n'y est pas parfait, mais on y honore certainement les jardiniers >>

Dominique Quatravaux <[email protected]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBR0L0CvTYH7KfeIIFAQJYuAP/a6gUhIS8rTd6daU55XZa+j4B7cnGFxvX lVXUZYzznsgWP77TZBDkhiisBJPiUJ67Lvnsaq883xjebOteaZ6QjxRMszV7N16o WOxq9Qu0+bLZjiYuQWuGvw/4j2NJ6BSO9dA+8Lu6siSIxuH8FgNvPnZgXXV0npNg KgAzwvEmmDE=
=yC7D
-----END PGP SIGNATURE-----

fs/hostfs/hostfs_user.c +4 -4
@@ -262,17 +262,17 @@ int set_attr(const char *file, struct ho
 			return err;
 
 		times[0].tv_sec = atime_ts.tv_sec;
-		times[0].tv_usec = atime_ts.tv_nsec * 1000;
+		times[0].tv_usec = atime_ts.tv_nsec / 1000;
 		times[1].tv_sec = mtime_ts.tv_sec;
-		times[1].tv_usec = mtime_ts.tv_nsec * 1000;
+		times[1].tv_usec = mtime_ts.tv_nsec / 1000;
 
 		if (attrs->ia_valid & HOSTFS_ATTR_ATIME_SET) {
 			times[0].tv_sec = attrs->ia_atime.tv_sec;
-			times[0].tv_usec = attrs->ia_atime.tv_nsec * 1000;
+			times[0].tv_usec = attrs->ia_atime.tv_nsec / 1000;
 		}
 		if (attrs->ia_valid & HOSTFS_ATTR_MTIME_SET) {
 			times[1].tv_sec = attrs->ia_mtime.tv_sec;
-			times[1].tv_usec = attrs->ia_mtime.tv_nsec * 1000;
+			times[1].tv_usec = attrs->ia_mtime.tv_nsec / 1000;
 		}
 
 		if (fd >= 0) {

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 3 lines · Dominique Quatravaux

The attached patch against Linux 2.6.22.9 fixes an issue with emulating the utimes() and futimes() system calls, that used to cause
- -EINVAL to be returned from such.

Whoa.

Can I get a Signed-off-by: from you?

Jeff

Signature · 10 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · Jeff Dike

Can I get a Signed-off-by: from you?

Sure thing, although I was not planning on asserting copyright on a grand total of 4 slashes...

- -=-=-=-

- From Dominique Quatravaux <[email protected]>

To convert from tv_nsec to tv_usec, one needs to divide by 1000, not multiply.

- ---

fs/hostfs/hostfs_user.c +0 -0

- --- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -262,17 +262,17 @@ int set_attr(const char *file, struct ho

             return err;
 
         times[0].tv_sec = atime_ts.tv_sec;
- -        times[0].tv_usec = atime_ts.tv_nsec * 1000;
+        times[0].tv_usec = atime_ts.tv_nsec / 1000;
         times[1].tv_sec = mtime_ts.tv_sec;

- - times[1].tv_usec = mtime_ts.tv_nsec * 1000;
+ times[1].tv_usec = mtime_ts.tv_nsec / 1000;

         if (attrs->ia_valid & HOSTFS_ATTR_ATIME_SET) {
             times[0].tv_sec = attrs->ia_atime.tv_sec;
- -            times[0].tv_usec = attrs->ia_atime.tv_nsec * 1000;
+            times[0].tv_usec = attrs->ia_atime.tv_nsec / 1000;
         }
         if (attrs->ia_valid & HOSTFS_ATTR_MTIME_SET) {
             times[1].tv_sec = attrs->ia_mtime.tv_sec;
- -            times[1].tv_usec = attrs->ia_mtime.tv_nsec * 1000;
+            times[1].tv_usec = attrs->ia_mtime.tv_nsec / 1000;
         }
 
         if (fd >= 0) {

- --
<< Tout n'y est pas parfait, mais on y honore certainement les jardiniers >>

Dominique Quatravaux <[email protected]>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBR0QOWPTYH7KfeIIFAQLaNgQAo/mzyru7m/Iafg57olEQXIy4jMyvJhma Pd2XC4JKrAIQ0o3ut/IjuYoGatp0vDALsqAfURCKPaSyyy+xxSl5Ihvg0WcbrcSa jB3ydvweUgiMfcMho6j2zWLUuhMAdlmtprmj1Gy2jfet+5HM9HwlmxzaNB40TeuW jvSrEvjTHBw=
=YgoE
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw
Quoted 2 lines · Dominique Quatravaux

Sure thing, although I was not planning on asserting copyright on a grand total of 4 slashes...

It's the thought that counts :-)

Thanks.

Jeff

Signature · 10 lines
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel