linux-um archives
 help / color / mirror / Atom feed
From: Tobias Brunner <tobias@strongswan.org>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH] hostfs: fix setting the timestamps of files
Date: Tue, 10 Nov 2009 14:50:21 +0100	[thread overview]
Message-ID: <4AF96F9D.80107@strongswan.org> (raw)

When setting the timestamps of a file using e.g. futimens the flag
HOSTFS_ATTR_(A|M)TIME_SET is set only if explicit timestamps were
specified. If futimens is called without timestamps (i.e. parameter
times is set to NULL), only HOSTFS_ATTR_(A|M)TIME is set. On the other
hand, the latter flag is also set if the timestamps were explicitly
specified.

Signed-off-by: Tobias Brunner <tobias@strongswan.org>
---
 fs/hostfs/hostfs_user.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c
index b79424f..3da7cdd 100644
--- a/fs/hostfs/hostfs_user.c
+++ b/fs/hostfs/hostfs_user.c
@@ -277,7 +277,8 @@ int set_attr(const char *file, struct hostfs_iattr
*attrs, int fd)
 	 * times according to the changes to perform, and then call futimes()
 	 * or utimes() to apply them.
 	 */
-	ma = (HOSTFS_ATTR_ATIME_SET | HOSTFS_ATTR_MTIME_SET);
+	/* Note: ctime is not handled */
+	ma = (HOSTFS_ATTR_ATIME | HOSTFS_ATTR_MTIME);
 	if (attrs->ia_valid & ma) {
 		err = stat_file(file, NULL, NULL, NULL, NULL, NULL, NULL,
 				&atime_ts, &mtime_ts, NULL, NULL, NULL, fd);
@@ -289,11 +290,11 @@ int set_attr(const char *file, struct hostfs_iattr
*attrs, int fd)
 		times[1].tv_sec = mtime_ts.tv_sec;
 		times[1].tv_usec = mtime_ts.tv_nsec / 1000;

-		if (attrs->ia_valid & HOSTFS_ATTR_ATIME_SET) {
+		if (attrs->ia_valid & HOSTFS_ATTR_ATIME) {
 			times[0].tv_sec = attrs->ia_atime.tv_sec;
 			times[0].tv_usec = attrs->ia_atime.tv_nsec / 1000;
 		}
-		if (attrs->ia_valid & HOSTFS_ATTR_MTIME_SET) {
+		if (attrs->ia_valid & HOSTFS_ATTR_MTIME) {
 			times[1].tv_sec = attrs->ia_mtime.tv_sec;
 			times[1].tv_usec = attrs->ia_mtime.tv_nsec / 1000;
 		}
@@ -306,14 +307,6 @@ int set_attr(const char *file, struct hostfs_iattr
*attrs, int fd)
 		}
 	}

-	/* Note: ctime is not handled */
-	if (attrs->ia_valid & (HOSTFS_ATTR_ATIME | HOSTFS_ATTR_MTIME)) {
-		err = stat_file(file, NULL, NULL, NULL, NULL, NULL, NULL,
-				&attrs->ia_atime, &attrs->ia_mtime, NULL,
-				NULL, NULL, fd);
-		if (err != 0)
-			return err;
-	}
 	return 0;
 }


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


             reply	other threads:[~2009-11-10 14:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 13:50 Tobias Brunner [this message]
2009-12-15  5:07 ` [uml-devel] [PATCH] hostfs: fix setting the timestamps of files Rob Landley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF96F9D.80107@strongswan.org \
    --to=tobias@strongswan.org \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox